From 8e57180290e44086941cc354c0a365808c157f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caner=20K=C4=B1l=C4=B1=C3=A7o=C4=9Flu?= Date: Tue, 2 Jun 2026 01:54:51 +0300 Subject: [PATCH] Refactor nuke commands: update CV_NUKE and add CV_NUKEITEM Modified the CV_NUKE command to delete both items and characters (NPCs) within the region. Added a new CV_NUKEITEM command to handle item-only deletions, complementing the existing CV_NUKECHAR command. --- Changelog.txt | 4 +++ src/game/clients/CClient.cpp | 8 +++++ src/game/clients/CClientTarg.cpp | 60 +++++++++++++++++++++++++++++++- src/tables/CClient_functions.tbl | 1 + src/tables/defmessages.tbl | 1 + 5 files changed, 73 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 782504276..a21676dd7 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -4141,3 +4141,7 @@ When setting a property like MORE to the a spell or skill defname, trying to rea 19-05-2026, nightNR - Fixed: pre-AOS armor rating (AR) calculation (#1550). - Fixed NPCs can't cast spells from spellbook after respawn (#1551). + +02-06-2026, Caner +- Added: CV_NUKEITEM command to delete only items in the region. +- Changed: CV_NUKE command now deletes both items and characters instead of just items. \ No newline at end of file diff --git a/src/game/clients/CClient.cpp b/src/game/clients/CClient.cpp index 42c53979c..51590ca2a 100644 --- a/src/game/clients/CClient.cpp +++ b/src/game/clients/CClient.cpp @@ -1463,6 +1463,14 @@ bool CClient::r_Verb( CScript & s, CTextConsole * pSrc ) // Execute command from m_tmTile.m_Code = CV_NUKE; // set nuke code. addTarget( CLIMODE_TARG_TILE, g_Cfg.GetDefaultMsg( DEFMSG_SELECT_NUKE_AREA ), true ); break; + + case CV_NUKEITEM: + m_Targ_Text = s.GetArgRaw(); + m_tmTile.m_ptFirst.InitPoint(); // Clear this first + m_tmTile.m_Code = CV_NUKEITEM; // set nuke code. + addTarget( CLIMODE_TARG_TILE, g_Cfg.GetDefaultMsg( DEFMSG_SELECT_NUKE_AREA ), true ); + break; + case CV_NUKECHAR: m_Targ_Text = s.GetArgRaw(); m_tmTile.m_ptFirst.InitPoint(); // Clear this first diff --git a/src/game/clients/CClientTarg.cpp b/src/game/clients/CClientTarg.cpp index db8aa2515..83c2b7d1b 100644 --- a/src/game/clients/CClientTarg.cpp +++ b/src/game/clients/CClientTarg.cpp @@ -661,7 +661,65 @@ bool CClient::OnTarg_Tile( CObjBase * pObj, const CPointMap & pt ) } break; - case CV_NUKE: // NUKE all items in the region. + case CV_NUKE: // NUKE all items and chars in the region. + { + // Items + auto AreaItem = CWorldSearchHolder::GetInstance(ptCtr, iRadius); + AreaItem->SetAllShow(IsPriv(PRIV_ALLSHOW)); + AreaItem->SetSearchSquare(true); + for (;;) + { + CItem *pItem = AreaItem->GetItem(); + if (pItem == nullptr) + break; + if (!rect.IsInside2d(pItem->GetTopPoint())) + continue; + + if (m_Targ_Text.IsEmpty()) + { + pItem->Delete(); + } + else + { + CScript script(m_Targ_Text); + if (!pItem->r_Verb(script, this)) + continue; + } + iCount++; + } + + // Chars + auto AreaChar = CWorldSearchHolder::GetInstance(ptCtr, iRadius); + AreaChar->SetAllShow(IsPriv(PRIV_ALLSHOW)); + AreaChar->SetSearchSquare(true); + for (;;) + { + CChar *pChar = AreaChar->GetChar(); + if (pChar == nullptr) + break; + if (!rect.IsInside2d(pChar->GetTopPoint())) + continue; + if (pChar->m_pPlayer) + continue; + + if (m_Targ_Text.IsEmpty()) + { + pChar->Delete(); + } + else + { + CScript script(m_Targ_Text); + if (!pChar->r_Verb(script, this)) + continue; + } + iCount++; + } + + SysMessagef("%d %s", iCount, g_Cfg.GetDefaultMsg(DEFMSG_NUKED_ENTITIES)); + } + break; + + case CV_NUKEITEM: // NUKE all items in the region. { auto AreaItem = CWorldSearchHolder::GetInstance( ptCtr, iRadius ); AreaItem->SetAllShow( IsPriv( PRIV_ALLSHOW )); diff --git a/src/tables/CClient_functions.tbl b/src/tables/CClient_functions.tbl index 3ec981b58..79ca219e5 100644 --- a/src/tables/CClient_functions.tbl +++ b/src/tables/CClient_functions.tbl @@ -37,6 +37,7 @@ ADD(MIDILIST, "MIDILIST") ADD(NUDGE, "NUDGE") ADD(NUKE, "NUKE") ADD(NUKECHAR, "NUKECHAR") +ADD(NUKEITEM, "NUKEITEM") ADD(OPENPAPERDOLL, "OPENPAPERDOLL") ADD(OPENTRADEWINDOW,"OPENTRADEWINDOW") ADD(REMOVEBUFF, "REMOVEBUFF") diff --git a/src/tables/defmessages.tbl b/src/tables/defmessages.tbl index 9838b04cc..a244baa18 100644 --- a/src/tables/defmessages.tbl +++ b/src/tables/defmessages.tbl @@ -1163,6 +1163,7 @@ MSG(WEB_DESTROY, "You destroy the web") MSG(WEB_WEAKEN, "You weaken the web") MSG(NUKED_ITEMS, "Items Nuked!") MSG(NUKED_CHARS, "Chars Nuked!") +MSG(NUKED_ENTITIES, "Entities Nuked!") MSG(TILED_ITEMS, "Items Created!") MSG(NUDGED_OBJECTS, "Objects Nudged!") MSG(TILE_SAME_POINT, "Thats the same point")