[svn] autopickup and autoidentify are erratic

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
greycat
Sher'Tul
Posts: 1396
Joined: Tue May 11, 2010 11:51 pm

[svn] autopickup and autoidentify are erratic

#1 Post by greycat »

This started happening within the last couple days' updates. If there's a pile of several gold on a tile, and you step on it, you don't always pick up all of it. Sometimes I've had to step on the pile 3 times to get it all. Also, I've seen items that should have been auto-identified (single-ego daggers, etc.) that were not. These items were also part of a large pile, and I suspect that's connected.

tiger_eye
Perspiring Physicist
Posts: 889
Joined: Thu Feb 17, 2011 5:20 am

Re: [svn] autopickup and autoidentify are erratic

#2 Post by tiger_eye »

Yeah, whoops.

Gold is "picked up" via on_prepickup and not put into inventory, so the function pickupFloor wasn't returning a true value signifying the object was picked up. I had only tested a recent fix on gems, which are automatically put into the inventory. Anyway, good catch, and the following change fixes this:

Code: Select all

Index: game/engines/default/engine/interface/ActorInventory.lua
===================================================================
--- game/engines/default/engine/interface/ActorInventory.lua	(revision 4307)
+++ game/engines/default/engine/interface/ActorInventory.lua	(working copy)
@@ -139,7 +139,9 @@
 			return o
 		elseif not prepickup then
 			if vocal then game.logSeen(self, "%s has no room for: %s.", self.name:capitalize(), o:getName{do_color=true}) end
+			return
 		end
+		return true
 	else
 		if vocal then game.logSeen(self, "There is nothing to pickup there.") end
 	end

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: [svn] autopickup and autoidentify are erratic

#3 Post by darkgod »

fixed
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

tiger_eye
Perspiring Physicist
Posts: 889
Joined: Thu Feb 17, 2011 5:20 am

Re: [svn] autopickup and autoidentify are erratic

#4 Post by tiger_eye »

whoops again.

"on_prepickup" returns true when gold is picked up AND when the golem can't pickup quest items. Hence, the original problem from here exists again. There needs to be a way to differentiate whether "on_prepickup" removes the item (like gold) or needs to skip over the item (like quest gems). The following is one way to do this:

Code: Select all

diff --git a/game/engines/default/engine/interface/ActorInventory.lua b/game/engines/default/engine/interface/ActorInventory.lua
index 066bf09..1efcb4f 100644
--- a/game/engines/default/engine/interface/ActorInventory.lua
+++ b/game/engines/default/engine/interface/ActorInventory.lua
@@ -140,6 +140,8 @@ function _M:pickupFloor(i, vocal, no_sort)
                elseif not prepickup then
                        if vocal then game.logSeen(self, "%s has no room for: %s.", self.name:capitalize(), o:getName{do_color=true}) end
                        return
+               elseif prepickup == "skip" then
+                       return
                else
                        return true
                end
diff --git a/game/modules/tome/class/Object.lua b/game/modules/tome/class/Object.lua
index 7c7aeba..4132bd2 100644
--- a/game/modules/tome/class/Object.lua
+++ b/game/modules/tome/class/Object.lua
@@ -1096,7 +1096,7 @@ end
 --- Called when trying to pickup
 function _M:on_prepickup(who, idx)
        if self.quest and who ~= game.party:findMember{main=true} then
-               return true
+               return "skip"
        end
        if who.player and self.lore then
                game.level.map:removeObject(who.x, who.y, idx)
This has been tested and verified with stacks of items including lots of gold and for the golem trying to auto-pickup quest gems.

Post Reply