- scriptified UseInventory and several functions using the already scriptified ones,
This commit is contained in:
parent
588ddd185b
commit
09129e0113
14 changed files with 384 additions and 436 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue