From 5e171824acfe7e352c187517a837cc2c37b92f7d Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 11 Dec 2016 18:22:50 -0500 Subject: [PATCH] - "myinfo" - executes info on oneself - "targetinv" - executes "printinv" at current crosshair target --- src/c_cmds.cpp | 10 ++++++++++ src/g_inventory/a_pickups.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 56739502e..c9e6dfe93 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -906,6 +906,16 @@ CCMD(info) "the NOBLOCKMAP flag or have height/radius of 0.\n"); } +CCMD(myinfo) +{ + if (CheckCheatmode () || players[consoleplayer].mo == NULL) return; + Printf("Target=%s, Health=%d, Spawnhealth=%d\n", + players[consoleplayer].mo->GetClass()->TypeName.GetChars(), + players[consoleplayer].mo->health, + players[consoleplayer].mo->SpawnHealth()); + PrintMiscActorInfo(players[consoleplayer].mo); +} + typedef bool (*ActorTypeChecker) (AActor *); static bool IsActorAMonster(AActor *mo) diff --git a/src/g_inventory/a_pickups.cpp b/src/g_inventory/a_pickups.cpp index bdd1b6dc6..42af5e87f 100644 --- a/src/g_inventory/a_pickups.cpp +++ b/src/g_inventory/a_pickups.cpp @@ -1598,6 +1598,30 @@ CCMD (printinv) } } +CCMD (targetinv) +{ + AInventory *item; + FTranslatedLineTarget t; + + if (CheckCheatmode () || players[consoleplayer].mo == NULL) + return; + + P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->Angles.Yaw, MISSILERANGE, + &t, 0., ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART); + + if (t.linetarget) + { + for (item = t.linetarget->Inventory; item != NULL; item = item->Inventory) + { + Printf ("%s #%u (%d/%d)\n", item->GetClass()->TypeName.GetChars(), + item->InventoryID, + item->Amount, item->MaxAmount); + } + } + else Printf("No target found. Targetinv cannot find actors that have " + "the NOBLOCKMAP flag or have height/radius of 0.\n"); +} + //=========================================================================== // // AInventory :: AttachToOwner