[Messages] Add GM Status and Invulnerability Messages (#4266)

* [Messages] Add GM Status and Invulnerability Messages

* Update zoning.cpp

* Finalize.

* Update corpse.cpp

* Update message

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Alex King
2024-05-04 19:07:17 -04:00
committed by GitHub
parent 34c27ebb2a
commit aa0e53f5fc
16 changed files with 364 additions and 149 deletions
+12 -4
View File
@@ -92,10 +92,14 @@ bool Trap::Process()
{
if (chkarea_timer.Enabled() && chkarea_timer.Check() && !reset_timer.Enabled())
{
Mob* trigger = entity_list.GetTrapTrigger(this);
if (trigger && !(trigger->IsClient() && trigger->CastToClient()->GetGM()))
{
Trigger(trigger);
Mob* m = entity_list.GetTrapTrigger(this);
const bool is_gm_client = m->IsClient() && m->CastToClient()->GetGM();
if (m && !is_gm_client) {
Trigger(m);
}
if (is_gm_client) {
m->Message(Chat::White, "Your GM Flag prevents you from triggering a trap.");
}
}
else if (reset_timer.Enabled() && reset_timer.Check())
@@ -315,6 +319,10 @@ Mob* EntityList::GetTrapTrigger(Trap* trap)
Log(Logs::General, Logs::Traps, "%s is about to trigger trap %d of chance %d. diff: %0.2f maxdist: %0.2f zdiff: %0.2f maxzdiff: %0.2f", cur->GetName(), trap->trap_id, trap->chance, (diff.x*diff.x + diff.y*diff.y), maxdist, diff.z, trap->maxzdiff);
return cur;
}
if (cur->GetGM()) {
cur->Message(Chat::White, "Your GM Flag prevents you from triggering a trap.");
}
}
else
{