mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
- allow locks to check for a key's species so that newly defined keys can open previously defined locks without the need to redefine them.
This commit is contained in:
parent
b285cbebe4
commit
75cde0b221
1 changed files with 22 additions and 5 deletions
|
@ -19,12 +19,29 @@ struct OneKey
|
||||||
|
|
||||||
bool check(AActor * owner)
|
bool check(AActor * owner)
|
||||||
{
|
{
|
||||||
// P_GetMapColorForKey() checks the key directly
|
|
||||||
if (owner->IsKindOf(RUNTIME_CLASS(AKey)))
|
if (owner->IsKindOf(RUNTIME_CLASS(AKey)))
|
||||||
|
{
|
||||||
|
// P_GetMapColorForKey() checks the key directly
|
||||||
return owner->IsA(key);
|
return owner->IsA(key);
|
||||||
// Other calls check an actor that may have a key in its inventory.
|
}
|
||||||
else
|
else
|
||||||
return !!owner->FindInventory(key);
|
{
|
||||||
|
// Other calls check an actor that may have a key in its inventory.
|
||||||
|
AInventory *item;
|
||||||
|
|
||||||
|
for (item = owner->Inventory; item != NULL; item = item->Inventory)
|
||||||
|
{
|
||||||
|
if (item->IsA(key))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (item->GetSpecies() == key->TypeName)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue