Added Overhead air Traffic to Major Starports

commit b0dc6c97e04780ec8b2448fb7ead1ffa77899fa4
Merge: a90ca60cd 7d60e3304
Author: CekisSWG <cekisswg@gmail.com>
Date:   Tue Nov 26 16:06:08 2019 -0800

    Merge branch 'master' into traffic

commit a90ca60cd6499b3d17707c13bd1aed5a4e46c2f3
Author: Cekis <cekisswg@gmail.com>
Date:   Mon Nov 11 17:59:56 2019 -0500

    Added overhead traffic to large starports on Naboo, Corellia and Tatooine
This commit is contained in:
CekisSWG
2019-11-26 16:06:58 -08:00
parent 7d60e3304f
commit 4443afc9dc
4 changed files with 43 additions and 5 deletions

View File

@@ -20,6 +20,7 @@
@class object_template 1
scripts = +["city.ship_spawner"]
sharedTemplate = "object/building/corellia/shared_starport_corellia.iff"

View File

@@ -20,6 +20,7 @@
@class object_template 1
scripts = +["city.ship_spawner"]
sharedTemplate = "object/building/naboo/shared_starport_naboo.iff"

View File

@@ -20,6 +20,7 @@
@class object_template 1
scripts = +["city.ship_spawner"]
sharedTemplate = "object/building/tatooine/shared_starport_tatooine.iff"

View File

@@ -1,6 +1,7 @@
package script.city;
import script.location;
import script.dictionary;
import script.library.gcw;
import script.obj_id;
public class ship_spawner extends script.base_script
@@ -8,10 +9,44 @@ public class ship_spawner extends script.base_script
public ship_spawner()
{
}
public int OnInitialize(obj_id self) throws InterruptedException
{
location here = getLocation(self);
obj_id npc = createObject("object/static/structure/general/distant_ship_controller2.iff", here);
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;
}
}