mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
commit b0dc6c97e04780ec8b2448fb7ead1ffa77899fa4
Merge: a90ca60cd 7d60e3304
Author: CekisSWG <[email protected]>
Date: Tue Nov 26 16:06:08 2019 -0800
Merge branch 'master' into traffic
commit a90ca60cd6499b3d17707c13bd1aed5a4e46c2f3
Author: Cekis <[email protected]>
Date: Mon Nov 11 17:59:56 2019 -0500
Added overhead traffic to large starports on Naboo, Corellia and Tatooine
53 lines
1.9 KiB
Java
Executable File
53 lines
1.9 KiB
Java
Executable File
package script.city;
|
|
|
|
import script.dictionary;
|
|
import script.library.gcw;
|
|
import script.obj_id;
|
|
|
|
public class ship_spawner extends script.base_script
|
|
{
|
|
public ship_spawner()
|
|
{
|
|
}
|
|
|
|
public int OnInitialize(obj_id self) throws InterruptedException {
|
|
messageTo(self, "evaluateSpawn", null, 0.0f, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
public int evaluateSpawn(obj_id self, dictionary params) throws InterruptedException{
|
|
// get the current imperial GCW score for the location.
|
|
int impScore = gcw.getGcwImperialScorePercentile(gcw.getGcwRegion(self));
|
|
|
|
String template = "object/static/structure/general/distant_ship_controller2.iff";
|
|
if(impScore < 50) {
|
|
template = "object/static/structure/general/distant_ship_controller_rebel.iff";
|
|
} else if(impScore > 50){
|
|
template = "object/static/structure/general/distant_ship_controller_imperial.iff";
|
|
}
|
|
|
|
if(null != params) {
|
|
obj_id controller = params.getObjId("currentController");
|
|
String currentTemplate = getTemplateName(controller);
|
|
if (currentTemplate != null && currentTemplate.equals(template)) {
|
|
messageTo(self, "evaluateSpawn", params, 60.0f, false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
// our template is different, let's get rid of the old one before we create a new one.
|
|
destroyObject(params.getObjId("currentController"));
|
|
} else {
|
|
params = new dictionary();
|
|
}
|
|
|
|
obj_id controller = createObject(template, getLocation(self));
|
|
|
|
params.put("currentController", controller);
|
|
params.put("lastImperialScore", impScore);
|
|
|
|
// check the spawn point again in 60 seconds.
|
|
messageTo(self, "evaluateSpawn", params, 60.0f, false);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|