mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[9577] Implement SCRIPT_COMMAND_DESPAWN_SELF (self = creature in this context)
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
dbbc45828a
commit
29b2c80449
4 changed files with 28 additions and 1 deletions
|
|
@ -3506,6 +3506,27 @@ void Map::ScriptsProcess()
|
|||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_DESPAWN_SELF:
|
||||
{
|
||||
if (!target && !source)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_DESPAWN_SELF call for NULL object.");
|
||||
break;
|
||||
}
|
||||
|
||||
// only creature
|
||||
if ((!target || target->GetTypeId() != TYPEID_UNIT) && (!source || source->GetTypeId() != TYPEID_UNIT))
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_DESPAWN_SELF call for non-creature (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
|
||||
break;
|
||||
}
|
||||
|
||||
Creature* pCreature = target && target->GetTypeId() == TYPEID_UNIT ? (Creature*)target : (Creature*)source;
|
||||
|
||||
pCreature->ForcedDespawn(step.script->datalong);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog.outError("Unknown script command %u called.",step.script->command);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue