From b52e7a565723a4eaaaa5f36b10c56f6483007a7a Mon Sep 17 00:00:00 2001 From: Jerry Wester Date: Wed, 14 Dec 2022 20:24:54 -0700 Subject: [PATCH] ion jetpack module --- code/game/objects/items/tanks/jetpack.dm | 10 +- .../mob/living/carbon/carbon_movement.dm | 12 +- code/modules/mod/mod_types.dm | 161 +++++++++++++++--- code/modules/mod/modules/modules_general.dm | 86 +++++++++- 4 files changed, 241 insertions(+), 28 deletions(-) diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm index 76bfe63d27..642dc79076 100644 --- a/code/game/objects/items/tanks/jetpack.dm +++ b/code/game/objects/items/tanks/jetpack.dm @@ -262,9 +262,13 @@ return /mob/living/carbon/get_jetpack() - var/obj/item/tank/jetpack/J = back - if(istype(J)) - return J + var/obj/item/I = back + if(istype(I, /obj/item/tank/jetpack)) + return I + else if(istype(I, /obj/item/mod/control)) + var/obj/item/mod/control/C = I + for(var/obj/item/mod/module/jetpack/J in C.modules) + return J /mob/living/carbon/human/get_jetpack() var/obj/item/tank/jetpack/J = ..() diff --git a/code/modules/mob/living/carbon/carbon_movement.dm b/code/modules/mob/living/carbon/carbon_movement.dm index ffb8523a9e..e70b1bcc92 100644 --- a/code/modules/mob/living/carbon/carbon_movement.dm +++ b/code/modules/mob/living/carbon/carbon_movement.dm @@ -16,9 +16,15 @@ if(istype(T) && movement_dir && T.allow_thrust(0.01)) return 1 - var/obj/item/tank/jetpack/J = get_jetpack() - if(istype(J) && (movement_dir || J.stabilizers) && J.allow_thrust(0.01, src)) - return 1 + var/obj/item/I = get_jetpack() + if(istype(I, /obj/item/tank/jetpack)) + var/obj/item/tank/jetpack/J = I + if((movement_dir || J.stabilizers) && J.allow_thrust(0.01, src)) + return 1 + else if(istype(I, /obj/item/mod/module/jetpack)) + var/obj/item/mod/module/jetpack/J = I + if((movement_dir || J.stabilizers) && J.allow_thrust()) + return 1 /mob/living/carbon/Moved() . = ..() diff --git a/code/modules/mod/mod_types.dm b/code/modules/mod/mod_types.dm index ed48580dbe..049842d173 100644 --- a/code/modules/mod/mod_types.dm +++ b/code/modules/mod/mod_types.dm @@ -7,78 +7,169 @@ return ..() /obj/item/mod/control/pre_equipped/standard - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/flashlight) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/flashlight, + ) /obj/item/mod/control/pre_equipped/engineering theme = /datum/mod_theme/engineering - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/rad_protection, /obj/item/mod/module/flashlight, /obj/item/mod/module/magboot) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/rad_protection, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/magboot, + ) /obj/item/mod/control/pre_equipped/atmospheric theme = /datum/mod_theme/atmospheric - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/rad_protection, /obj/item/mod/module/flashlight, /obj/item/mod/module/t_ray) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/rad_protection, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/t_ray, + ) /obj/item/mod/control/pre_equipped/advanced theme = /datum/mod_theme/advanced cell = /obj/item/stock_parts/cell/super - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/rad_protection, /obj/item/mod/module/flashlight) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/rad_protection, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/jetpack, + ) /obj/item/mod/control/pre_equipped/mining theme = /datum/mod_theme/mining cell = /obj/item/stock_parts/cell/high/plus - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/orebag, /obj/item/mod/module/flashlight, /obj/item/mod/module/magboot, /obj/item/mod/module/drill) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/orebag, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/magboot, + /obj/item/mod/module/drill, + ) /obj/item/mod/control/pre_equipped/medical theme = /datum/mod_theme/medical - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/flashlight, /obj/item/mod/module/health_analyzer, /obj/item/mod/module/quick_carry) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/health_analyzer, + /obj/item/mod/module/quick_carry, + ) /obj/item/mod/control/pre_equipped/rescue theme = /datum/mod_theme/rescue cell = /obj/item/stock_parts/cell/super - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/flashlight, /obj/item/mod/module/health_analyzer) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/health_analyzer, + ) /obj/item/mod/control/pre_equipped/research theme = /datum/mod_theme/research cell = /obj/item/stock_parts/cell/super - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/flashlight, /obj/item/mod/module/t_ray) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/t_ray, + ) /obj/item/mod/control/pre_equipped/security theme = /datum/mod_theme/security - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/flashlight, /obj/item/mod/module/holster) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/holster, + ) /obj/item/mod/control/pre_equipped/safeguard theme = /datum/mod_theme/safeguard cell = /obj/item/stock_parts/cell/super - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/flashlight, /obj/item/mod/module/holster) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/jetpack, + /obj/item/mod/module/holster, + ) /obj/item/mod/control/pre_equipped/magnate theme = /datum/mod_theme/magnate cell = /obj/item/stock_parts/cell/hyper - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/holster) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/holster, + /obj/item/mod/module/jetpack/advanced, + ) /obj/item/mod/control/pre_equipped/traitor theme = /datum/mod_theme/syndicate cell = /obj/item/stock_parts/cell/super - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/flashlight, /obj/item/mod/module/dna_lock) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/dna_lock, + /obj/item/mod/module/jetpack, + ) /obj/item/mod/control/pre_equipped/nuclear theme = /datum/mod_theme/syndicate cell = /obj/item/stock_parts/cell/hyper - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/visor/thermal, /obj/item/mod/module/flashlight, /obj/item/mod/module/holster) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/visor/thermal, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/jetpack/advanced, + /obj/item/mod/module/holster, + ) /obj/item/mod/control/pre_equipped/elite theme = /datum/mod_theme/elite cell = /obj/item/stock_parts/cell/bluespace - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/emp_shield, /obj/item/mod/module/visor/thermal, /obj/item/mod/module/flashlight, /obj/item/mod/module/holster) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/emp_shield, + /obj/item/mod/module/visor/thermal, + /obj/item/mod/module/jetpack/advanced, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/holster, + ) /obj/item/mod/control/pre_equipped/prototype theme = /datum/mod_theme/prototype cell = /obj/item/stock_parts/cell/high/plus - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/rad_protection, /obj/item/mod/module/flashlight) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/rad_protection, + /obj/item/mod/module/flashlight, + ) /obj/item/mod/control/pre_equipped/responsory theme = /datum/mod_theme/responsory cell = /obj/item/stock_parts/cell/hyper - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/emp_shield, /obj/item/mod/module/flashlight, /obj/item/mod/module/holster) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/emp_shield, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/holster, + ) var/insignia_type = /obj/item/mod/module/insignia /obj/item/mod/control/pre_equipped/responsory/Initialize(mapload, new_theme, new_skin) @@ -107,7 +198,14 @@ insignia_type = /obj/item/mod/module/insignia/chaplain /obj/item/mod/control/pre_equipped/responsory/inquisitory - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/anti_magic, /obj/item/mod/module/welding, /obj/item/mod/module/emp_shield, /obj/item/mod/module/flashlight, /obj/item/mod/module/holster) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/anti_magic, + /obj/item/mod/module/welding, + /obj/item/mod/module/emp_shield, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/holster, + ) applied_skin = "inquisitory" /obj/item/mod/control/pre_equipped/responsory/inquisitory/commander @@ -125,22 +223,43 @@ /obj/item/mod/control/pre_equipped/apocryphal theme = /datum/mod_theme/apocryphal cell = /obj/item/stock_parts/cell/bluespace - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/emp_shield, /obj/item/mod/module/holster) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/emp_shield, + /obj/item/mod/module/holster, + /obj/item/mod/module/jetpack, + ) /obj/item/mod/control/pre_equipped/corporate theme = /datum/mod_theme/corporate cell = /obj/item/stock_parts/cell/bluespace - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/holster) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/holster, + ) /obj/item/mod/control/pre_equipped/debug theme = /datum/mod_theme/debug cell = /obj/item/stock_parts/cell/bluespace - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/flashlight, /obj/item/mod/module/bikehorn, /obj/item/mod/module/rad_protection) //one of every type of module, for testing if they all work correctly + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/flashlight, + /obj/item/mod/module/bikehorn, + /obj/item/mod/module/rad_protection, + ) //one of every type of module, for testing if they all work correctly /obj/item/mod/control/pre_equipped/administrative theme = /datum/mod_theme/administrative cell = /obj/item/stock_parts/cell/infinite/abductor - initial_modules = list(/obj/item/mod/module/storage, /obj/item/mod/module/welding, /obj/item/mod/module/quick_carry/advanced, /obj/item/mod/module/magboot/advanced) + initial_modules = list( + /obj/item/mod/module/storage, + /obj/item/mod/module/welding, + /obj/item/mod/module/quick_carry/advanced, + /obj/item/mod/module/magboot/advanced, + /obj/item/mod/module/jetpack/advanced, + ) //these exist for the prefs menu /obj/item/mod/control/pre_equipped/syndicate_empty diff --git a/code/modules/mod/modules/modules_general.dm b/code/modules/mod/modules/modules_general.dm index 314bd915f1..9e6075d157 100644 --- a/code/modules/mod/modules/modules_general.dm +++ b/code/modules/mod/modules/modules_general.dm @@ -73,7 +73,91 @@ QDEL_NULL(stored) return ..() -/// No Ion Jetpack +///Ion Jetpack - Lets the user fly freely through space using battery charge. +/obj/item/mod/module/jetpack + name = "MOD ion jetpack module" + desc = "A series of electric thrusters installed across the suit, this is a module highly anticipated by trainee Engineers. \ + Rather than using gasses for combustion thrust, these jets are capable of accelerating ions using \ + charge from the suit's charge. Some say this isn't Nakamura Engineering's first foray into jet-enabled suits." + icon_state = "jetpack" + module_type = MODULE_TOGGLE + complexity = 3 + active_power_cost = DEFAULT_CHARGE_DRAIN * 0.5 + use_power_cost = DEFAULT_CHARGE_DRAIN + incompatible_modules = list(/obj/item/mod/module/jetpack) + cooldown_time = 0.5 SECONDS + overlay_state_inactive = "module_jetpack" + overlay_state_active = "module_jetpack_on" + /// Do we stop the wearer from gliding in space. + var/stabilizers = FALSE + /// Do we give the wearer a speed buff. + var/full_speed = FALSE + var/datum/effect_system/trail_follow/ion/ion_trail + +/obj/item/mod/module/jetpack/Initialize(mapload) + . = ..() + ion_trail = new + ion_trail.set_up(src) + +/obj/item/mod/module/jetpack/Destroy() + QDEL_NULL(ion_trail) + return ..() + +/obj/item/mod/module/jetpack/on_activation() + . = ..() + if(!.) + return + ion_trail.start() + RegisterSignal(mod.wearer, COMSIG_MOVABLE_MOVED, .proc/move_react) + RegisterSignal(mod.wearer, COMSIG_MOVABLE_SPACEMOVE, .proc/spacemove_react, override = TRUE) + if(full_speed) + mod.wearer.add_movespeed_modifier(/datum/movespeed_modifier/jetpack/fullspeed) + else + mod.wearer.add_movespeed_modifier(/datum/movespeed_modifier/jetpack) + +/obj/item/mod/module/jetpack/on_deactivation(display_message = TRUE, deleting = FALSE) + . = ..() + stabilizers = FALSE + ion_trail.stop() + UnregisterSignal(mod.wearer, COMSIG_MOVABLE_MOVED) + mod.wearer.remove_movespeed_modifier(/datum/movespeed_modifier/jetpack/fullspeed) + mod.wearer.remove_movespeed_modifier(/datum/movespeed_modifier/jetpack) + +/obj/item/mod/module/jetpack/get_configuration() + . = ..() + .["stabilizers"] = add_ui_configuration("Stabilizers", "bool", stabilizers) + +/obj/item/mod/module/jetpack/configure_edit(key, value) + switch(key) + if("stabilizers") + stabilizers = text2num(value) + +/obj/item/mod/module/jetpack/proc/move_react(mob/user) + allow_thrust() + +/obj/item/mod/module/jetpack/proc/allow_thrust(use_fuel = TRUE) + if(!active) + return FALSE + if(!use_fuel) + return check_power(use_power_cost) + if(!drain_power(use_power_cost)) + return FALSE + return TRUE + +/obj/item/mod/module/jetpack/proc/spacemove_react(mob/user, movement_dir) + SIGNAL_HANDLER + + if(active && (movement_dir || stabilizers)) + return COMSIG_MOVABLE_STOP_SPACEMOVE + +/obj/item/mod/module/jetpack/advanced + name = "MOD advanced ion jetpack module" + desc = "An improvement on the previous model of electric thrusters. This one achieves higher speeds through \ + mounting of more jets and a red paint applied on it." + icon_state = "jetpack_advanced" + overlay_state_inactive = "module_jetpackadv" + overlay_state_active = "module_jetpackadv_on" + full_speed = TRUE ///Eating Apparatus - Lets the user eat/drink with the suit on. /obj/item/mod/module/mouthhole