- scriptified cht_Give and cht_Take and made them virtual function of PlayerPawn so that this can be better configured for mods that want other options in here.

- improved the class pointer to string cast to print the actual type it describes and not the class pointer's own type.
- fixed: The 'is' operator created non-working code when checking the inheritance of a class pointer, it only worked for objects.
This commit is contained in:
Christoph Oelckers 2017-01-17 17:31:54 +01:00
commit 14f2c39e58
21 changed files with 559 additions and 461 deletions

View file

@ -822,11 +822,13 @@ bool AActor::GiveInventory(PClassInventory *type, int amount, bool givecheat)
return result;
}
DEFINE_ACTION_FUNCTION(AActor, Inventory)
DEFINE_ACTION_FUNCTION(AActor, GiveInventory)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT_NOT_NULL(item, AInventory);
ACTION_RETURN_BOOL(self->UseInventory(item));
PARAM_CLASS(type, AInventory);
PARAM_INT(amount);
PARAM_BOOL_DEF(givecheat);
ACTION_RETURN_BOOL(self->GiveInventory(type, amount, givecheat));
}
@ -918,6 +920,16 @@ bool AActor::TakeInventory(PClassActor *itemclass, int amount, bool fromdecorate
return result;
}
DEFINE_ACTION_FUNCTION(AActor, TakeInventory)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT_NOT_NULL(item, AInventory);
PARAM_INT(amount);
PARAM_BOOL_DEF(fromdecorate);
PARAM_BOOL_DEF(notakeinfinite);
self->RemoveInventory(item);
return 0;
}
//============================================================================
//