Clonks do not collect stuff when inside a container (f.e. a respawn-helper-object)

David Dormagen 2012-10-27 16:34:19 +02:00
parent 0fb880d7aa
commit b694edd92d
1 changed files with 6 additions and 0 deletions

View File

@ -1053,6 +1053,9 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
// Collecting
if (ctrl == CON_Collect)
{
// only if not inside something
if(Contained()) return false; // not handled
var dx = -GetDefWidth()/2, dy = -GetDefHeight()/2;
var wdt = GetDefWidth(), hgt = GetDefHeight()+2;
var obj = FindObject(Find_InRect(dx,dy,wdt,hgt), Find_OCF(OCF_Collectible), Find_NoContainer());
@ -1062,6 +1065,9 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
// collected into the hands
Collect(obj,nil,nil,true);
}
// return not handled to still receive other controls - collection should not block anything else
return false;
}
// Throwing and dropping