Files
dsrc/sku.0/sys.server/compiled/game/script/space/content_tools/spacestation.script
T

82 lines
1.8 KiB
Plaintext

include library.space_utils;
include library.sui;
include library.space_content;
include library.objvar_mangle;
include library.space_quest;
include library.space_create;
include library.ship_ai;
include library.utils;
include java.lang.Math;
include library.hue;
// basic spawner
trigger OnAttach()
{
requestPreloadCompleteTrigger(self);
setObjVar(self, "intInvincible", 1);
return SCRIPT_CONTINUE;
}
//Burninated
trigger OnInitialize()
{
requestPreloadCompleteTrigger(self);
return SCRIPT_CONTINUE;
}
trigger OnPreloadComplete()
{
messageTo(self, "registerStation", null, 2, false);
string strName = getStringObjVar(self, "strName");
if(strName!=null)
{
string_id strSpam = new string_id("space/space_mobile_type", strName);
setName(self, strSpam);
}
return SCRIPT_CONTINUE;
}
messageHandler registerStation()
{
LOG("space", "Registering space station");
// register ourselfves with teh conent manager object!
obj_id objQuestManager = getNamedObject(space_quest.QUEST_MANAGER);
if(!isIdValid(objQuestManager))
{
LOG("space", "NO QUEST MANAGER OBJECT FOUND!");
return SCRIPT_CONTINUE;
}
registerStationWithManager(objQuestManager, self);
return SCRIPT_CONTINUE;
}
void registerStationWithManager(obj_id objManager, obj_id objStation)
{
LOG("space", "Registering with "+objManager);
resizeable obj_id[] objSpaceStations = utils.getResizeableObjIdArrayScriptVar(objManager, "objSpaceStations");
if((objSpaceStations==null)||(objSpaceStations.length==0))
{
objSpaceStations = utils.addElement(objSpaceStations, objStation);
}
else
{
// are we already in the array?
int intIndex = utils.getElementPositionInArray(objSpaceStations, objStation);
if(intIndex<0)
{
objSpaceStations = utils.addElement(objSpaceStations, objStation);
}
}
utils.setScriptVar(objManager, "objSpaceStations", objSpaceStations);
}