Fix adding items on critters with barter flag

This commit is contained in:
Alexander Batalov 2022-05-20 10:30:04 +03:00
parent cdafe0c654
commit ac9293c3d5
1 changed files with 10 additions and 1 deletions

View File

@ -197,9 +197,18 @@ int itemAttemptAdd(Object* owner, Object* itemToAdd, int quantity)
}
} else if (parentType == OBJ_TYPE_CRITTER) {
if (critterGetBodyType(owner) != BODY_TYPE_BIPED) {
// SFALL: Fix for being unable to plant items on non-biped critters
// with the "Barter" flag set (e.g. Skynet and Goris).
Proto* proto;
if (protoGetProto(owner->pid, &proto) == -1) {
return -5;
}
if ((proto->critter.flags & 0x02) == 0) {
return -5;
}
}
int weightToAdd = itemGetWeight(itemToAdd);
weightToAdd *= quantity;