mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
172 lines
5.8 KiB
Plaintext
172 lines
5.8 KiB
Plaintext
include library.camping;
|
|
include library.create;
|
|
include library.factions;
|
|
include library.gcw;
|
|
include library.theater;
|
|
include library.trial;
|
|
include library.utils;
|
|
|
|
trigger OnInitialize()
|
|
{
|
|
messageTo(self, "initializeAdvancedCamp", null, 30.0f, false); //It has to be late, after all the other children spawn via the camp
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler initializeAdvancedCamp()
|
|
{
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp");
|
|
|
|
if(!hasObjVar(self, "factionFlag"))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
int factionFlag = getIntObjVar(self, "factionFlag");
|
|
if(factionFlag < 0)
|
|
return SCRIPT_CONTINUE;
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp factionFlag: "+ factionFlag);
|
|
|
|
int numNodes = camping.getAdvancedCampNumberOfNodes(self);
|
|
if(numNodes > 6)
|
|
numNodes = 6;
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - numNodes: "+numNodes);
|
|
|
|
obj_id[] nodeObjects = new obj_id[numNodes];
|
|
int arrayIdx = 0;
|
|
|
|
obj_var_list ovl = getObjVarList(self, "modules");
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - obj_var_list: "+ovl);
|
|
|
|
if(ovl == null)
|
|
{
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - ovl == null");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - ovl not null");
|
|
|
|
string[] modules = ovl.getAllObjVarNames();
|
|
if(modules == null || modules.length <= 0)
|
|
{
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - modules == null");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
int nodeCount = 1;
|
|
int i = 0;
|
|
int recruitersPlaced = 0;
|
|
|
|
while(nodeCount <= numNodes && i < modules.length)
|
|
{
|
|
if(modules[i] == null || modules[i].equals(""))
|
|
{
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - modules == null");
|
|
continue;
|
|
}
|
|
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - modules[i]: "+modules[i]);
|
|
|
|
location tempLoc = getLocation(self);
|
|
location nodeLoc = camping.getAdvancedCampNodeLocation(self, tempLoc, nodeCount);
|
|
int nodeYaw = camping.getAdvancedCampNodeYaw(self, nodeCount);
|
|
|
|
string module_template = "";
|
|
|
|
if(modules[i].equals("shuttle_beacon"))
|
|
module_template = "object/building/poi/player_camp_shuttle_beacon.iff";
|
|
else if(modules[i].equals("cloning_tube"))
|
|
module_template = "object/building/poi/player_camp_clone_tube.iff";
|
|
|
|
//Entertainment Module
|
|
else if(modules[i].equals("entertainer"))
|
|
{
|
|
if(factionFlag == factions.FACTION_FLAG_REBEL)
|
|
{
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - Entertainment Camp is FACTION_FLAG_REBEL");
|
|
module_template = "object/building/poi/gcw_camp_entertainment_rebel.iff";
|
|
}
|
|
else if(factionFlag == factions.FACTION_FLAG_IMPERIAL)
|
|
{
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - Entertainment Camp is FACTION_FLAG_IMPERIAL");
|
|
module_template = "object/building/poi/gcw_camp_entertainment_imperial.iff";
|
|
}
|
|
else
|
|
{
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - Entertainment Camp is FACTION_FLAG_UNKNOWN");
|
|
module_template = "object/building/poi/player_camp_entertainment_area.iff";
|
|
}
|
|
}
|
|
|
|
//Junk Dealer
|
|
else if(modules[i].equals("junk_dealer"))
|
|
{
|
|
if(factionFlag == factions.FACTION_FLAG_REBEL)
|
|
{
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - Junk Dealer is FACTION_FLAG_REBEL");
|
|
module_template = "object/building/poi/gcw_camp_junk_dealer_rebel.iff";
|
|
}
|
|
else if(factionFlag == factions.FACTION_FLAG_IMPERIAL)
|
|
{
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - Junk Dealer is FACTION_FLAG_IMPERIAL");
|
|
module_template = "object/building/poi/gcw_camp_junk_dealer_imperial.iff";
|
|
}
|
|
else
|
|
{
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - Junk Dealer is FACTION_FLAG_UNKNOWN");
|
|
module_template = "object/building/poi/player_camp_junk_dealer.iff";
|
|
}
|
|
}
|
|
|
|
else if(modules[i].equals("imperial"))
|
|
module_template = "object/building/poi/gcw_camp_imperial_recruiter.iff";
|
|
else if(modules[i].equals("rebel"))
|
|
module_template = "object/building/poi/gcw_camp_rebel_recruiter.iff";
|
|
else if(modules[i].equals("rebel_clone"))
|
|
module_template = "object/building/poi/gcw_rebel_clone_tent_small.iff";
|
|
else if(modules[i].equals("imperial_clone"))
|
|
module_template = "object/building/poi/gcw_imperial_clone_tent_small.iff";
|
|
|
|
//Crafting
|
|
else if(modules[i].equals("clothing_station"))
|
|
module_template = "object/building/poi/player_camp_crafting_clothing.iff";
|
|
else if(modules[i].equals("food_station"))
|
|
module_template = "object/building/poi/player_camp_crafting_food.iff";
|
|
else if(modules[i].equals("ship_station"))
|
|
module_template = "object/building/poi/player_camp_crafting_space.iff";
|
|
else if(modules[i].equals("structure_station"))
|
|
module_template = "object/building/poi/player_camp_crafting_structure.iff";
|
|
else if(modules[i].equals("weapon_station"))
|
|
module_template = "object/building/poi/player_camp_crafting_weapon.iff";
|
|
|
|
if(!module_template.equals(""))
|
|
{
|
|
obj_id module_id = create.object(module_template, nodeLoc);
|
|
if (camping.isRecruiterModule(module_template))
|
|
{
|
|
recruitersPlaced = recruitersPlaced +1;
|
|
}
|
|
if(isIdValid(module_id))
|
|
{
|
|
setYaw(module_id, nodeYaw);
|
|
nodeObjects[arrayIdx] = module_id;
|
|
arrayIdx++;
|
|
nodeCount++;
|
|
}
|
|
}
|
|
|
|
i++;
|
|
}
|
|
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - Setting Vars!!");
|
|
|
|
setObjVar(self, "modules.ids", nodeObjects);
|
|
setObjVar(self, camping.VAR_CREATION_TIME, getCalendarTime());
|
|
|
|
//The modules need to be addded to the child list so that they clean up when the camp is cleaned up
|
|
resizeable obj_id[] children = getResizeableObjIdArrayObjVar(self, theater.VAR_CHILDREN);
|
|
LOG("gcw_camp_functionality", "initializeAdvancedCamp - children.length: "+children.length);
|
|
for(int b = 0; b < nodeObjects.length; b++)
|
|
{
|
|
children = utils.addElement(children, nodeObjects[b]);
|
|
}
|
|
|
|
setObjVar(self, theater.VAR_CHILDREN, children);
|
|
return SCRIPT_CONTINUE;
|
|
}
|