mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-09-21 07:13:00 -04:00
42 lines
776 B
Plaintext
42 lines
776 B
Plaintext
include library.create;
|
|
|
|
trigger OnAttach()
|
|
{
|
|
messageTo(self, "handleSpawnJunkDealer", null, 3.0f, false);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnDestroy()
|
|
{
|
|
obj_id dealer = getObjIdObjVar(self, "dealer");
|
|
|
|
if(isIdValid(dealer))
|
|
destroyObject(dealer);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler handleSpawnJunkDealer()
|
|
{
|
|
obj_id parent = getObjIdObjVar(self, "theater.parent");
|
|
|
|
if(!isIdValid(parent))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
float yaw = getYaw(self);
|
|
|
|
obj_id dealer = create.object("junk_dealer", getLocation(self));
|
|
|
|
if(!isIdValid(dealer))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
setYaw(dealer, yaw);
|
|
|
|
int money = (int)getFloatObjVar(parent, "modules.junk_dealer");
|
|
setObjVar(dealer, "money_limit", money);
|
|
|
|
setObjVar(self, "dealer", dealer);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
} |