Files
Aurora.3/code/game/objects/items/weapons/tanks/jetpack.dm
T
374e220be6 Hardsuit interface overhaul (#22403)
**Summary**
Converts hardsuit NanoUI to TGUI and overhauls much of the associated UI
and module code.

The conversion alone is what necessitated quite a bit of cleanup of our
11-year-old hardsuit code, for which I leaned heavily upon tg's
implementation of MODsuits. Therefore, this is a PARTIAL (???) port of
both https://github.com/tgstation/tgstation/pull/59109 and
https://github.com/tgstation/tgstation/pull/77022. While a lot of
wonderful code and UI design was ported 1:1 (for which I am grateful!),
our hardsuits are still NOT MODsuits. Most of our back-end remains the
same.

Fixes https://github.com/Aurorastation/Aurora.3/issues/22071

changes:
  - refactor: "Migrates Hardsuit NanoUI to TGUI."
- refactor: "Updates Hardsuit module type definitions, configuration
data, many misc other functions for the purpose of the UI refactor
(general utility and readability improvements)."
- balance: "Hardsuits now passively consume a small amount of energy
while online, even when retracted."
- balance: "Hardsuit boots can no longer be retracted without also
retracting the chest piece first."
- balance: "Mounted hardsuit storage module max space increased from 9
to 14."
- balance: "Plasma cutter (standalone and mounted) damage increased and
range decreased by 50% each."
- soundadd: "Adds several new sounds for hardsuit use (attribution
located w/ files)."
- code_imp: "Makes power_wattage_readable() a global proc and adds
power_joules_readable()."
  - code_imp: "Lots of misc DMdoc updates."
- bugfix: "Synthetic Charging Stations now charge hardsuit power cells
as intended."

**Old UI**
<img width="804" height="1321" alt="Screenshot 2026-05-04 135705"
src="https://github.com/user-attachments/assets/f01957a0-7cec-4fcc-b862-c9dfde0dcc43"
/>

**New UI**
<img width="998" height="782" alt="Screenshot 2026-05-04 174658"
src="https://github.com/user-attachments/assets/ad402902-d489-435a-9c16-82150ed82618"
/>

