diff --git a/scripts/commands/dismount.py b/scripts/commands/dismount.py index df9f2733..08aeba54 100644 --- a/scripts/commands/dismount.py +++ b/scripts/commands/dismount.py @@ -4,13 +4,15 @@ def setup(): return def run(core, actor, target, commandString): - if actor.canMount(target) is False: return - - if not actor.isMounted(): - actor.setMounted(1) - target.initMount(actor) - else: - target.unmount(actor) + if not target: + return + + if actor.getObjectID() != target.getOwnerId(): + return + + + if core.mountService.isMounted(actor) is True: + core.mountService.dismount(actor, target) return diff --git a/scripts/commands/mount.py b/scripts/commands/mount.py index 14a0f3e4..40b6e080 100644 --- a/scripts/commands/mount.py +++ b/scripts/commands/mount.py @@ -4,13 +4,13 @@ def setup(): return def run(core, actor, target, commandString): - if actor.canMount(target) is False: return - - if not actor.isMounted(): - actor.setMounted(1) - target.initMount(actor) - else: - target.unmount(actor) - + if not target: + return + + if actor.getObjectID() != target.getOwnerId(): + return + + if core.mountService.isMounted(actor) is False: + core.mountService.mount(actor, target) + return - diff --git a/scripts/object/building/player/player_house_generic_small_style_01.py b/scripts/object/building/player/player_house_generic_small_style_01.py index 6e0ae61d..aa9723bd 100644 --- a/scripts/object/building/player/player_house_generic_small_style_01.py +++ b/scripts/object/building/player/player_house_generic_small_style_01.py @@ -6,6 +6,6 @@ def setup(core, object): object.setAttachment("structureSign", sign) structureterminal = core.objectService.createChildObject(object, 'object/tangible/terminal/shared_terminal_player_structure.iff', -5, 0.74, -1.81, 0.707107, -0.707107, 1) - #structureterminal.setAttachment('radial_filename', 'structure_management_terminal') + #structureterminal.setAttachment('radial_filename', 'structure/structure_management_terminal') structureterminal.setAttachment('housing_parentstruct', object) return \ No newline at end of file diff --git a/scripts/object/creature/player/bothan_female.py b/scripts/object/creature/player/bothan_female.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/bothan_female.py +++ b/scripts/object/creature/player/bothan_female.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/bothan_male.py b/scripts/object/creature/player/bothan_male.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/bothan_male.py +++ b/scripts/object/creature/player/bothan_male.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/human_female.py b/scripts/object/creature/player/human_female.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/human_female.py +++ b/scripts/object/creature/player/human_female.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/human_male.py b/scripts/object/creature/player/human_male.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/human_male.py +++ b/scripts/object/creature/player/human_male.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/ithorian_female.py b/scripts/object/creature/player/ithorian_female.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/ithorian_female.py +++ b/scripts/object/creature/player/ithorian_female.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/ithorian_male.py b/scripts/object/creature/player/ithorian_male.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/ithorian_male.py +++ b/scripts/object/creature/player/ithorian_male.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/moncal_female.py b/scripts/object/creature/player/moncal_female.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/moncal_female.py +++ b/scripts/object/creature/player/moncal_female.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/moncal_male.py b/scripts/object/creature/player/moncal_male.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/moncal_male.py +++ b/scripts/object/creature/player/moncal_male.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/rodian_female.py b/scripts/object/creature/player/rodian_female.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/rodian_female.py +++ b/scripts/object/creature/player/rodian_female.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/rodian_male.py b/scripts/object/creature/player/rodian_male.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/rodian_male.py +++ b/scripts/object/creature/player/rodian_male.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/sullustan_female.py b/scripts/object/creature/player/sullustan_female.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/sullustan_female.py +++ b/scripts/object/creature/player/sullustan_female.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/sullustan_male.py b/scripts/object/creature/player/sullustan_male.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/sullustan_male.py +++ b/scripts/object/creature/player/sullustan_male.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/trandoshan_female.py b/scripts/object/creature/player/trandoshan_female.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/trandoshan_female.py +++ b/scripts/object/creature/player/trandoshan_female.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/trandoshan_male.py b/scripts/object/creature/player/trandoshan_male.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/trandoshan_male.py +++ b/scripts/object/creature/player/trandoshan_male.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/twilek_female.py b/scripts/object/creature/player/twilek_female.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/twilek_female.py +++ b/scripts/object/creature/player/twilek_female.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/twilek_male.py b/scripts/object/creature/player/twilek_male.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/twilek_male.py +++ b/scripts/object/creature/player/twilek_male.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/wookiee_female.py b/scripts/object/creature/player/wookiee_female.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/wookiee_female.py +++ b/scripts/object/creature/player/wookiee_female.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/wookiee_male.py b/scripts/object/creature/player/wookiee_male.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/wookiee_male.py +++ b/scripts/object/creature/player/wookiee_male.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/zabrak_female.py b/scripts/object/creature/player/zabrak_female.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/zabrak_female.py +++ b/scripts/object/creature/player/zabrak_female.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/creature/player/zabrak_male.py b/scripts/object/creature/player/zabrak_male.py index b80d569c..a77a99e7 100644 --- a/scripts/object/creature/player/zabrak_male.py +++ b/scripts/object/creature/player/zabrak_male.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'player') + object.setAttachment('radial_filename', 'creature/player') return \ No newline at end of file diff --git a/scripts/object/installation/generators/power_generator_fusion_style_1.py b/scripts/object/installation/generators/power_generator_fusion_style_1.py index be7d0439..3b0b69aa 100644 --- a/scripts/object/installation/generators/power_generator_fusion_style_1.py +++ b/scripts/object/installation/generators/power_generator_fusion_style_1.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'generator') + object.setAttachment('radial_filename', 'structure/generator') object.setHarvester_type(5) object.setMaintenanceCost(30) object.setGenerator(1) diff --git a/scripts/object/installation/generators/power_generator_geothermal_style_1.py b/scripts/object/installation/generators/power_generator_geothermal_style_1.py index be7d0439..3b0b69aa 100644 --- a/scripts/object/installation/generators/power_generator_geothermal_style_1.py +++ b/scripts/object/installation/generators/power_generator_geothermal_style_1.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'generator') + object.setAttachment('radial_filename', 'structure/generator') object.setHarvester_type(5) object.setMaintenanceCost(30) object.setGenerator(1) diff --git a/scripts/object/installation/generators/power_generator_photo_bio_style_1.py b/scripts/object/installation/generators/power_generator_photo_bio_style_1.py index be7d0439..3b0b69aa 100644 --- a/scripts/object/installation/generators/power_generator_photo_bio_style_1.py +++ b/scripts/object/installation/generators/power_generator_photo_bio_style_1.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'generator') + object.setAttachment('radial_filename', 'structure/generator') object.setHarvester_type(5) object.setMaintenanceCost(30) object.setGenerator(1) diff --git a/scripts/object/installation/generators/power_generator_solar_style_1.py b/scripts/object/installation/generators/power_generator_solar_style_1.py index be7d0439..3b0b69aa 100644 --- a/scripts/object/installation/generators/power_generator_solar_style_1.py +++ b/scripts/object/installation/generators/power_generator_solar_style_1.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'generator') + object.setAttachment('radial_filename', 'structure/generator') object.setHarvester_type(5) object.setMaintenanceCost(30) object.setGenerator(1) diff --git a/scripts/object/installation/generators/power_generator_wind_style_1.py b/scripts/object/installation/generators/power_generator_wind_style_1.py index b82445bb..0c7bc05c 100644 --- a/scripts/object/installation/generators/power_generator_wind_style_1.py +++ b/scripts/object/installation/generators/power_generator_wind_style_1.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'generator') + object.setAttachment('radial_filename', 'structure/generator') object.setHarvester_type(5) object.setMaintenanceCost(20) object.setGenerator(1) diff --git a/scripts/object/installation/mining_gas/mining_gas_harvester_style_1.py b/scripts/object/installation/mining_gas/mining_gas_harvester_style_1.py index e90b9514..6b49d930 100644 --- a/scripts/object/installation/mining_gas/mining_gas_harvester_style_1.py +++ b/scripts/object/installation/mining_gas/mining_gas_harvester_style_1.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(3) object.setPowerCost(25); object.setMaintenanceCost(16); diff --git a/scripts/object/installation/mining_gas/mining_gas_harvester_style_2.py b/scripts/object/installation/mining_gas/mining_gas_harvester_style_2.py index f90bf1bf..7a6f2b77 100644 --- a/scripts/object/installation/mining_gas/mining_gas_harvester_style_2.py +++ b/scripts/object/installation/mining_gas/mining_gas_harvester_style_2.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(3) object.setPowerCost(60); object.setMaintenanceCost(60); diff --git a/scripts/object/installation/mining_gas/mining_gas_harvester_style_3.py b/scripts/object/installation/mining_gas/mining_gas_harvester_style_3.py index 5b0bb40b..36a2c41e 100644 --- a/scripts/object/installation/mining_gas/mining_gas_harvester_style_3.py +++ b/scripts/object/installation/mining_gas/mining_gas_harvester_style_3.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(3) object.setPowerCost(75); object.setMaintenanceCost(90); diff --git a/scripts/object/installation/mining_gas/mining_gas_harvester_style_4.py b/scripts/object/installation/mining_gas/mining_gas_harvester_style_4.py index 145b1356..93f4bfec 100644 --- a/scripts/object/installation/mining_gas/mining_gas_harvester_style_4.py +++ b/scripts/object/installation/mining_gas/mining_gas_harvester_style_4.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(3) object.setPowerCost(100); object.setMaintenanceCost(120); diff --git a/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_1.py b/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_1.py index 25f6673f..f8ad23ca 100644 --- a/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_1.py +++ b/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_1.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(1) object.setPowerCost(25); object.setMaintenanceCost(16); diff --git a/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_2.py b/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_2.py index 1fc10f74..346183c1 100644 --- a/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_2.py +++ b/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_2.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(1) object.setPowerCost(60); object.setMaintenanceCost(60); diff --git a/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_3.py b/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_3.py index dab15cfd..c1ad33db 100644 --- a/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_3.py +++ b/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_3.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(1) object.setPowerCost(75); object.setMaintenanceCost(90); diff --git a/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_4.py b/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_4.py index b848b851..a394e5ce 100644 --- a/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_4.py +++ b/scripts/object/installation/mining_liquid/mining_liquid_harvester_style_4.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(1) object.setPowerCost(100); object.setMaintenanceCost(120); diff --git a/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester.py b/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester.py index 3e112037..3905b4c0 100644 --- a/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester.py +++ b/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(4) object.setPowerCost(25); object.setMaintenanceCost(16); diff --git a/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_elite.py b/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_elite.py index 7577292f..ae69d03d 100644 --- a/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_elite.py +++ b/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_elite.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(4) object.setPowerCost(100); object.setMaintenanceCost(120); diff --git a/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_heavy.py b/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_heavy.py index 1fcc5436..499bd036 100644 --- a/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_heavy.py +++ b/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_heavy.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(4) object.setPowerCost(75); object.setMaintenanceCost(90); diff --git a/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_medium.py b/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_medium.py index 41919756..4962e477 100644 --- a/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_medium.py +++ b/scripts/object/installation/mining_liquid/mining_liquid_moisture_harvester_medium.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(4) object.setPowerCost(60); object.setMaintenanceCost(60); diff --git a/scripts/object/installation/mining_ore/mining_ore_harvester_elite.py b/scripts/object/installation/mining_ore/mining_ore_harvester_elite.py index 05c3be8a..daafe847 100644 --- a/scripts/object/installation/mining_ore/mining_ore_harvester_elite.py +++ b/scripts/object/installation/mining_ore/mining_ore_harvester_elite.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(0) object.setPowerCost(100); object.setMaintenanceCost(120); diff --git a/scripts/object/installation/mining_ore/mining_ore_harvester_heavy.py b/scripts/object/installation/mining_ore/mining_ore_harvester_heavy.py index 5dfeb966..02cad7c2 100644 --- a/scripts/object/installation/mining_ore/mining_ore_harvester_heavy.py +++ b/scripts/object/installation/mining_ore/mining_ore_harvester_heavy.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(0) object.setPowerCost(75); object.setMaintenanceCost(90); diff --git a/scripts/object/installation/mining_ore/mining_ore_harvester_style_1.py b/scripts/object/installation/mining_ore/mining_ore_harvester_style_1.py index 2973a685..7a6fdae5 100644 --- a/scripts/object/installation/mining_ore/mining_ore_harvester_style_1.py +++ b/scripts/object/installation/mining_ore/mining_ore_harvester_style_1.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(0) object.setPowerCost(25); object.setMaintenanceCost(16); diff --git a/scripts/object/installation/mining_ore/mining_ore_harvester_style_2.py b/scripts/object/installation/mining_ore/mining_ore_harvester_style_2.py index e6cfc1b1..76358940 100644 --- a/scripts/object/installation/mining_ore/mining_ore_harvester_style_2.py +++ b/scripts/object/installation/mining_ore/mining_ore_harvester_style_2.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(0) object.setPowerCost(60); object.setMaintenanceCost(60); diff --git a/scripts/object/installation/mining_organic/mining_organic_flora_farm.py b/scripts/object/installation/mining_organic/mining_organic_flora_farm.py index ace61f59..714ccd97 100644 --- a/scripts/object/installation/mining_organic/mining_organic_flora_farm.py +++ b/scripts/object/installation/mining_organic/mining_organic_flora_farm.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(2) object.setPowerCost(25); object.setMaintenanceCost(16); diff --git a/scripts/object/installation/mining_organic/mining_organic_flora_farm_elite.py b/scripts/object/installation/mining_organic/mining_organic_flora_farm_elite.py index 53ef7fa9..71580f57 100644 --- a/scripts/object/installation/mining_organic/mining_organic_flora_farm_elite.py +++ b/scripts/object/installation/mining_organic/mining_organic_flora_farm_elite.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(2) object.setPowerCost(100); object.setMaintenanceCost(120); diff --git a/scripts/object/installation/mining_organic/mining_organic_flora_farm_heavy.py b/scripts/object/installation/mining_organic/mining_organic_flora_farm_heavy.py index 08daa7ee..dbd32ee3 100644 --- a/scripts/object/installation/mining_organic/mining_organic_flora_farm_heavy.py +++ b/scripts/object/installation/mining_organic/mining_organic_flora_farm_heavy.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(2) object.setPowerCost(60); object.setMaintenanceCost(60); diff --git a/scripts/object/installation/mining_organic/mining_organic_flora_farm_medium.py b/scripts/object/installation/mining_organic/mining_organic_flora_farm_medium.py index 08daa7ee..dbd32ee3 100644 --- a/scripts/object/installation/mining_organic/mining_organic_flora_farm_medium.py +++ b/scripts/object/installation/mining_organic/mining_organic_flora_farm_medium.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvester') + object.setAttachment('radial_filename', 'structure/harvester') object.setHarvester_type(2) object.setPowerCost(60); object.setMaintenanceCost(60); diff --git a/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py b/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py index ace4cdfc..d7c3f4a1 100644 --- a/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py +++ b/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py @@ -1,15 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'vehicle_pcd') - return - -def use(core, actor, object): - if object and actor.getAttachment('activeVehicleID') == None: - swoop = core.objectService.createObject('object/mobile/vehicle/shared_speederbike_swoop.iff', 0, actor.getPlanet(), actor.getPosition(), actor.getOrientation()) - - swoop.setOwnerId(actor.getObjectID()) - actor.setAttachment('activeVehicleID', swoop.getObjectID()) - - core.simulationService.add(swoop, swoop.getPosition().x, swoop.getPosition().z, True) + object.setAttachment('radial_filename', 'datapad/vehicle_pcd') return \ No newline at end of file diff --git a/scripts/object/mobile/respec_seller_f_1.py b/scripts/object/mobile/respec_seller_f_1.py index fce43dfc..c7327815 100644 --- a/scripts/object/mobile/respec_seller_f_1.py +++ b/scripts/object/mobile/respec_seller_f_1.py @@ -2,6 +2,6 @@ import sys from resources.datatables import Options def setup(core, object): - object.setAttachment('radial_filename', 'conversation') + object.setAttachment('radial_filename', 'object/conversation') object.setAttachment('conversationFile', 'respec') return \ No newline at end of file diff --git a/scripts/object/mobile/vehicle/speederbike_swoop.py b/scripts/object/mobile/vehicle/speederbike_swoop.py index 4626c764..0f6896cd 100644 --- a/scripts/object/mobile/vehicle/speederbike_swoop.py +++ b/scripts/object/mobile/vehicle/speederbike_swoop.py @@ -1,16 +1,6 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'vehicle') - return - -def use(core, actor, object): - vehicle = actor.getContainer() - - if vehicle: - if vehicle.getObjectID() == object.getObjectID(): - vehicle.remove(actor) - else: - vehicle.add(actor) - + object.setAttachment('radial_filename', 'creature/vehicle') + object.setAttachment('passengers', 0) return \ No newline at end of file diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed.py b/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed.py index d6d7b4a8..bc69c878 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_1.iff') object.setStructureTemplate('object/installation/mining_organic/shared_mining_organic_flora_farm.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_elite.py b/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_elite.py index 66784568..3bda16b3 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_elite.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_elite.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_heavy.iff') object.setStructureTemplate('object/installation/mining_organic/shared_mining_organic_flora_farm_elite.iff') object.setLotRequirement(3) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_heavy.py b/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_heavy.py index 097a35ea..419f60f5 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_heavy.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_heavy.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_heavy.iff') object.setStructureTemplate('object/installation/mining_organic/shared_mining_organic_flora_farm_heavy.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_medium.py b/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_medium.py index 70ea50f2..9eb27e8b 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_medium.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_flora_deed_medium.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_2.iff') object.setStructureTemplate('object/installation/mining_organic/shared_mining_organic_flora_farm_medium.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed.py b/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed.py index a11974a2..5a4a2404 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_1.iff') object.setStructureTemplate('object/installation/mining_gas/shared_mining_gas_harvester_style_1.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_elite.py b/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_elite.py index 814daa8a..f560acdf 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_elite.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_elite.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_heavy.iff') object.setStructureTemplate('object/installation/mining_gas/shared_mining_gas_harvester_style_4.iff') object.setLotRequirement(3) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_heavy.py b/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_heavy.py index 2111f7bf..c9bbd64b 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_heavy.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_heavy.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_heavy.iff') object.setStructureTemplate('object/installation/mining_gas/shared_mining_gas_harvester_style_3.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_medium.py b/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_medium.py index 401da10e..10a7007a 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_medium.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_gas_deed_medium.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_2.iff') object.setStructureTemplate('object/installation/mining_gas/shared_mining_gas_harvester_style_2.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed.py b/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed.py index 9bce9e66..b0455145 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_1.iff') object.setStructureTemplate('object/installation/mining_liquid/shared_mining_liquid_harvester_style_1.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_elite.py b/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_elite.py index 15cbfa5d..723f3eab 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_elite.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_elite.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_heavy.iff') object.setStructureTemplate('object/installation/mining_liquid/shared_mining_liquid_harvester_style_4.iff') object.setLotRequirement(3) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_heavy.py b/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_heavy.py index ae4c3c71..773e722d 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_heavy.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_heavy.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_heavy.iff') object.setStructureTemplate('object/installation/mining_liquid/shared_mining_liquid_harvester_style_3.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_medium.py b/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_medium.py index 4de7136b..1f40b563 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_medium.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_liquid_deed_medium.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_2.iff') object.setStructureTemplate('object/installation/mining_liquid/shared_mining_liquid_harvester_style_2.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed.py b/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed.py index 6540aa1d..0241a524 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_1.iff') object.setStructureTemplate('object/installation/mining_liquid/shared_mining_liquid_moisture_harvester.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_elite.py b/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_elite.py index 21dc0cfc..e008e004 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_elite.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_elite.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_heavy.iff') object.setStructureTemplate('object/installation/mining_liquid/shared_mining_liquid_moisture_harvester_elite.iff') object.setLotRequirement(3) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_heavy.py b/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_heavy.py index afeb3a4b..e9206a11 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_heavy.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_heavy.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_heavy.iff') object.setStructureTemplate('object/installation/mining_liquid/shared_mining_liquid_moisture_harvester_heavy.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_medium.py b/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_medium.py index 7e9a5efe..2d1b24d2 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_medium.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_moisture_deed_medium.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_2.iff') object.setStructureTemplate('object/installation/mining_liquid/shared_mining_liquid_moisture_harvester_medium.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_ore_deed_elite.py b/scripts/object/tangible/deed/harvester_deed/harvester_ore_deed_elite.py index 5e0dde67..b8f86d6e 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_ore_deed_elite.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_ore_deed_elite.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_heavy.iff') object.setStructureTemplate('object/installation/mining_ore/shared_mining_ore_harvester_elite.iff') object.setLotRequirement(3) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_ore_heavy_deed.py b/scripts/object/tangible/deed/harvester_deed/harvester_ore_heavy_deed.py index 7f765aa8..28978e9c 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_ore_heavy_deed.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_ore_heavy_deed.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_heavy.iff') object.setStructureTemplate('object/installation/mining_ore/shared_mining_ore_harvester_heavy.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_ore_s1_deed.py b/scripts/object/tangible/deed/harvester_deed/harvester_ore_s1_deed.py index d2edcd91..ca897eb7 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_ore_s1_deed.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_ore_s1_deed.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_1.iff') object.setStructureTemplate('object/installation/mining_ore/shared_mining_ore_harvester_style_1.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/harvester_deed/harvester_ore_s2_deed.py b/scripts/object/tangible/deed/harvester_deed/harvester_ore_s2_deed.py index 34c6d56c..97ca86a7 100644 --- a/scripts/object/tangible/deed/harvester_deed/harvester_ore_s2_deed.py +++ b/scripts/object/tangible/deed/harvester_deed/harvester_ore_s2_deed.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'harvesterDeed') + object.setAttachment('radial_filename', 'deeds/harvesterDeed') object.setConstructorTemplate('object/installation/mining_ore/construction/shared_construction_mining_ore_harvester_style_2.iff') object.setStructureTemplate('object/installation/mining_ore/shared_mining_ore_harvester_style_2.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/player_house_deed/generic_house_small_deed.py b/scripts/object/tangible/deed/player_house_deed/generic_house_small_deed.py index 5dbae10f..f59934aa 100644 --- a/scripts/object/tangible/deed/player_house_deed/generic_house_small_deed.py +++ b/scripts/object/tangible/deed/player_house_deed/generic_house_small_deed.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'structureDeed') + object.setAttachment('radial_filename', 'deeds/structureDeed') object.setConstructorTemplate('object/building/player/construction/shared_construction_player_house_corellia_small_style_01.iff') object.setStructureTemplate('object/tangible/deed/player_house_deed/shared_generic_house_small_deed.iff') object.setLotRequirement(1) diff --git a/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py b/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py index 4b0e320f..48f0518e 100644 --- a/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py +++ b/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py @@ -1,24 +1,9 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'vehicleDeed') + object.setAttachment('radial_filename', 'deeds/vehicleDeed') return def use(core, actor, object): - datapad = actor.getSlottedObject('datapad') - pcd = core.objectService.createObject('object/intangible/vehicle/shared_speederbike_swoop_pcd.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) - - if datapad and pcd: - - datapad.add(pcd) - core.objectService.destroyObject(object) - - vehicleId = actor.getAttachment('activeVehicleID') - - if vehicleId == None: - vehicle = core.objectService.createObject('object/mobile/vehicle/shared_speederbike_swoop.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) - vehicle.setOwnerId(actor.getObjectID()) - core.simulationService.add(vehicle, vehicle.getPosition().x, vehicle.getPosition().z, True) - actor.setAttachment('activeVehicleID', vehicle.getObjectID()) - + core.mountService.generateVehicle(actor, object, 'object/mobile/vehicle/shared_speederbike_swoop.iff', 'object/intangible/vehicle/shared_speederbike_swoop_pcd.iff') return \ No newline at end of file diff --git a/scripts/object/tangible/holiday/life_day/main_lifeday_tree.py b/scripts/object/tangible/holiday/life_day/main_lifeday_tree.py index ed6e638b..f98db1aa 100644 --- a/scripts/object/tangible/holiday/life_day/main_lifeday_tree.py +++ b/scripts/object/tangible/holiday/life_day/main_lifeday_tree.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'main_lifeday_tree') + object.setAttachment('radial_filename', 'holidays/lifeday/main_lifeday_tree') return diff --git a/scripts/object/tangible/item/rare_loot_chest_1.py b/scripts/object/tangible/item/rare_loot_chest_1.py index 33b2b963..4b7795de 100644 --- a/scripts/object/tangible/item/rare_loot_chest_1.py +++ b/scripts/object/tangible/item/rare_loot_chest_1.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'lootchest') + object.setAttachment('radial_filename', 'item/lootchest') return \ No newline at end of file diff --git a/scripts/object/tangible/item/rare_loot_chest_2.py b/scripts/object/tangible/item/rare_loot_chest_2.py index 33b2b963..4b7795de 100644 --- a/scripts/object/tangible/item/rare_loot_chest_2.py +++ b/scripts/object/tangible/item/rare_loot_chest_2.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'lootchest') + object.setAttachment('radial_filename', 'item/lootchest') return \ No newline at end of file diff --git a/scripts/object/tangible/item/rare_loot_chest_3.py b/scripts/object/tangible/item/rare_loot_chest_3.py index 33b2b963..4b7795de 100644 --- a/scripts/object/tangible/item/rare_loot_chest_3.py +++ b/scripts/object/tangible/item/rare_loot_chest_3.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'lootchest') + object.setAttachment('radial_filename', 'item/lootchest') return \ No newline at end of file diff --git a/scripts/object/tangible/loot/creature_loot/collections/item_lifeday_gift_other_01_01.py b/scripts/object/tangible/loot/creature_loot/collections/item_lifeday_gift_other_01_01.py index 3e649d7b..6f7c8887 100644 --- a/scripts/object/tangible/loot/creature_loot/collections/item_lifeday_gift_other_01_01.py +++ b/scripts/object/tangible/loot/creature_loot/collections/item_lifeday_gift_other_01_01.py @@ -6,5 +6,5 @@ def setup(core, object): object.setCustomName('Life Day Gift Box For A Friend') object.setIntAttribute('volume', 1) object.setIntAttribute('tier', 2) - object.setAttachment('radial_filename', 'lifeday_gift') + object.setAttachment('radial_filename', 'holidays/lifeday/lifeday_gift') return \ No newline at end of file diff --git a/scripts/object/tangible/loot/creature_loot/collections/item_lifeday_gift_self_01_01.py b/scripts/object/tangible/loot/creature_loot/collections/item_lifeday_gift_self_01_01.py index aef17bd8..273b89dc 100644 --- a/scripts/object/tangible/loot/creature_loot/collections/item_lifeday_gift_self_01_01.py +++ b/scripts/object/tangible/loot/creature_loot/collections/item_lifeday_gift_self_01_01.py @@ -7,5 +7,5 @@ def setup(core, object): object.setIntAttribute('volume', 1) object.setIntAttribute('no_trade', 1) object.setIntAttribute('tier', 2) - object.setAttachment('radial_filename', 'lifeday_gift') + object.setAttachment('radial_filename', 'holidays/lifeday/lifeday_gift') return \ No newline at end of file diff --git a/scripts/object/tangible/loot/generic_usable/stim_syringe_generic.py b/scripts/object/tangible/loot/generic_usable/stim_syringe_generic.py index 15085ba3..786a488c 100644 --- a/scripts/object/tangible/loot/generic_usable/stim_syringe_generic.py +++ b/scripts/object/tangible/loot/generic_usable/stim_syringe_generic.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'usable') + object.setAttachment('radial_filename', 'object/usable') return \ No newline at end of file diff --git a/scripts/object/tangible/quest/heroic/heroic_exar_kun_entrance.py b/scripts/object/tangible/quest/heroic/heroic_exar_kun_entrance.py index 79b40d1f..7ca08004 100644 --- a/scripts/object/tangible/quest/heroic/heroic_exar_kun_entrance.py +++ b/scripts/object/tangible/quest/heroic/heroic_exar_kun_entrance.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'exar_kun_brazier') + object.setAttachment('radial_filename', 'instances/exar_kun/exar_kun_brazier') return def use(core, actor, object): diff --git a/scripts/object/tangible/survey_tool/survey_tool_all.py b/scripts/object/tangible/survey_tool/survey_tool_all.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_all.py +++ b/scripts/object/tangible/survey_tool/survey_tool_all.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/survey_tool/survey_tool_gas.py b/scripts/object/tangible/survey_tool/survey_tool_gas.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_gas.py +++ b/scripts/object/tangible/survey_tool/survey_tool_gas.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/survey_tool/survey_tool_geo_thermal.py b/scripts/object/tangible/survey_tool/survey_tool_geo_thermal.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_geo_thermal.py +++ b/scripts/object/tangible/survey_tool/survey_tool_geo_thermal.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/survey_tool/survey_tool_inorganic.py b/scripts/object/tangible/survey_tool/survey_tool_inorganic.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_inorganic.py +++ b/scripts/object/tangible/survey_tool/survey_tool_inorganic.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/survey_tool/survey_tool_liquid.py b/scripts/object/tangible/survey_tool/survey_tool_liquid.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_liquid.py +++ b/scripts/object/tangible/survey_tool/survey_tool_liquid.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/survey_tool/survey_tool_lumber.py b/scripts/object/tangible/survey_tool/survey_tool_lumber.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_lumber.py +++ b/scripts/object/tangible/survey_tool/survey_tool_lumber.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/survey_tool/survey_tool_mineral.py b/scripts/object/tangible/survey_tool/survey_tool_mineral.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_mineral.py +++ b/scripts/object/tangible/survey_tool/survey_tool_mineral.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/survey_tool/survey_tool_moisture.py b/scripts/object/tangible/survey_tool/survey_tool_moisture.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_moisture.py +++ b/scripts/object/tangible/survey_tool/survey_tool_moisture.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/survey_tool/survey_tool_organic.py b/scripts/object/tangible/survey_tool/survey_tool_organic.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_organic.py +++ b/scripts/object/tangible/survey_tool/survey_tool_organic.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/survey_tool/survey_tool_solar.py b/scripts/object/tangible/survey_tool/survey_tool_solar.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_solar.py +++ b/scripts/object/tangible/survey_tool/survey_tool_solar.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/survey_tool/survey_tool_wind.py b/scripts/object/tangible/survey_tool/survey_tool_wind.py index 3e0e6490..fa89b86c 100644 --- a/scripts/object/tangible/survey_tool/survey_tool_wind.py +++ b/scripts/object/tangible/survey_tool/survey_tool_wind.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'survey_tool') + object.setAttachment('radial_filename', 'item/survey_tool') return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_character_builder.py b/scripts/object/tangible/terminal/terminal_character_builder.py index d95cbb4c..306a13df 100644 --- a/scripts/object/tangible/terminal/terminal_character_builder.py +++ b/scripts/object/tangible/terminal/terminal_character_builder.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'usable') + object.setAttachment('radial_filename', 'object/usable') return def use(core, owner, target): diff --git a/scripts/object/tangible/terminal/terminal_player_structure.py b/scripts/object/tangible/terminal/terminal_player_structure.py index 839210a3..dd5b18cd 100644 --- a/scripts/object/tangible/terminal/terminal_player_structure.py +++ b/scripts/object/tangible/terminal/terminal_player_structure.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'structure_management_terminal') + object.setAttachment('radial_filename', 'structure/structure_management_terminal') return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_player_structure_new.py b/scripts/object/tangible/terminal/terminal_player_structure_new.py index 839210a3..dd5b18cd 100644 --- a/scripts/object/tangible/terminal/terminal_player_structure_new.py +++ b/scripts/object/tangible/terminal/terminal_player_structure_new.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'structure_management_terminal') + object.setAttachment('radial_filename', 'structure/structure_management_terminal') return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_player_structure_nosnap.py b/scripts/object/tangible/terminal/terminal_player_structure_nosnap.py index 839210a3..dd5b18cd 100644 --- a/scripts/object/tangible/terminal/terminal_player_structure_nosnap.py +++ b/scripts/object/tangible/terminal/terminal_player_structure_nosnap.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'structure_management_terminal') + object.setAttachment('radial_filename', 'structure/structure_management_terminal') return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_player_structure_nosnap_mini.py b/scripts/object/tangible/terminal/terminal_player_structure_nosnap_mini.py index 839210a3..dd5b18cd 100644 --- a/scripts/object/tangible/terminal/terminal_player_structure_nosnap_mini.py +++ b/scripts/object/tangible/terminal/terminal_player_structure_nosnap_mini.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'structure_management_terminal') + object.setAttachment('radial_filename', 'structure/structure_management_terminal') return \ No newline at end of file diff --git a/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py b/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py index 77e1b16d..446e9f9f 100644 --- a/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py +++ b/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'travel_ticket') + object.setAttachment('radial_filename', 'item/travel_ticket') return \ No newline at end of file diff --git a/scripts/radial/player.py b/scripts/radial/creature/player.py similarity index 100% rename from scripts/radial/player.py rename to scripts/radial/creature/player.py diff --git a/scripts/radial/creature/vehicle.py b/scripts/radial/creature/vehicle.py new file mode 100644 index 00000000..be1e7319 --- /dev/null +++ b/scripts/radial/creature/vehicle.py @@ -0,0 +1,31 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + master = core.objectService.getObject(target.getOwnerId()) + + radials.add(RadialOptions(0, 7, 1, '')) + if core.mountService.canMount(owner, target): + radials.add(RadialOptions(1, 40, 3, '@pet/pet_menu:menu_enter_exit')) + radials.add(RadialOptions(0, 21, 1, '')) + if target.getOwnerId() == owner.getObjectID(): + radials.add(RadialOptions(0, 60, 3, '@pet/pet_menu:menu_store')) + if core.mountService.canRepair(owner, target): + radials.add(RadialOptions(0, 114, 3, '@pet/pet_menu:menu_repair_vehicle')) + return + +def handleSelection(core, owner, target, option): + mntSvc = core.mountService + + if target: + if option == 21: + if mntSvc.isMounted(actor): + mntSvc.mount(actor, target) + else: + mntSvc.unmount(actor, target) + elif option == 60: + mntSvc.store(actor, target) + elif option == 114: + mntSvc.repair(actor, target) + return + diff --git a/scripts/radial/datapad/vehicle_pcd.py b/scripts/radial/datapad/vehicle_pcd.py new file mode 100644 index 00000000..fc880185 --- /dev/null +++ b/scripts/radial/datapad/vehicle_pcd.py @@ -0,0 +1,21 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + #if not core.mountService.getMount(target): + # radials.add(RadialOptions(0, 21, 3, '@pet_menu:menu_call')) + #else: + # radials.add(RadialOptions(0, 21, 3, '@pet_menu:menu_store')) + radials.add(RadialOptions(0, 61, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + if option == 61 and target: + core.mountService.call(owner, target) + elif option == 15 and target: + core.mountService.destroy(owner, target) + + return + \ No newline at end of file diff --git a/scripts/radial/deed.py b/scripts/radial/deeds/deed.py similarity index 100% rename from scripts/radial/deed.py rename to scripts/radial/deeds/deed.py diff --git a/scripts/radial/harvesterDeed.py b/scripts/radial/deeds/harvesterDeed.py similarity index 100% rename from scripts/radial/harvesterDeed.py rename to scripts/radial/deeds/harvesterDeed.py diff --git a/scripts/radial/structureDeed.py b/scripts/radial/deeds/structureDeed.py similarity index 100% rename from scripts/radial/structureDeed.py rename to scripts/radial/deeds/structureDeed.py diff --git a/scripts/radial/vehicleDeed.py b/scripts/radial/deeds/vehicleDeed.py similarity index 86% rename from scripts/radial/vehicleDeed.py rename to scripts/radial/deeds/vehicleDeed.py index 633eb6db..033462ad 100644 --- a/scripts/radial/vehicleDeed.py +++ b/scripts/radial/deeds/vehicleDeed.py @@ -4,7 +4,7 @@ import sys def createRadial(core, owner, target, radials): radials.add(RadialOptions(0, 7, 1, '')) radials.add(RadialOptions(0, 15, 1, '')) - radials.add(RadialOptions(0, 61, 1, '')) + radials.add(RadialOptions(0, 61, 3, '@pet_menu:menu_generate')) return def handleSelection(core, owner, target, option): diff --git a/scripts/radial/appearance.py b/scripts/radial/equipment/appearance.py similarity index 100% rename from scripts/radial/appearance.py rename to scripts/radial/equipment/appearance.py diff --git a/scripts/radial/wearable.py b/scripts/radial/equipment/wearable.py similarity index 100% rename from scripts/radial/wearable.py rename to scripts/radial/equipment/wearable.py diff --git a/scripts/radial/lifeday_gift.py b/scripts/radial/holidays/lifeday_gift.py similarity index 100% rename from scripts/radial/lifeday_gift.py rename to scripts/radial/holidays/lifeday_gift.py diff --git a/scripts/radial/main_lifeday_tree.py b/scripts/radial/holidays/main_lifeday_tree.py similarity index 100% rename from scripts/radial/main_lifeday_tree.py rename to scripts/radial/holidays/main_lifeday_tree.py diff --git a/scripts/radial/exar_kun_brazier.py b/scripts/radial/instances/exar_kun/exar_kun_brazier.py similarity index 100% rename from scripts/radial/exar_kun_brazier.py rename to scripts/radial/instances/exar_kun/exar_kun_brazier.py diff --git a/scripts/radial/collection.py b/scripts/radial/item/collection.py similarity index 100% rename from scripts/radial/collection.py rename to scripts/radial/item/collection.py diff --git a/scripts/radial/item.py b/scripts/radial/item/item.py similarity index 100% rename from scripts/radial/item.py rename to scripts/radial/item/item.py diff --git a/scripts/radial/lootchest.py b/scripts/radial/item/lootchest.py similarity index 100% rename from scripts/radial/lootchest.py rename to scripts/radial/item/lootchest.py diff --git a/scripts/radial/resourceContainer.py b/scripts/radial/item/resourceContainer.py similarity index 100% rename from scripts/radial/resourceContainer.py rename to scripts/radial/item/resourceContainer.py diff --git a/scripts/radial/survey_tool.py b/scripts/radial/item/survey_tool.py similarity index 100% rename from scripts/radial/survey_tool.py rename to scripts/radial/item/survey_tool.py diff --git a/scripts/radial/travel_ticket.py b/scripts/radial/item/travel_ticket.py similarity index 100% rename from scripts/radial/travel_ticket.py rename to scripts/radial/item/travel_ticket.py diff --git a/scripts/radial/tunable.py b/scripts/radial/item/tunable.py similarity index 100% rename from scripts/radial/tunable.py rename to scripts/radial/item/tunable.py diff --git a/scripts/radial/conversation.py b/scripts/radial/object/conversation.py similarity index 100% rename from scripts/radial/conversation.py rename to scripts/radial/object/conversation.py diff --git a/scripts/radial/usable.py b/scripts/radial/object/usable.py similarity index 100% rename from scripts/radial/usable.py rename to scripts/radial/object/usable.py diff --git a/scripts/radial/generator.py b/scripts/radial/structure/generator.py similarity index 100% rename from scripts/radial/generator.py rename to scripts/radial/structure/generator.py diff --git a/scripts/radial/harvester.py b/scripts/radial/structure/harvester.py similarity index 100% rename from scripts/radial/harvester.py rename to scripts/radial/structure/harvester.py diff --git a/scripts/radial/harvesterHopper.py b/scripts/radial/structure/harvesterHopper.py similarity index 100% rename from scripts/radial/harvesterHopper.py rename to scripts/radial/structure/harvesterHopper.py diff --git a/scripts/radial/moveable.py b/scripts/radial/structure/moveable.py similarity index 100% rename from scripts/radial/moveable.py rename to scripts/radial/structure/moveable.py diff --git a/scripts/radial/structure_management_terminal.py b/scripts/radial/structure/structure_management_terminal.py similarity index 100% rename from scripts/radial/structure_management_terminal.py rename to scripts/radial/structure/structure_management_terminal.py diff --git a/scripts/radial/vehicle.py b/scripts/radial/vehicle.py deleted file mode 100644 index 9c5a8e96..00000000 --- a/scripts/radial/vehicle.py +++ /dev/null @@ -1,29 +0,0 @@ -from resources.common import RadialOptions - -import sys - -def createRadial(core, owner, target, radials): - radials.add(RadialOptions(0, 7, 1, '')) - - if owner.canMount(target): - radials.add(RadialOptions(0, 208, 1, '@pet/pet_menu:menu_enter_exit')) - - if target.getOwnerId() == owner.getObjectID(): - radials.add(RadialOptions(0, 60, 3, '@pet/pet_menu:menu_store')) - - return - -def handleSelection(core, owner, target, option): - if target: - if option == 208: - if not owner.isMounted(): - owner.setMounted(1) - target.initMount(owner) - else: - target.unmount(owner) - - if option == 60: - if owner.isMounted(): target.unmount(owner) - core.objectService.destroyObject(target) - owner.setAttachment('activeVehicleID', None) - return \ No newline at end of file diff --git a/scripts/radial/vehicle_pcd.py b/scripts/radial/vehicle_pcd.py deleted file mode 100644 index 5f09ba10..00000000 --- a/scripts/radial/vehicle_pcd.py +++ /dev/null @@ -1,27 +0,0 @@ -from resources.common import RadialOptions -import sys - -def createRadial(core, owner, target, radials): - radials.add(RadialOptions(0, 62, 1, '')) - radials.add(RadialOptions(0, 7, 1, '')) - return - -def handleSelection(core, owner, target, option): - - if option == 61 and target: - core.objectService.useObject(owner, target) - - if option == 62 and target: - - vehicleId = long(owner.getAttachment('activeVehicleID')) - - if vehicleId != None: - vehicleObject = core.objectService.getObject(vehicleId) - - if owner.isMounted(): vehicleObject.unmount(owner) - - core.objectService.destroyObject(vehicleId) - owner.setAttachment('activeVehicleID', None) - - return - \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 51e235bb..88784bcf 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -85,6 +85,7 @@ import services.LoginService; import services.map.MapService; import services.object.ObjectService; import services.object.UpdateService; +import services.pet.MountService; import services.resources.HarvesterService; import services.resources.ResourceService; import services.retro.RetroService; @@ -181,6 +182,7 @@ public class NGECore { public HousingService housingService; public LootService lootService; public HarvesterService harvesterService; + public MountService mountService; // Login Server @@ -302,6 +304,7 @@ public class NGECore { housingService = new HousingService(this); lootService = new LootService(this); harvesterService = new HarvesterService(this); + mountService = new MountService(this); if (config.keyExists("JYTHONCONSOLE.PORT")) { int jythonPort = config.getInt("JYTHONCONSOLE.PORT"); @@ -356,6 +359,7 @@ public class NGECore { //zoneDispatch.addService(missionService); zoneDispatch.addService(bazaarService); zoneDispatch.addService(lootService); + zoneDispatch.addService(mountService); if (optionsConfigLoaded && options.getInt("LOAD.RESOURCE.SYSTEM") == 1) { zoneDispatch.addService(surveyService); diff --git a/src/resources/datatables/Posture.java b/src/resources/datatables/Posture.java index 312337f1..f319ea46 100644 --- a/src/resources/datatables/Posture.java +++ b/src/resources/datatables/Posture.java @@ -1,21 +1,23 @@ package resources.datatables; public class Posture { + // Posture.iff - public static final int Invalid = -1; - public static final int Upright = 0; - public static final int Crouched = 1; - public static final int Prone = 2; - public static final int Sneaking = 3; - public static final int Blocking = 4; - public static final int Climbing = 5; - public static final int Flying = 6; - public static final int LyingDown = 7; - public static final int Sitting = 8; - public static final int SkillAnimating = 9; - public static final int DrivingVehicle = 10; - public static final int RidingCreature = 11; - public static final int KnockedDown = 12; - public static final int Incapacitated = 13; - public static final int Dead = 14; + public static final byte Invalid = -1; + public static final byte Upright = 0; + public static final byte Crouched = 1; + public static final byte Prone = 2; + public static final byte Sneaking = 3; + public static final byte Blocking = 4; + public static final byte Climbing = 5; + public static final byte Flying = 6; + public static final byte LyingDown = 7; + public static final byte Sitting = 8; + public static final byte SkillAnimating = 9; + public static final byte DrivingVehicle = 10; + public static final byte RidingCreature = 11; + public static final byte KnockedDown = 12; + public static final byte Incapacitated = 13; + public static final byte Dead = 14; + } diff --git a/src/resources/datatables/State.java b/src/resources/datatables/State.java new file mode 100644 index 00000000..dafd0c64 --- /dev/null +++ b/src/resources/datatables/State.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class State { + + public static long Invalid = 0x00L; + public static long Cover = 0x1L; + public static long Combat = 0x2L; + public static long Peace = 0x4L; + public static long Aiming = 0x8L; + public static long Alert = 0x10L; + public static long Berserk = 0x20L; + public static long FeignDeath = 0x40L; + public static long CombatAttitudeEvasive = 0x80L; + public static long CombatAttitudeNormal = 0x100L; + public static long CombatAttitudeAggressive = 0x200L; + public static long Tumbling = 0x400L; + public static long Rallied = 0x800L; + public static long Stunned = 0x1000L; + public static long Blinded = 0x2000L; + public static long Dizzy = 0x4000L; + public static long Intimidated = 0x8000L; + public static long Immobilized = 0x10000L; + public static long Frozen = 0x20000L; + public static long Swimming = 0x40000L; + public static long SittingOnChair = 0x80000L; + public static long Crafting = 0x100000L; + public static long GlowingJedi = 0x200000L; + public static long MaskScent = 0x400000L; + public static long Poisoned = 0x800000L; + public static long Bleeding = 0x1000000L; + public static long Diseased = 0x2000000L; + public static long OnFire = 0x4000000L; + public static long RidingMount = 0x8000000L; + public static long MountedCreature = 0x10000000L; + public static long PilotingShip = 0x20000000L; + public static long ShipOperations = 0x40000000L; + public static long ShipGunner = 0x80000000L; + public static long ShipInterior = 0x100000000L; + public static long PilotingPobShip = 0x200000000L; + public static long PerformingDeathBlow = 0x400000000L; + public static long Disguised = 0x800000000L; + public static long ElectricBurned = 0x1000000000L; + public static long ColdBurned = 0x2000000000L; + public static long AcidBurned = 0x4000000000L; + public static long EnergyBurned = 0x8000000000L; + public static long KineticBurned = 0x10000000000L; + +} diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index d781ed7f..7680d9bd 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -35,7 +35,6 @@ import org.apache.mina.core.buffer.IoBuffer; import protocol.swg.ObjControllerMessage; import protocol.swg.PlayMusicMessage; -import protocol.swg.UpdateContainmentMessage; import protocol.swg.UpdatePostureMessage; import protocol.swg.UpdatePVPStatusMessage; import protocol.swg.chat.ChatSystemMessage; @@ -52,7 +51,6 @@ import main.NGECore; import engine.clients.Client; import resources.common.Cooldown; import resources.common.OutOfBand; -import resources.datatables.Options; import resources.objects.Buff; import resources.objects.DamageOverTime; import resources.objects.SWGList; @@ -69,7 +67,7 @@ import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import services.command.BaseSWGCommand; -@Entity(version=8) +@Entity(version=9) public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent @@ -131,7 +129,9 @@ public class CreatureObject extends TangibleObject implements IPersistent { private boolean performanceType = false; private boolean acceptBandflourishes = true; private boolean groupDance = true; + @NotPersistent private CreatureObject performanceWatchee; + @NotPersistent private CreatureObject performanceListenee; @NotPersistent private Vector performanceAudience = new Vector(); @@ -187,10 +187,8 @@ public class CreatureObject extends TangibleObject implements IPersistent { private TangibleObject conversingNpc; @NotPersistent private ConcurrentHashMap cooldowns = new ConcurrentHashMap(); - - public boolean mounted = false; @NotPersistent - public CreatureObject mountedVehicle; + private long tefTime = System.currentTimeMillis(); public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, Template, position, orientation); @@ -372,7 +370,6 @@ public class CreatureObject extends TangibleObject implements IPersistent { } public void setPosture(byte posture) { - synchronized(objectMutex) { if (this.posture == 0x09) { stopPerformance(); @@ -391,16 +388,13 @@ public class CreatureObject extends TangibleObject implements IPersistent { } public void startPerformance() { - - getClient().getSession().write(messageBuilder.buildStartPerformance(true)); - + setStationary(true); } public void stopPerformance() { - String type = ""; + synchronized(objectMutex) { - // Some reason this prevents the animation for playing an instrument when stopping (unless that's what "" does) setCurrentAnimation(getCurrentAnimation()); @@ -408,17 +402,16 @@ public class CreatureObject extends TangibleObject implements IPersistent { setPerformanceId(0,true); type = (performanceType) ? "dance" : "music"; + if (entertainerExperience != null) { entertainerExperience.cancel(true); entertainerExperience = null; } } - sendSystemMessage("@performance:" + type + "_stop_self",(byte)0); + sendSystemMessage("@performance:" + type + "_stop_self",(byte)0); stopAudience(); - - getClient().getSession().write(messageBuilder.buildStartPerformance(false)); - + setStationary(false); } public void stopAudience() { @@ -473,7 +466,13 @@ public class CreatureObject extends TangibleObject implements IPersistent { } notifyObservers(messageBuilder.buildFactionDelta(faction), true); - //updatePvpStatus(); + + + CreatureObject companion = NGECore.getInstance().mountService.getCompanion(this); + + if (companion != null) { + companion.setFaction(faction); + } } @Override @@ -483,7 +482,12 @@ public class CreatureObject extends TangibleObject implements IPersistent { } notifyObservers(messageBuilder.buildFactionStatusDelta(factionStatus), true); - //updatePvpStatus(); + + CreatureObject companion = NGECore.getInstance().mountService.getCompanion(this); + + if (companion != null) { + companion.setFactionStatus(factionStatus); + } } public float getHeight() { @@ -531,7 +535,25 @@ public class CreatureObject extends TangibleObject implements IPersistent { notifyObservers(stateDelta, true); } - + + public void setState(long state, boolean add) { + synchronized(objectMutex) { + if (state != 0) { + if (add) { + stateBitmask = (stateBitmask | state); + } else { + stateBitmask = (stateBitmask & ~state); + } + } + } + } + + public boolean getState(long state) { + synchronized(objectMutex) { + return ((stateBitmask & state) == state); + } + } + public long getOwnerId() { synchronized(objectMutex) { return ownerId; @@ -542,6 +564,9 @@ public class CreatureObject extends TangibleObject implements IPersistent { synchronized(objectMutex) { this.ownerId = ownerId; } + + setStringAttribute("owner", NGECore.getInstance().objectService.getObject(ownerId).getCustomName()); + notifyObservers(messageBuilder.buildOwnerIdDelta(ownerId), true); } @@ -1721,6 +1746,8 @@ public class CreatureObject extends TangibleObject implements IPersistent { synchronized(objectMutex) { this.stationary = stationary; } + + notifyObservers(messageBuilder.buildStartPerformance(stationary), true); } public TangibleObject getConversingNpc() { @@ -1788,73 +1815,19 @@ public class CreatureObject extends TangibleObject implements IPersistent { return (PlayerObject) this.getSlottedObject("ghost"); } - public boolean isMounted() { - return mounted; - } - - public void setMounted(boolean mounted) { - this.mounted = mounted; - } - - public CreatureObject getMountedVehicle() { - return mountedVehicle; - } - - public void setMountedVehicle(CreatureObject mountedVehicle) { - this.mountedVehicle = mountedVehicle; - } + //public float getCooldown(String cooldownGroup) { + //return ((float) getCooldown(cooldownGroup) / (float) 1000); + //} - public boolean canMount(CreatureObject vehicle) - { - if(vehicle.getOwnerId() == this.getObjectId()) return true; - return false; - } - - public void mount(CreatureObject owner) { - boolean remove = false; - synchronized(objectMutex) - { - if ((this.getOptionsBitmask() & Options.MOUNT) == Options.MOUNT) - { - remove = true; - _add(owner); - UpdateContainmentMessage updateContainmentMessage = new UpdateContainmentMessage(owner.getObjectID(), this.getObjectID(), 4); - notifyObservers(updateContainmentMessage, true); - } - } - - if(remove) NGECore.getInstance().simulationService.remove(owner, owner.getWorldPosition().x, owner.getWorldPosition().z, false); - } - - public void unmount(CreatureObject owner) { - boolean add = false; + public long getTefTime() { synchronized(objectMutex) { - if ((this.getOptionsBitmask() & Options.MOUNT) == Options.MOUNT){ - add = true; - _remove(owner); - UpdateContainmentMessage updateContainmentMessage = new UpdateContainmentMessage(owner.getObjectID(), 0, -1); - notifyObservers(updateContainmentMessage, true); - } - } - if(add) { - owner.setMounted(false); - owner.setMountedVehicle(null); - owner.setStateBitmask(0); - owner.setPosture((byte) 0); - NGECore.getInstance().simulationService.add(owner, getWorldPosition().x, getWorldPosition().z, false); - NGECore.getInstance().simulationService.teleport(owner, getWorldPosition(), getOrientation(), 0); + return (((tefTime - System.currentTimeMillis()) > 0) ? (tefTime - System.currentTimeMillis()) : 0); } } - public void initMount(CreatureObject owner) { + public void setTefTime(long tefTime) { synchronized(objectMutex) { - setStateBitmask(0x10000000); - owner.setMountedVehicle(this); - - this.mount(owner); - - owner.setStateBitmask(0x8000000); - this.setPosture((byte)10); + this.tefTime = tefTime + System.currentTimeMillis(); } } diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index a24ca702..a1a8eba8 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -44,7 +44,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=12) +@Persistent(version=13) public class PlayerObject extends IntangibleObject { // PLAY 3 @@ -144,6 +144,9 @@ public class PlayerObject extends IntangibleObject { private List chatChannels = new ArrayList(); + @NotPersistent + private boolean callingCompanion = false; + public PlayerObject() { super(); messageBuilder = new PlayerMessageBuilder(this); @@ -886,4 +889,13 @@ public class PlayerObject extends IntangibleObject { System.out.println("Not a Member of the channel!"); return false; } + + public boolean isCallingCompanion() { + return callingCompanion; + } + + public void setCallingCompanion(boolean callingCompanion) { + this.callingCompanion = callingCompanion; + } + } diff --git a/src/resources/objects/tangible/TangibleMessageBuilder.java b/src/resources/objects/tangible/TangibleMessageBuilder.java index f18dd482..ec017af4 100644 --- a/src/resources/objects/tangible/TangibleMessageBuilder.java +++ b/src/resources/objects/tangible/TangibleMessageBuilder.java @@ -51,7 +51,7 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder { buffer.put(getUnicodeString(object.getCustomName())); buffer.putInt(object.getVolume()); buffer.putInt(0); - buffer.putInt(0); // faction vars + buffer.putInt(tangible.getFactionStatus()); // faction vars if(tangible.getCustomization() == null || tangible.getCustomization().length <= 0) buffer.putShort((short) 0); @@ -67,7 +67,7 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder { if(tangible.getOptionsBitmask() == 0) tangible.setOptionsBitmask(0x100); buffer.putInt(tangible.getOptionsBitmask()); - buffer.putInt(0); // number of item uses + buffer.putInt(tangible.getUses()); // number of item uses buffer.putInt(tangible.getConditionDamage()); buffer.putInt(tangible.getMaxDamage()); buffer.put((byte) (tangible.isStaticObject() ? 1 : 0)); diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 2710a33a..4efc2c4c 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -39,6 +39,7 @@ import protocol.swg.UpdatePVPStatusMessage; import protocol.swg.objectControllerObjects.ShowFlyText; import resources.common.OutOfBand; import resources.common.RGB; +import resources.datatables.Options; import resources.objects.creature.CreatureObject; import resources.objects.loot.LootGroup; import resources.visitors.IDManagerVisitor; @@ -65,6 +66,7 @@ public class TangibleObject extends SWGObject { private List componentCustomizations = new ArrayList(); private Map customizationVariables = new HashMap(); protected int optionsBitmask = 0; + private int uses = 0; private int maxDamage = 1000; private boolean staticObject = true; protected String faction = ""; // Says you're "Imperial Special Forces" if it's 0 for some reason @@ -132,6 +134,15 @@ public class TangibleObject extends SWGObject { public void setIncapTimer(int incapTimer) { this.incapTimer = incapTimer; } + + public int getUses() { + return uses; + } + + public void setUses(int uses) { + this.uses = uses; + setIntAttribute("uses", uses); + } public synchronized int getConditionDamage() { return conditionDamage; @@ -266,6 +277,14 @@ public class TangibleObject extends SWGObject { } } + + if (getClient() != null) { + CreatureObject companion = NGECore.getInstance().mountService.getCompanion((CreatureObject) this); + + if (companion != null) { + companion.updatePvpStatus(); + } + } } public void setCustomizationVariable(String type, byte value) @@ -561,6 +580,7 @@ public class TangibleObject extends SWGObject { public void setSerialNumber(String serialNumber) { setStringAttribute("serial_number", serialNumber); + setOptions(Options.SERIAL, true); } public void sendDelta3(Client destination) { diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index ac70aa31..5142564e 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -80,6 +80,8 @@ import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import resources.common.*; import resources.common.collidables.AbstractCollidable; +import resources.datatables.DisplayType; +import resources.datatables.Options; import resources.datatables.PlayerFlags; import resources.datatables.Posture; import services.ai.LairActor; @@ -334,8 +336,9 @@ public class SimulationService implements INetworkDispatch { CreatureObject object = (CreatureObject) client.getParent(); - if (object.mounted) - object=object.getMountedVehicle(); + if (core.mountService.isMounted(object)) { + object = (CreatureObject) object.getContainer(); + } Point3D newPos; Point3D oldPos; @@ -433,8 +436,14 @@ public class SimulationService implements INetworkDispatch { System.out.println("NULL Object"); return; } + CreatureObject object = (CreatureObject) client.getParent(); + if (core.mountService.isMounted(object)) { + object.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_mount"), DisplayType.Broadcast); + core.mountService.dismount(object, (CreatureObject) object.getContainer()); + } + Point3D newPos = new Point3D(dataTransform.getXPosition(), dataTransform.getYPosition(), dataTransform.getZPosition()); if(Float.isNaN(newPos.x) || Float.isNaN(newPos.y) || Float.isNaN(newPos.z)) return; @@ -748,6 +757,7 @@ public class SimulationService implements INetworkDispatch { return; final CreatureObject object = (CreatureObject) client.getParent(); + SWGObject container = object.getContainer(); PlayerObject ghost = (PlayerObject) object.getSlottedObject("ghost"); if(object.getAttachment("proposer") != null) @@ -765,14 +775,12 @@ public class SimulationService implements INetworkDispatch { } } - if(object.getAttachment("activeVehicleID") != null) - { - if(object.isMounted()) object.getMountedVehicle().unmount(object); - long vehicleID = ((java.math.BigInteger) object.getAttachment("activeVehicleID")).longValue(); - core.objectService.destroyObject(vehicleID); - object.setAttachment("activeVehicleID", null); + if (core.mountService.isMounted(object)) { + core.mountService.dismount(object, (CreatureObject) container); } + core.mountService.storeAll(object); + /* object.createTransaction(core.getCreatureODB().getEnvironment()); core.getCreatureODB().put(object, Long.class, CreatureObject.class, object.getTransaction()); diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 063c8b9c..8e85c53e 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -41,6 +41,7 @@ import protocol.swg.objectControllerObjects.CombatSpam; import protocol.swg.objectControllerObjects.CommandEnqueueRemove; import protocol.swg.objectControllerObjects.StartTask; import resources.common.FileUtilities; +import resources.datatables.Options; import resources.datatables.Elemental; import resources.datatables.Posture; import resources.datatables.WeaponType; @@ -281,6 +282,11 @@ public class CombatService implements INetworkDispatch { private void applyDamage(CreatureObject attacker, TangibleObject target, int damage) { target.setConditionDamage(target.getConditionDamage() + damage); + + if (target.getOption(Options.MOUNT)) { + core.mountService.damage((CreatureObject) target); + } + DamageTaken event = events.new DamageTaken(); event.attacker = attacker; event.damage = damage; diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 77314980..eb06f324 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -121,6 +121,8 @@ import resources.objects.tangible.TangibleObject; import resources.objects.tool.SurveyTool; import resources.objects.waypoint.WaypointObject; import resources.objects.weapon.WeaponObject; +import services.command.BaseSWGCommand; +import services.command.CombatCommand; import services.bazaar.AuctionItem; import services.chat.ChatRoom; @@ -732,21 +734,69 @@ public class ObjectService implements INetworkDispatch { } public void useObject(CreatureObject creature, SWGObject object) { - if (object == null) { + if (creature == null || object == null) { return; } - if(object.getStringAttribute("proc_name") != null) - { - if(object.getAttachment("tempUseCount") != null) - { - int useCount = (int)object.getAttachment("tempUseCount"); // Seefo: Placeholder until delta for stack count/use count + int reuse_time; + + try { + reuse_time = object.getIntAttribute("reuse_time"); + } catch (NumberFormatException e) { + reuse_time = 0; + } + + if (reuse_time > 0) { + try { + DatatableVisitor visitor = ClientFileManager.loadFile("datatables/timer/template_command_mapping.iff", DatatableVisitor.class); - if((useCount - 1) == 0) destroyObject(object); - else object.setAttachment("tempUseCount", useCount--); + for (int i = 0; i < visitor.getRowCount(); i++) { + if (visitor.getObject(i, 0) != null && ((String) (visitor.getObject(i, 0))).equalsIgnoreCase(object.getTemplate())) { + String commandName = (String) visitor.getObject(i, 1); + String cooldownGroup = (String) visitor.getObject(i, 2); + String animation = (String) visitor.getObject(i, 3); + + if (commandName.length() > 0) { + BaseSWGCommand command = core.commandService.getCommandByName(commandName); + + if (command instanceof CombatCommand && animation.length() > 0) { + ((CombatCommand) command).setDefaultAnimations(new String[] { animation }); + } + + if (core.commandService.callCommand(creature, object, command, 0, "")) { + core.commandService.removeCommand(creature, 0, command); + return; + } + } else if (cooldownGroup.length() > 0) { + if (creature.hasCooldown(cooldownGroup)) { + return; + } + + creature.addCooldown(cooldownGroup, object.getIntAttribute("reuse_time")); + } + + break; + } + } + } catch (Exception e) { + e.printStackTrace(); } + } + + if (object instanceof TangibleObject) { + TangibleObject item = (TangibleObject) object; + int uses = item.getUses(); - // Seefo: We need to add cool downs for buff items + if (uses > 0) { + item.setUses(uses--); + + if (item.getUses() == 0) { + destroyObject(object); + } + } + } + + if (object.getStringAttribute("proc_name") != null) { core.buffService.addBuffToCreature(creature, object.getStringAttribute("proc_name").replace("@ui_buff:", ""), creature); } diff --git a/src/services/pet/MountService.java b/src/services/pet/MountService.java new file mode 100644 index 00000000..59f49f63 --- /dev/null +++ b/src/services/pet/MountService.java @@ -0,0 +1,766 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package services.pet; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.LongAdder; + +import protocol.swg.UpdateContainmentMessage; +import main.NGECore; +import resources.common.OutOfBand; +import resources.datatables.DisplayType; +import resources.datatables.Options; +import resources.datatables.Posture; +import resources.datatables.StateStatus; +import resources.objects.building.BuildingObject; +import resources.objects.creature.CreatureObject; +import resources.objects.player.PlayerObject; +import engine.resources.container.Traverser; +import engine.resources.objects.SWGObject; +import engine.resources.service.INetworkDispatch; +import engine.resources.service.INetworkRemoteEvent; + +public class MountService implements INetworkDispatch { + + private NGECore core; + + public MountService(NGECore core) { + this.core = core; + } + + // Creature mounts are considered pets as well + // Pet abilities and petId is in PLAY9 + + // The functions for vehicles, mounts and pets are similar, but not the same + // Hence the multiple services. + + public void generateVehicle(CreatureObject actor, SWGObject deed, String vehicleTemplate, String pcdTemplate) { + if (actor == null || vehicleTemplate == null || pcdTemplate == null) { + return; + } + + if (actor.getSlottedObject("ghost") == null) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:failed_to_call_vehicle"), DisplayType.Broadcast); + return; + } + + SWGObject datapad = actor.getSlottedObject("datapad"); + + if (datapad == null) { + return; + } + + // Unsure if these are the right attributes. It doesn't generate the vehicle if the datapad has max # of vehicles. + //if (datapad.getIntAttribute("data_size") >= datapad.getIntAttribute("datapad_slots")) { + //actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:has_max_vehicle"), DisplayType.Broadcast); + //return; + //} + + if (actor.getTefTime() > 0){ + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:prose_cant_generate_yet", actor.getTefTime()), DisplayType.Broadcast); + return; + } + + SWGObject pcd = core.objectService.createObject(pcdTemplate, actor.getPlanet()); + + if (pcd == null) { + return; + } + + if (pcd.getSlottedObject("inventory") == null) { + pcd.add(core.objectService.createObject("object/tangible/inventory/shared_character_inventory.iff", pcd.getPlanet())); + } + + CreatureObject vehicle = (CreatureObject) core.objectService.createObject(vehicleTemplate, actor.getPlanet()); + + if (vehicle == null) { + return; + } + + vehicle.setOptions(Options.MOUNT | Options.ATTACKABLE, true); + + vehicle.setOwnerId(actor.getObjectID()); + + pcd.setAttachment("companionId", vehicle.getObjectID()); + + pcd.getSlottedObject("inventory").add(vehicle); + + datapad.add(pcd); + + if (deed != null) { + core.objectService.destroyObject(deed); + } + + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:device_added"), DisplayType.Broadcast); + + call(actor, pcd); + } + + public void generateMount(CreatureObject actor, SWGObject deed, String vehicleTemplate, String pcdTemplate) { + return; // NOT IMPLEMENTED + } + + public void call(CreatureObject actor, SWGObject pcd) { + if (actor == null) { + return; + } + + if (pcd == null) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_call"), DisplayType.Broadcast); + return; + } + + if (isMounted(actor)) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cannot_call_another_rideable"), DisplayType.Broadcast); + return; + } + + if (actor.getCombatFlag() == 1) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cannot_call_in_combat"), DisplayType.Broadcast); + return; + } + + if (actor.getContainer() != null) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cannot_call_indoors"), DisplayType.Broadcast); + return; + } + + if (actor.getPosture() == Posture.Dead) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cannot_call_while_dead"), DisplayType.Broadcast); + return; + } + + if (pcd.getSlottedObject("inventory") == null) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_call"), DisplayType.Broadcast); + return; + } + + if (actor.isInStealth()) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:no_mount_stealth"), DisplayType.Broadcast); + return; + } + + if (pcd.getStringAttribute("required_faction") != null && pcd.getStringAttribute("required_faction").length() > 0) { + if (!actor.getFaction().equals(pcd.getStringAttribute("required_faction"))) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:officer_faction"), DisplayType.Broadcast); + return; + } + } + + PlayerObject player = (PlayerObject) actor.getSlottedObject("ghost"); + + if (player == null) { + return; + } + + CreatureObject mount = (CreatureObject) core.objectService.getObject((Long) pcd.getAttachment("companionId")); + + if (mount == null) { + // Somehow the vehicle object has got lost + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_call"), DisplayType.Broadcast); + return; + } + + mount.setFaction(actor.getFaction()); + mount.setFactionStatus(actor.getFactionStatus()); + + if (pcd.getTemplate().contains("vehicle")) { + callVehicle(actor, pcd, player, mount); + } else { + callMount(actor, pcd, player, mount); + } + } + + private void callVehicle(CreatureObject actor, SWGObject pcd, PlayerObject player, CreatureObject mount) { + if ((mount.getLevel() - actor.getLevel()) > 5) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_call_level"), DisplayType.Broadcast); + return; + } + + // FIXME Movement skillmod should always be used instead of CREO4 speed vars directly. Movement skillmod should NEVER be 0 unless rooted. Currently it is, which is wrong. + //if (actor.getSkillModBase("movement") == 0) { + //actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_call_vehicle_rooted"), DisplayType.Broadcast); + //return; + //} + + if (actor.getPlanet().getName().contains("kashyyyk") && !actor.getPlanet().getName().contains("_main")) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:vehicle_restricted_scene"), DisplayType.Broadcast); + //mount_restricted_scene for creature mounts + return; + } + + if (player.isCallingCompanion()) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_call_1sec"), DisplayType.Broadcast); + return; + } + + storeAll(actor); + + player.setCallingCompanion(true); + + if (actor.getTefTime() > 0) { + actor.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:call_vehicle_delay", actor.getTefTime()), DisplayType.Broadcast); + } + + try { + while (actor.getTefTime() > 0) { + Thread.sleep(3000); + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + + SWGObject datapad = actor.getSlottedObject("datapad"); + + if (datapad == null) { + return; + } + + datapad.viewChildren(actor, false, false, new Traverser() { + + public void process(SWGObject pcd) { + if (pcd.getAttachment("companionId") != null && mount.getObjectID() == ((Long) pcd.getAttachment("companionId"))) { + if (pcd.getSlottedObject("inventory") != null) { + LongAdder adder = new LongAdder(); + pcd.getSlottedObject("inventory").viewChildren(actor, false, false, (obj) -> adder.increment()); + + if (adder.intValue() == 1) { + pcd.getSlottedObject("inventory").remove(mount); + mount.setPosition(actor.getPosition().clone()); + mount.setOrientation(actor.getOrientation().clone()); + mount.setPlanet(actor.getPlanet()); + core.simulationService.add(mount, actor.getWorldPosition().x, actor.getWorldPosition().z, false); + } + } + } + } + + }); + + player.setCallingCompanion(false); + + System.out.println("Got to end"); + } + + private void callMount(CreatureObject actor, SWGObject pcd, PlayerObject player, CreatureObject mount) { + return; // NOT IMPLEMENTED + } + + public void damage(CreatureObject mount) { + // alter components to progressively reduce the painting. + //stfs + //customization_fading_veh + //customization_gone_veh + + if (mount == null) { + return; + } + + CreatureObject owner = (CreatureObject) core.objectService.getObject(mount.getOwnerId()); + + if (!mount.getTemplate().contains("vehicle")) { + dismount(owner, mount); + store(owner, mount); + mount.setConditionDamage(0); + return; + } + + if (mount.getConditionDamage() >= mount.getMaxDamage()) { + disable(mount); + } + } + + public void disable(CreatureObject mount) { + mount.setOptions(Options.DISABLED, true); + + mount.viewChildren(mount, false, false, new Traverser() { + + public void process(SWGObject object) { + if (object == null || !(object instanceof CreatureObject)) { + return; + } + + CreatureObject rider = (CreatureObject) object; + + dismount(rider, mount); + + rider.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:veh_disabled"), DisplayType.Broadcast); + } + + }); + } + + public boolean canRepair(CreatureObject actor, CreatureObject mount) { + if (actor == null || mount == null) { + return false; + } + + if (!mount.getOption(Options.MOUNT)) { + return false; + } + + if (!mount.getTemplate().contains("vehicle")) { + return false; + } + + if (mount.getOwnerId() != actor.getObjectID()) { + return false; + } + + if (mount.getOption(Options.DISABLED)) { + return false; + } + + if (mount.getConditionDamage() == 0) { + return false; + } + + List surroundings = core.simulationService.get(mount.getPlanet(), mount.getPosition().x, mount.getPosition().z, 32); + + for (SWGObject object : surroundings) { + if (object instanceof BuildingObject) { + if (object.getTemplate().contains("garage")) { + return true; + } + } + } + + return false; + } + + public void repair(CreatureObject repairer, CreatureObject mount) { + if (repairer == null || mount == null) { + return; + } + + if (!mount.getOption(Options.MOUNT)) { + return; + } + + if (core.objectService.getObject(mount.getOwnerId()) != repairer) { + return; + } + + if (mount.getOption(Options.DISABLED)) { + repairer.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cannot_repair_disabled"), DisplayType.Broadcast); + return; + } + + if (mount.getConditionDamage() == 0) { + repairer.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:undamaged_vehicle"), DisplayType.Broadcast); + return; + } + + // This should produce an SUI window regarding cost and cost might be determined differently. + // But at the moment it's not important. + + if (!canRepair(repairer, mount)) { + repairer.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:repair_unrecognized_garages"), DisplayType.Broadcast); + return; + } + + int cost = mount.getConditionDamage(); + + if (repairer.getCashCredits() < cost) { + repairer.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:repair_failed_due_to_funds"), DisplayType.Broadcast); + return; + } + + mount.setConditionDamage(0); + + mount.setOptions(Options.DISABLED, false); + + repairer.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:repaired_to_max"), DisplayType.Broadcast); + } + + public void mount(CreatureObject rider, CreatureObject mount) { + // FIXME like above, movement skillmod should be used instead of creo4 vars and never be 0, otherwise it thinks we are always rooted + //if (rider.getSkillModBase("movement") == 0) { + //rider.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_mount_rooted"), DisplayType.Broadcast); + //return; + //} + + if (mount.getOption(Options.DISABLED)) { + rider.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_mount_veh_disabled"), DisplayType.Broadcast); + return; + } + + if (!mount.getOption(Options.MOUNT)) { + return; + } + + if (!canMount(rider, mount)) { + rider.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_mount"), DisplayType.Broadcast); + return; + } + + mount._add(rider); + mount.setStateBitmask(mount.getStateBitmask() | 0x10000000); + //mount.setState(State.MountedCreature, true); + mount.notifyObservers(new UpdateContainmentMessage(rider.getObjectID(), mount.getObjectID(), 4), true); + //rider.setState(State.RidingMount, true); + rider.setStateBitmask(rider.getStateBitmask() | 0x8000000); + //rider.setPosture((mount.getTemplate().contains("vehicle")) ? Posture.DrivingVehicle : Posture.RidingCreature); + rider.setPosture((byte) 11); + core.simulationService.remove(rider, rider.getWorldPosition().x, rider.getWorldPosition().z, false); + } + + public CreatureObject getMount(SWGObject pcd) { + if (pcd == null) { + return null; + } + + if (pcd.getAttachment("companionId") == null) { + return null; + } + + CreatureObject mount = (CreatureObject) core.objectService.getObject((Long) pcd.getAttachment("companionId")); + + if (mount == null) { + return null; + } + + if (mount.getContainer() != null) { + return null; + } + + return mount; + } + + public CreatureObject getCompanion(CreatureObject actor) { + if (actor == null) { + return null; + } + + if (isMounted(actor)) { + return (CreatureObject) actor.getContainer(); + } + + SWGObject datapad = actor.getSlottedObject("datapad"); + + if (datapad == null) { + return null; + } + + final List companions = new ArrayList(); + + datapad.viewChildren(actor, false, false, new Traverser() { + + public void process(SWGObject pcd) { + if (pcd.getAttachment("companionId") != null) { + if (pcd.getSlottedObject("inventory") != null) { + LongAdder adder = new LongAdder(); + pcd.getSlottedObject("inventory").viewChildren(actor, false, false, (obj) -> adder.increment()); + + if (adder.intValue() == 0) { + CreatureObject companion = (CreatureObject) core.objectService.getObject((Long) pcd.getAttachment("companionId")); + companions.add(companion); + } + } + } + } + + }); + + if (companions.size() > 0) { + return companions.get(0); + } else { + return null; + } + } + + public boolean isMounted(CreatureObject rider) { + if (rider.getContainer() == null) { + return false; + } + + if (!(rider.getContainer() instanceof CreatureObject)) { + return false; + } + + CreatureObject mount = (CreatureObject) rider.getContainer(); + + if (!mount.getOption(Options.MOUNT)) { + return false; + } + + if (mount.getSlottedObject("rider") != rider) { + return false; + } + + return true; + } + + public boolean isMounted(SWGObject actor, CreatureObject mount) { + return actor.getContainer() == mount; + } + + public boolean canMount(CreatureObject rider, CreatureObject mount) { + if (mount == null) { + return false; + } + + if (!mount.getOption(Options.MOUNT)) { + return false; + } + + if (isMounted(rider)) { + return false; + } + + if (rider.getObjectID() == mount.getOwnerId()) { + return true; + } + + // It's a potential passenger + + // See if there's driver first + if (mount.getSlottedObject("rider") == null) { + return false; + } + + int passengers = 0; + + if (mount.getAttachment("passengers") != null){ + passengers = (Integer) mount.getAttachment("passengers"); + } + + int passengerSlot = 0; + + for (int i = 1; i <= passengers; i++) { + if (mount.getSlottedObject("rider" + i) == null) { + passengerSlot = i; + break; + } + } + + if (passengerSlot == 0) { + return false; + } + + CreatureObject owner = (CreatureObject) NGECore.getInstance().objectService.getObject(mount.getOwnerId()); + + if (owner == null) { + return false; + } + + if (owner.isAttackableBy(rider)) { + return false; + } + + if (rider.getGroupId() == 0 || rider.getGroupId() != owner.getGroupId()) { + return false; + } + + return true; + } + + public void dismount(CreatureObject rider, CreatureObject mount) { + if (rider == null || mount == null) { + return; + } + + if (!isMounted(rider)) { + return; + } + + if (!mount.getOption(Options.MOUNT)) { + return; + } + + if (rider.getObjectID() == mount.getOwnerId()) { + CreatureObject owner = rider; + + mount.viewChildren(owner, false, false, new Traverser() { + + public void process(SWGObject passenger) { + if (passenger != owner) { + mount._remove(passenger); + mount.notifyObservers(new UpdateContainmentMessage(passenger.getObjectID(), 0, -1), false); + + if (passenger instanceof CreatureObject) { + ((CreatureObject) passenger).setState(StateStatus.RidingMount, false); + ((CreatureObject) passenger).setPosture(Posture.Upright); + } + + core.simulationService.add(passenger, mount.getWorldPosition().x, mount.getWorldPosition().z, false); + core.simulationService.teleport(passenger, mount.getWorldPosition(), mount.getOrientation(), 0); + } + } + + }); + } + + mount._remove(rider); + mount.notifyObservers(new UpdateContainmentMessage(rider.getObjectID(), 0, -1), false); + + if (rider.getObjectID() == mount.getOwnerId()) { + mount.setState(StateStatus.MountedCreature, false); + } + + core.simulationService.add(rider, mount.getWorldPosition().x, mount.getWorldPosition().z, false); + core.simulationService.teleport(rider, mount.getWorldPosition(), mount.getOrientation(), 0); + + if (!mount.getTemplate().contains("vehicle") && rider.getObjectID() == mount.getOwnerId()) { + store(rider, mount); + } + } + + /* + * They seem to have been stored in the inventory of the pcd object. + * Judging by the fact pcds have inventories and many other things don't. + */ + public void store(CreatureObject storer, CreatureObject mount) { + if (mount.getContainer() != null) { + return; + } + + if (mount.getOwnerId() == 0) { + return; + } + + CreatureObject owner = (CreatureObject) core.objectService.getObject(mount.getOwnerId()); + + if (owner == null || storer == null || owner != storer) { + return; + } + + PlayerObject player = (PlayerObject) owner.getSlottedObject("ghost"); + + if (player.isCallingCompanion()) { + storer.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:cant_store_1sec"), DisplayType.Broadcast); + return; + } + + if (isMounted(owner, mount)) { + storer.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:must_dismount"), DisplayType.Broadcast); + return; + } + + if (owner.getTefTime() > 0){ + owner.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:prose_cant_store_yet", owner.getTefTime()), DisplayType.Broadcast); + return; + } + + SWGObject datapad = owner.getSlottedObject("datapad"); + + if (datapad == null) { + return; + } + + datapad.viewChildren(owner, false, false, new Traverser() { + + public void process(SWGObject pcd) { + if (pcd.getAttachment("companionId") != null && mount.getObjectID() == ((Long) pcd.getAttachment("companionId"))) { + if (pcd.getSlottedObject("inventory") != null) { + LongAdder adder = new LongAdder(); + pcd.getSlottedObject("inventory").viewChildren(owner, false, false, (obj) -> adder.increment()); + + if (adder.intValue() == 0) { + core.simulationService.remove(mount, mount.getWorldPosition().x, mount.getWorldPosition().z, true); + pcd.getSlottedObject("inventory").add(mount); + } + } + } + } + + }); + } + + public void storeAll(CreatureObject actor) { + while (getCompanion(actor) != null) { + store(actor, getCompanion(actor)); + } + + /* + if (actor == null) { + return; + } + + SWGObject datapad = actor.getSlottedObject("datapad"); + + if (datapad == null) { + return; + } + + datapad.viewChildren(actor, false, false, new Traverser() { + + public void process(SWGObject pcd) { + if (pcd.getAttachment("companionId") != null) { + if (pcd.getSlottedObject("inventory") != null) { + LongAdder adder = new LongAdder(); + pcd.getSlottedObject("inventory").viewChildren(actor, false, false, (obj) -> adder.increment()); + + if (adder.intValue() == 0) { + long companionId = (pcd.getAttachment("companionId") == null) ? 0L : (Long) pcd.getAttachment("companionId"); + store(actor, (CreatureObject) core.objectService.getObject(companionId)); + } + } + } + } + + }); + */ + } + + public void destroy(CreatureObject destroyer, SWGObject pcd) { + if (destroyer == null || pcd == null || pcd.getGrandparent() == null) { + return; + } + + if (destroyer.getObjectID() != pcd.getGrandparent().getObjectID()) { + return; + } + + if (pcd.getAttachment("companionId") == null) { + return; + } + + CreatureObject mount = (CreatureObject) core.objectService.getObject((Long) pcd.getAttachment("companionId")); + + dismount(destroyer, mount); + + store(destroyer, mount); + + String type = mount.getTemplate(); + + core.objectService.destroyObject(mount); + core.objectService.destroyObject(pcd); + + if (type.contains("vehicle")) { + destroyer.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:vehicle_released"), DisplayType.Broadcast); + } else { + destroyer.sendSystemMessage(OutOfBand.ProsePackage("@pet_menu:pet_released"), DisplayType.Broadcast); + } + } + + public void insertOpcodes(Map arg0, Map arg1) { + + } + + public void shutdown() { + + } + +}