mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
62 lines
1.1 KiB
Plaintext
62 lines
1.1 KiB
Plaintext
include library.create;
|
|
|
|
trigger OnAttach()
|
|
{
|
|
messageTo(self, "handleSpawnRecruiter", null, 3.0f, false);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnDestroy()
|
|
{
|
|
obj_id recruiter = getObjIdObjVar(self, "recruiter");
|
|
|
|
if(isIdValid(recruiter))
|
|
destroyObject(recruiter);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler handleSpawnRecruiter()
|
|
{
|
|
obj_id parent = getObjIdObjVar(self, "theater.parent");
|
|
|
|
if(!isIdValid(parent))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
float yaw = getYaw(self);
|
|
|
|
string faction = getStringObjVar(self, "faction");
|
|
string spawn = "";
|
|
|
|
if(faction == null || faction.equals(""))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(faction.equalsIgnoreCase("rebel"))
|
|
spawn = "rebel_recruiter";
|
|
else if(faction.equalsIgnoreCase("imperial"))
|
|
spawn = "imperial_recruiter";
|
|
|
|
if(spawn == null || spawn.equals(""))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
obj_id recruiter = create.object(spawn, getLocation(self));
|
|
|
|
if(!isIdValid(recruiter))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
setYaw(recruiter, yaw);
|
|
|
|
int items = (int)getFloatObjVar(parent, "modules." + faction);
|
|
setObjVar(recruiter, "item_limit", items);
|
|
|
|
setObjVar(self, "recruiter", recruiter);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
} |