Files
dsrc/sku.0/sys.server/compiled/game/script/theme_park/destructible.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

132 lines
4.8 KiB
Java
Executable File

package script.theme_park;
import script.dictionary;
import script.library.ai_lib;
import script.library.beast_lib;
import script.library.factions;
import script.library.trial;
import script.location;
import script.obj_id;
public class destructible extends script.base_script
{
public destructible()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
int hp = hasObjVar(self, "hp") ? getIntObjVar(self, "hp") : 5000;
setMaxHitpoints(self, hp);
setHitpoints(self, hp);
String attract = hasObjVar(self, "attraction") ? getStringObjVar(self, "attraction") : "none";
int attractRange = hasObjVar(self, "attraction_range") ? getIntObjVar(self, "attraction_range") : 20;
if (!attract.equals("none"))
{
trial.setInterest(self);
setTriggerVolume(self, attract, attractRange);
}
int ignore_player = hasObjVar(self, "ignore_player") ? getIntObjVar(self, "ignore_player") : 0;
if (ignore_player == 1)
{
factions.setIgnorePlayer(self);
}
return SCRIPT_CONTINUE;
}
public int OnObjectDisabled(obj_id self, obj_id killer) throws InterruptedException
{
location death = getLocation(self);
String effect = "clienteffect/combat_explosion_lair_large.cef";
if (hasObjVar(self, "deathEffect"))
{
effect = getStringObjVar(self, "deathEffect");
}
playClientEffectObj(killer, effect, self, "");
playClientEffectLoc(killer, effect, death, 0);
setInvulnerable(self, true);
messageTo(self, "destroyDisabledLair", null, 0.5f, false);
obj_id[] enemies = getWhoIsTargetingMe(self);
if (enemies != null && enemies.length > 1)
{
for (obj_id enemy : enemies) {
if (isPlayer(enemy)) {
}
}
}
return SCRIPT_CONTINUE;
}
public int OnTriggerVolumeEntered(obj_id self, String volumeName, obj_id breacher) throws InterruptedException
{
if (!ai_lib.isMob(breacher) || beast_lib.isBeast(breacher))
{
return SCRIPT_CONTINUE;
}
String attraction_name = getStringObjVar(self, "attraction");
String social = ai_lib.getSocialGroup(breacher);
if (volumeName.equals(attraction_name))
{
if (social != null && !social.equals("") && social.equals(attraction_name))
{
startCombat(breacher, self);
}
}
return SCRIPT_CONTINUE;
}
public void setTriggerVolume(obj_id self, String vol_name, int vol_range) throws InterruptedException
{
createTriggerVolume(vol_name, vol_range, true);
}
public int destroyDisabledLair(obj_id self, dictionary params) throws InterruptedException
{
destroyObject(self);
return SCRIPT_CONTINUE;
}
public int OnObjectDamaged(obj_id self, obj_id attacker, obj_id weapon, int damage) throws InterruptedException
{
int curHP = getHitpoints(self);
int maxHP = getMaxHitpoints(self);
int smolder = (maxHP - (maxHP / 3));
int fire = (maxHP / 3);
if (!hasObjVar(self, "playingEffect"))
{
if (curHP < smolder)
{
if (curHP < fire)
{
location death = getLocation(self);
setObjVar(self, "playingEffect", 1);
messageTo(self, "effectManager", null, 15, true);
}
else
{
location death = getLocation(self);
setObjVar(self, "playingEffect", 1);
messageTo(self, "effectManager", null, 15, true);
}
}
}
return SCRIPT_CONTINUE;
}
public int effectManager(obj_id self, dictionary params) throws InterruptedException
{
removeObjVar(self, "playingEffect");
return SCRIPT_CONTINUE;
}
public void reportDeath(obj_id self, obj_id killer) throws InterruptedException
{
int row = getIntObjVar(self, "row");
String spawn_id = "none";
if (hasObjVar(self, "spawn_id"))
{
spawn_id = getStringObjVar(self, "spawn_id");
}
int respawn = getIntObjVar(self, "respawn");
dictionary dict = trial.getSessionDict(trial.getParent(self));
dict.put("object", self);
dict.put("row", row);
dict.put("spawn_id", spawn_id);
dict.put("respawn", respawn);
dict.put("killer", killer);
messageTo(trial.getParent(self), "terminationCallback", dict, 0.0f, false);
}
}