- added a virtual 'used' method that gets called when the player presses use on an actor. This method will only be called if the actor does not have the USESPECIAL flag - that one will be handled as before.

This commit is contained in:
Christoph Oelckers 2017-02-15 00:43:30 +01:00
parent c01289e999
commit 8d7a64bd17
2 changed files with 14 additions and 1 deletions

View file

@ -5287,6 +5287,14 @@ bool P_UseTraverse(AActor *usething, const DVector2 &start, const DVector2 &end,
if (P_ActivateThingSpecial(in->d.thing, usething))
return true;
}
IFVIRTUALPTR(usething, AActor, Used)
{
VMValue params[] = { usething, in->d.thing };
int ret;
VMReturn vret(&ret);
GlobalVMStack.Call(func, params, 2, &vret, 1);
if (ret) return true;
}
continue;
}

View file

@ -330,6 +330,11 @@ class Actor : Thinker native
return -1;
}
// Called when the player presses 'use' and an actor is found
virtual bool Used(Actor user)
{
return false;
}
native static class<Actor> GetReplacement(class<Actor> cls);
native static class<Actor> GetReplacee(class<Actor> cls);