### Asset Licenses
The following assets that **have not** been created by myself are
included in this PR:
| Path | Original Author | License |
| --- | --- | --- |
| icons/mob/rig_modules.dmi (mounted-plasmacutter)|
[Ghostsheet](https://github.com/ghostsheet) | CC-BY-SA |

---------

Signed-off-by: Batrachophreno <Batrochophreno@gmail.com>
Co-authored-by: VMSolidus <evilexecutive@gmail.com>
2026-05-18 19:21:11 +00:00

242 lines
8.0 KiB
Plaintext

/**
* Returns a jetpack if the param is a human mob and said human mob is wearing
* a jetpack on their back, or has a RIG on their back with the jetpack module
* installed.
*
* @param H Either a human or a robot mob. Is type and sanity checked.
*
* @return A jetpack instance if one is found. Null otherwise.
*/
/proc/GetJetpack(var/mob/living/carbon/human/H)
// Search the human for a jetpack. Either on back or on a RIG that's on
// on their back.
if(istype(H))
// Skip sanity check for H.back, as istype can safely handle a null.
if (istype(H.back, /obj/item/tank/jetpack))
return H.back
else if (istype(H.s_store, /obj/item/tank/jetpack))
return H.s_store
else if (istype(H.back, /obj/item/rig))
var/obj/item/rig/rig = H.back
for (var/obj/item/rig_module/maneuvering_jets/module in rig.installed_modules)
return module.jets
// See if we have a robot instead, and look for their jetpack.
else if (istype(H, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = H
if (R.module)
for (var/obj/item/tank/jetpack/J in R.module.modules)
return J
// Synthetic jetpacks don't install into modules. They go into contents.
for (var/obj/item/tank/jetpack/J in R.contents)
return J
return null
/obj/item/tank/jetpack
name = "jetpack"
desc = "A tank of compressed gas for use as propulsion in zero-gravity areas. Use with caution."
icon_state = "jetpack"
item_state = "jetpack"
gauge_icon = null
w_class = WEIGHT_CLASS_BULKY
distribute_pressure = ONE_ATMOSPHERE*O2STANDARD
var/ion_trail_type = /obj/effect/effect/ion_trails
var/on = 0.0
var/stabilization_on = 0
var/warned = 0
var/volume_rate = 500 //Needed for borg jetpack transfer
action_button_name = "Toggle Jetpack"
/obj/item/tank/jetpack/feedback_hints(mob/user, distance, is_adjacent)
. += ..()
if(air_contents.total_moles < 25)
. += SPAN_NOTICE("The meter on \the [src] indicates you are almost out of gas!")
/obj/item/tank/jetpack/verb/toggle_rockets()
set name = "Toggle Jetpack Stabilization"
set category = "Object.Jetpack"
set src in usr
toggle_rockets_stabilization(usr)
/// This toggle proc is used for the verb, but we break activation and deactivation into separate procs for management from other objs (like hardsuits).
/// Param 'send_message' will make proc send feedback messages if default TRUE, but proc will be silent if FALSE.
/obj/item/tank/jetpack/proc/toggle_rockets_stabilization(mob/user)
if(stabilization_on)
disable_rockets_stabilization(user)
else
enable_rockets_stabilization(user)
/// Exists to be called directly from other objs (like hardsuits).
/obj/item/tank/jetpack/proc/enable_rockets_stabilization(mob/user)
stabilization_on = TRUE
balloon_alert(user, "stabilizers on!")
/// Exists to be called directly from other objs (like hardsuits).
/obj/item/tank/jetpack/proc/disable_rockets_stabilization(mob/user, var/message = TRUE)
stabilization_on = FALSE
balloon_alert(user, "stabilizers off!")
/obj/item/tank/jetpack/verb/toggle()
set name = "Toggle Jetpack"
set category = "Object.Jetpack"
set src in usr
toggle_jetpack(usr)
/// This toggle proc is used for the verb, but we break activation and deactivation into separate procs for management from other objs (like hardsuits).
/obj/item/tank/jetpack/proc/toggle_jetpack(mob/user)
if(on)
disable_jetpack(user)
else
enable_jetpack(user)
/// Exists to be called directly from other objs (like hardsuits).
/obj/item/tank/jetpack/proc/enable_jetpack(mob/user)
on = TRUE
enable_rockets_stabilization(user, FALSE)
icon_state = "[icon_state]-on"
user.update_inv_back()
user.update_action_buttons()
balloon_alert(user, "jetpack on!")
/// Exists to be called directly from other objs (like hardsuits).
/obj/item/tank/jetpack/proc/disable_jetpack(mob/user, var/list/message_mobs)
on = FALSE
icon_state = initial(icon_state)
user.update_inv_back()
user.update_action_buttons()
balloon_alert(user, "jetpack off!")
/obj/item/tank/jetpack/proc/allow_thrust(num, mob/living/user as mob)
if(!(src.on))
return FALSE
if (stabilization_on)
num *= 2//gas usage is doubled when stabilising. one burst to start moving, and one to stop
if((num < 0.005 || src.air_contents.total_moles < num))
return FALSE
if (src.air_contents.total_moles < 3 && !warned)
warned = TRUE
playsound(user, 'sound/effects/alert.ogg', 50, 1)
to_chat(user, SPAN_DANGER("The meter on \the [src] indicates you are almost out of gas and beeps loudly!"))
addtimer(CALLBACK(src, PROC_REF(reset_warning)), 600)
var/datum/gas_mixture/G = src.air_contents.remove(num)
var/allgases = G.gas[GAS_CO2] + G.gas[GAS_NITROGEN] + G.gas[GAS_OXYGEN] + G.gas[GAS_PHORON] + G.gas[GAS_HYDROGEN]
if(allgases >= 0.005)
var/obj/effect/effect/ion_trails/ion_trail = new(user.loc)
flick("ion_fade", ion_trail)
ion_trail.icon_state = "blank"
animate(ion_trail, alpha = 0, time = 18, easing = SINE_EASING | EASE_IN)
QDEL_IN(ion_trail, 20)
return TRUE
qdel(G)
/obj/item/tank/jetpack/proc/reset_warning()
warned = 0
/obj/item/tank/jetpack/ui_action_click()
toggle()
/obj/item/tank/jetpack/void
name = "void jetpack (oxygen)"
desc = "It works well in a void."
icon_state = "jetpack-void"
item_state = "jetpack-void"
/obj/item/tank/jetpack/void/adjust_initial_gas()
air_contents.adjust_gas(GAS_OXYGEN, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/jetpack/oxygen
name = "jetpack (oxygen)"
desc = "A tank of compressed oxygen for use as propulsion in zero-gravity areas. Use with caution."
icon_state = "jetpack"
item_state = "jetpack"
/obj/item/tank/jetpack/oxygen/adjust_initial_gas()
air_contents.adjust_gas(GAS_OXYGEN, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/jetpack/carbondioxide
name = "jetpack (carbon dioxide)"
desc = "A tank of compressed carbon dioxide for use as propulsion in zero-gravity areas. Painted black to indicate that it should not be used as a source for internals."
distribute_pressure = 0
icon_state = "jetpack-black"
item_state = "jetpack-black"
/obj/item/tank/jetpack/carbondioxide/adjust_initial_gas()
air_contents.adjust_gas(GAS_CO2, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/jetpack/carbondioxide/synthetic
name = "Synthetic Jetpack"
desc = "A chassis-mounted tank of compressed carbon dioxide for use as propulsion in zero-gravity areas."
/obj/item/tank/jetpack/carbondioxide/synthetic/adjust_initial_gas()
air_contents.adjust_gas(GAS_CO2, (15*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/jetpack/carbondioxide/synthetic/verb/toggle_synthetic_jetpack()
set name = "Toggle Jetpack"
set category = "Robot Commands"
set src in usr
on = !on
if(on)
icon_state = "[icon_state]-on"
else
icon_state = initial(icon_state)
to_chat(usr, SPAN_NOTICE("You toggle the thrusters [on ? "on" : "off"]."))
stabilization_on = !stabilization_on
to_chat(usr, SPAN_NOTICE("You toggle the stabilization [stabilization_on ? "on" : "off"]."))
/obj/item/tank/jetpack/carbondioxide/synthetic/verb/toggle_stabilizer()
set name = "Toggle Jetpack Stabilization"
set category = "Robot Commands"
set src in usr
stabilization_on = !stabilization_on
to_chat(usr, SPAN_NOTICE("You toggle the stabilization [stabilization_on ? "on" : "off"]."))
/obj/item/tank/jetpack/rig
name = "hardsuit jetpack"
var/obj/item/rig/holder
/obj/item/tank/jetpack/rig/Destroy()
holder = null
. = ..()
/obj/item/tank/jetpack/rig/allow_thrust(num, mob/living/user as mob)
if(!(src.on))
return FALSE
if(!istype(holder) || !holder.air_supply)
return FALSE
var/obj/item/tank/pressure_vessel = holder.air_supply
if((num < 0.005 || pressure_vessel.air_contents.total_moles < num))
return FALSE
var/datum/gas_mixture/G = pressure_vessel.air_contents.remove(num)
var/allgases = G.gas[GAS_CO2] + G.gas[GAS_NITROGEN] + G.gas[GAS_OXYGEN] + G.gas[GAS_PHORON] + G.gas[GAS_HYDROGEN]
if(allgases >= 0.005)
var/obj/effect/effect/ion_trails/ion_trail = new(user.loc)
flick("ion_fade", ion_trail)
ion_trail.icon_state = "blank"
animate(ion_trail, alpha = 0, time = 18, easing = SINE_EASING | EASE_IN)
QDEL_IN(ion_trail, 20)
return TRUE
qdel(G)