- scriptified UseInventory and several functions using the already scriptified ones,

This commit is contained in:
Christoph Oelckers 2018-12-01 17:17:08 +01:00
commit 09129e0113
14 changed files with 384 additions and 436 deletions

View file

@ -549,25 +549,11 @@ FString cht_Morph(player_t *player, PClassActor *morphclass, bool quickundo)
void cht_SetInv(player_t *player, const char *string, int amount, bool beyond)
{
if (!stricmp(string, "health"))
IFVIRTUALPTR(player->mo, APlayerPawn, CheatSetInv)
{
if (amount <= 0)
{
cht_Suicide(player);
return;
}
if (!beyond) amount = MIN(amount, player->mo->GetMaxHealth(true));
player->health = player->mo->health = amount;
}
else
{
auto item = PClass::FindActor(string);
if (item != nullptr && item->IsDescendantOf(RUNTIME_CLASS(AInventory)))
{
player->mo->SetInventory(item, amount, beyond);
return;
}
Printf("Unknown item \"%s\"\n", string);
FString message = string;
VMValue params[] = { player->mo, &message, amount, beyond };
VMCall(func, params, 4, nullptr, 0);
}
}