[Commands] Make #damage require a target (#2426)

Fixes annoying issue where it affected the client if no target
This commit is contained in:
hg 2022-09-05 13:12:46 -04:00 committed by GitHub
parent 73f310d098
commit 78223b7ebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,9 +8,10 @@ void command_damage(Client *c, const Seperator *sep)
return; return;
} }
Mob* target = c; Mob* target = c->GetTarget();
if (c->GetTarget()) { if (!target) {
target = c->GetTarget(); c->Message(Chat::White, "You must have a target to use #damage.");
return;
} }
int64 damage = std::stoll(sep->arg[1], nullptr, 10); int64 damage = std::stoll(sep->arg[1], nullptr, 10);