Files
dsrc/sku.0/sys.server/compiled/game/script/systems/battlefield/battlefield_object.java
T
TekaohandGitHub 5c2e112349 Java 11.0.2 migration (#32)
* Code compiles - execution NOT tested

* updating gitignore

* Removed intellij settings files

* Removed more intellij files

* Added exclusion for JDK classes.

* Fixed purchasing script for vendors that have listed coin types.

* Updated script to not kick off until the entire preload is complete.

* adds static name entry for Solo movie poster and tcg9 vendor entry

* clean up empty and orphaned object templates

* adds placeholder black market (static) spawns

* corrects entries for the video game table to correctly set it in tcg series 2 and remove series 1 console errors

* Updated gitignore and removed intellij project files

* Fixed appearance reference for thranta payroll and kashyyyk door, added skipLosCheck objvar due to cannit see issue. Requires updated src

* Fixed appearance and template for terminal (#2)

* Fixed appearance and template for terminal (#3)

* Fixed appearance and template for terminal (#4)

* Deleted another faulty/orphaned object template

* Fixed gcw ranks option on frog. Only issue is that it doesn't award the officer commands or badges.

* Fixed some unneeded java 11 changes
2019-04-18 18:31:52 -05:00

88 lines
3.3 KiB
Java
Executable File

package script.systems.battlefield;
import script.dictionary;
import script.library.battlefield;
import script.library.player_structure;
import script.obj_id;
import script.region;
public class battlefield_object extends script.base_script
{
public battlefield_object()
{
}
public int OnFollowMoving(obj_id self, obj_id target) throws InterruptedException
{
region bf = battlefield.getBattlefield(self);
if (bf == null)
{
destroyObject(self);
}
return SCRIPT_CONTINUE;
}
public int OnIncapacitated(obj_id self, obj_id killer) throws InterruptedException
{
LOG("LOG_CHANNEL", "battlefield.battlefield_object::OnIncapacitated -- " + self + " " + killer);
if (battlefield.isBattlefieldSpawned(self))
{
region bf = battlefield.getBattlefield(self);
obj_id master_object = battlefield.getMasterObjectFromRegion(bf);
battlefield.registerBattlefieldKill(killer, self, master_object);
}
return SCRIPT_CONTINUE;
}
public int OnDestroy(obj_id self) throws InterruptedException
{
if (battlefield.isBattlefieldSpawned(self))
{
obj_id master_object = getObjIdObjVar(self, battlefield.VAR_SPAWNED_BATTLEFIELD);
if (master_object == null)
{
LOG("LOG_CHANNEL", "battlefield.battlefield_object::OnDestroy (" + self + ") -- Battlefield object is null.");
return SCRIPT_CONTINUE;
}
if (battlefield.isBattlefieldActive(master_object))
{
obj_id spawner = getObjIdObjVar(self, battlefield.VAR_SPAWNED_BY);
if (spawner == null)
{
LOG("LOG_CHANNEL", "battlefield.battlefield_object::OnDestroy (" + self + ") -- Spawned_by is null.");
}
else
{
if (spawner.isLoaded())
{
if (hasObjVar(spawner, battlefield.VAR_SPAWNER_CURRENT_POPULATION))
{
int population = getIntObjVar(spawner, battlefield.VAR_SPAWNER_CURRENT_POPULATION);
setObjVar(spawner, battlefield.VAR_SPAWNER_CURRENT_POPULATION, population - 1);
LOG("LOG_CHANNEL", "population ->" + population);
}
}
else
{
LOG("LOG_CHANNEL", "battlefield.battlefield_object::OnDestroy -- spawner " + spawner + " is not loaded.");
}
}
battlefield.removeFromBattlefieldObjectList(master_object, self);
}
}
return SCRIPT_CONTINUE;
}
public int msgDestroyBattlefieldObject(obj_id self, dictionary params) throws InterruptedException
{
if (player_structure.isBuilding(self))
{
obj_id[] players = player_structure.getPlayersInBuilding(self);
if (players != null)
{
for (obj_id player : players) {
expelFromBuilding(player);
}
}
}
destroyObject(self);
return SCRIPT_CONTINUE;
}
}