Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add restrictions on the use of modules when destroying corresponding exosuit parts #713

Merged
merged 3 commits into from
Feb 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions code/modules/mechs/mech_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,16 @@


/mob/living/exosuit/ClickOn(var/atom/A, var/params, var/mob/user)

if(!user || incapacitated() || user.incapacitated())
return
var/arms_chosen = FALSE
var/body_chosen = FALSE
if(selected_hardpoint == HARDPOINT_LEFT_HAND || selected_hardpoint == HARDPOINT_RIGHT_HAND)
arms_chosen = TRUE
body_chosen = FALSE
else if(selected_hardpoint == HARDPOINT_BACK || selected_hardpoint == HARDPOINT_HEAD || selected_hardpoint == HARDPOINT_LEFT_SHOULDER || selected_hardpoint == HARDPOINT_RIGHT_SHOULDER)
arms_chosen = FALSE
body_chosen = TRUE

if(!loc) return
var/adj = A.Adjacent(src) // Why in the fuck isn't Adjacent() commutative.
Expand All @@ -94,15 +101,19 @@
if(A.loc != src && !(get_dir(src, A) & dir))
return

if(!arms)
if(!arms && arms_chosen)
to_chat(user, SPAN_WARNING("\The [src] has no manipulators!"))
setClickCooldown(3)
return

if(!arms.motivator || !arms.motivator.is_functional())
if(!arms.motivator && arms_chosen)
to_chat(user, SPAN_WARNING("Your motivators are damaged! You can't use your manipulators!"))
setClickCooldown(15)
return
if((!body || body.total_damage >= body.max_damage) && body_chosen)
to_chat(user, SPAN_WARNING("Your cockpit too damaged, additional hardpoints control system damaged, you cant this module!"))
setClickCooldown(15)
return

if(!get_cell()?.checked_use(arms.power_use * CELLRATE))
to_chat(user, power == MECH_POWER_ON ? SPAN_WARNING("Error: Power levels insufficient.") : SPAN_WARNING("\The [src] is powered off."))
Expand Down Expand Up @@ -190,7 +201,7 @@
if(A == src)
setClickCooldown(5)
return attack_self(user)
else if(adj && user.a_intent == I_HURT)
else if(adj && user.a_intent == I_HURT && arms.motivator)
setClickCooldown(arms ? arms.action_delay : 7)
src.visible_message(SPAN_DANGER(" [src] steps back, preparing for a punch!"), blind_message = SPAN_DANGER("You hear the loud hissing of hydraulics!"))
playsound(src.loc, mech_step_sound, 60, 1)
Expand Down
Loading