Files
Paradise/code/modules/mod/mod_activation.dm
Qwertytoforty 76a845d380 Modsuits. Ready for review, sorry for the ammount of files changed 👉 👈 (#21147)
* biting off more than I can chew, but I feel like hurting myself

* more shit

* progress continues, moral stays sameish

* bite of 2587

* mod_theme down, but probably broken

* 385 errors, 16 warnings, zero tgui interactions

* 292 19

* final strech to buggy mess, break time

* it compiles. It almost fucking certainly doesnt work, but it compiles

* fudhsciffubgsbgpgb actions not working as should for modules

* fuck it we'll just open the pr as we work on it

* icons work now

* tgui stuff

* more progress

* JUDGEMENT

* IT LIVES. TGUI LIVES. Special thanks to Sirryan and my brother.

* jetpacks, gps, and go do what exo-suits yourself

* almost ready

* sorry to whoever has to review this

* should work™️

* should be good now

* pushing changes so I can do reviews next

* Apply suggestions from code review

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* lore™️ Adds illegals level to modsuit parts from syndicate.

* early returns

* and these illegals

* no uplink reference idiot

* mod inhands are a good idea

* this is needed for inhands nerd

* Bomb detector working, modsutis cover ears. skin things

* overslotting removal, cyborg charging, ert loadout for gamma

* duplicated signal

* modsuit themes, removes broken mister / bad base type module, 2 cores in robotics.

* tether module, orb module, holster stuff

* built in no slip, cheaper 87

* removes modules already installed, engineer ert get jetpack, equip into modsuit storage

* comments spaces and duplicate flags

* Some adjustments and thoughts on armor, heads get guns because they are cool like that / looting command members armor

* Apply suggestions from code review

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Compile TGUI, slowdown adjustment, Modsuit to MODsuit

* sonar, do after, more equipment, acid handling

* overlay bugs / ERT / DS suits autodeploy

* middle click action buttons

* traders, sec modsuit energy nerf

* surplus weighting

* Kinesis module.

* Pathfinder module, kinesis balance, blueprint for pathfinder and kinesis

* more power / unused module removed

* name, ds fix, pre equipped to cc suit

* depot / grammer

* ok should be good™️

* overslot, dupe gun, missing suit storage

* stealth nerf, new kit

* gun stuff  / ds theme

* bio armor is gone

* let me push changes please thank you

* makes shocks work right

* copies over some changes TG made to module prices after porting

* Merge remote-tracking branch 'upstream/master' into Because-I-hate-myself-and-someone-has-to-try-it-

* sirryans changes

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Update code/modules/telesci/gps.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Update code/modules/telesci/gps.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Control define, ERT / DS have gloves / boots again.

* Apply suggestions from code review

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* More changes

* god I hate tgui. Why do all the bundles live underground, instead of in my basement?

* she updates my master till I testmerge

* modsuits can recharge again

* fixes a lot of shit

* Ready for TM probably

* sure fuck it whatever that makes sense I guess

* the pinpointer works better™️

* Another storage module bug fix

* hair and medical stuff

* fuck fuck fuck

* fixes sonar

* Bag exploit fixes / plasma runtimes / ear nerf

* dna lock improvement / cryostorage

* whoops

* Ball form second cooldown wasn't helping, no more infinite cores

* she springs my lock till I ***SNAP***

* plasmaman no longer die

* fixes modsuit emp issues

* atmos no longer fucking dies

* Fixes, module printing, and a restriction on newly constructed modsuits

* Inventory code my hated

* WOOO PREFERENCE CODE WOOOOO

* icons my hated

* fix for mods / spaceproof shit

* holy shit whhhyyyyy

* backpack first

* Update mod_theme.dm

* prevent infinite gun arms / infinite modsuit cores / syndicate modules

* fixes tm error

* scream loudly if species sprites break. They shouldn't, but, you know.

* deconflicted with luck

* converts to refit for species

* fix pathfinder

* fixes modsuits being funky power wise

* lockboxes :gatto: , as well as DN-MP shield lock, and slight nerf to atmos modsuit

* nerfs the atmos modsuit

* magboots for ds / CC modsuit

* downside of autosave: typing in wrong window saves bad stuff

* Gamma ERT have internal cameras again.

* spellcheck when

* ah fuck

* yes delete the null that works

* whoops

* fixes error / description

* un vulps your cannon

* fixes tails disapeering on base modsuits

* space to underscore

* tgui fix / tajaran

* springlock buff, cryopod fix

* u helps

* WHO PUTS A GUN IN ITEMS

* tgui moment

* mining modsuit nerf / hidden holster module

* PAIN

* UNATHI TIDE STATION WIDE

* I love special code

* slightly dense

* shark jumpscare

* fixes ghost item, fixes springlock being bad

* YIPPEEEE IT WORKED

* she decons my flict

* pain

* ebbas days are numbered :^)

* hidden

* r-r-r-ebuild

* fixes more bugs

* qwerty, you are dense

* fixes gps

* fix mulebot crate

* level fix

* adds back icon

* moving storage, fix bug, modules activate / deactivate message

* yeah

* yeah

* yeah™️

* steels requests

* windoors no longer make pathfinder module explode

* chat spam

* oil slicks + modsuits

* whoops

* bag check

* ofc

* Update code/modules/mod/mod_control.dm

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* Update code/datums/uplink_items/uplink_nuclear.dm

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* Update code/modules/mod/mod_control.dm

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* Update code/modules/mod/modules/module_pathfinder.dm

Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>

---------

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
2023-08-19 15:36:13 -05:00

249 lines
11 KiB
Plaintext

/// Creates a radial menu from which the user chooses parts of the suit to deploy/retract. Repeats until all parts are extended or retracted.
/obj/item/mod/control/proc/choose_deploy(mob/user)
if(!length(mod_parts))
return
var/list/display_names = list()
var/list/items = list()
for(var/obj/item/part as anything in mod_parts)
display_names[part.name] = part.UID()
var/image/part_image = image(icon = part.icon, icon_state = part.icon_state)
if(part.loc != src)
part_image.underlays += image(icon = 'icons/hud/radial.dmi', icon_state = "module_active")
items += list(part.name = part_image)
var/pick = show_radial_menu(user, src, items, custom_check = FALSE, require_near = TRUE)
if(!pick)
return
var/part_reference = display_names[pick]
var/obj/item/part = locateUID(part_reference)
if(!istype(part) || user.incapacitated())
return
if(active || activating)
to_chat(user, "<span class='warning'>Deactivate the suit first!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return
var/parts_to_check = mod_parts - part
if(part.loc == src)
deploy(user, part)
on_mod_deployed(user)
for(var/obj/item/checking_part as anything in parts_to_check)
if(checking_part.loc != src)
continue
choose_deploy(user)
break
else
retract(user, part)
on_mod_retracted(user)
for(var/obj/item/checking_part as anything in parts_to_check)
if(checking_part.loc == src)
continue
choose_deploy(user)
break
/// Quickly deploys all parts (or retracts if all are on the wearer)
/obj/item/mod/control/proc/quick_deploy(mob/user)
if(active || activating)
to_chat(user, "<span class='warning'>Deactivate the suit first!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return FALSE
var/deploy = TRUE
for(var/obj/item/part as anything in mod_parts)
if(part.loc == src)
continue
deploy = FALSE
break
for(var/obj/item/part as anything in mod_parts)
if(deploy && part.loc == src)
deploy(null, part, TRUE)
else if(!deploy && part.loc != src)
retract(null, part, TRUE)
wearer.visible_message("<span class='notice'>[wearer]'s [src] [deploy ? "deploys" : "retracts"] its' parts with a mechanical hiss.</span>",
"<span class='notice'>[src] [deploy ? "deploys" : "retracts"] its' parts with a mechanical hiss.</span>",
"You hear a mechanical hiss.")
playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
if(deploy)
on_mod_deployed(user)
else
on_mod_retracted(user)
return TRUE
/// Deploys a part of the suit onto the user.
/obj/item/mod/control/proc/deploy(mob/user, obj/item/part, mass = FALSE)
if(part.loc != src)
if(!user)
return FALSE
to_chat(user, "<span class='warning'>[part.name] already deployed!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
if(part in overslotting_parts)
var/obj/item/overslot = wearer.get_item_by_slot(slot_bitfield_to_slot(part.slot_flags))
if(overslot)
wearer.unEquip(overslot, TRUE)
overslotting_parts[part] = overslot
overslot.forceMove(part)
RegisterSignal(part, COMSIG_ATOM_EXITED, PROC_REF(on_overslot_exit))
if(wearer.equip_to_slot_if_possible(part, slot_bitfield_to_slot(part.slot_flags), disable_warning = TRUE))
part.flags |= NODROP
if(mass)
return TRUE
wearer.visible_message("<span class='notice'>[wearer]'s [part.name] deploy[part.p_s()] with a mechanical hiss.</span>",
"<span class='notice'>[part] deploy[part.p_s()] with a mechanical hiss.</span>",
"You hear a mechanical hiss.")
playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
return TRUE
else
if(!user)
return FALSE
to_chat(user, "<span class='warning'>You already have clothing there!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return FALSE
/// Retract a part of the suit from the user.
/obj/item/mod/control/proc/retract(mob/user, obj/item/part, mass = FALSE)
if(part.loc == src)
if(!user)
return FALSE
to_chat(user, "<span class='warning'>You already have retracted there!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
part.flags &= ~NODROP
wearer.unEquip(part, TRUE)
part.forceMove(src)
if(overslotting_parts[part])
UnregisterSignal(part, COMSIG_ATOM_EXITED)
var/obj/item/overslot = overslotting_parts[part]
if(!wearer.equip_to_slot_if_possible(overslot, slot_bitfield_to_slot(overslot.slot_flags), disable_warning = TRUE))
overslot.forceMove(get_turf(wearer))
overslotting_parts[part] = null
if(mass)
return TRUE
wearer.visible_message("<span class='notice'>[wearer]'s [part.name] retract[part.p_s()] back into [src] with a mechanical hiss.</span>",
"<span class='notice'>[part] retract[part.p_s()] back into [src] with a mechanical hiss.</span>",
"You hear a mechanical hiss.")
playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
/// Starts the activation sequence, where parts of the suit activate one by one until the whole suit is on
/obj/item/mod/control/proc/toggle_activate(mob/user, force_deactivate = FALSE)
if(!wearer)
if(!force_deactivate)
to_chat(user, "<span class='warning'>Equip your suit first!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return FALSE
if(!force_deactivate && (SEND_SIGNAL(src, COMSIG_MOD_ACTIVATE, user) & MOD_CANCEL_ACTIVATE))
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return FALSE
for(var/obj/item/part as anything in mod_parts)
if(!force_deactivate && part.loc == src)
to_chat(user, "<span class='warning'>Deploy all parts first!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return FALSE
if(locked && !active && !allowed(user) && !force_deactivate)
to_chat(user, "<span class='warning'>Insufficient access!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return FALSE
if(!get_charge() && !force_deactivate)
to_chat(user, "<span class='warning'>Suit is not powered!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return FALSE
if(open && !force_deactivate)
to_chat(user, "<span class='warning'>Close the suit panel!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return FALSE
if(activating)
if(!force_deactivate)
to_chat(user, "<span class='warning'>Suit is already [active ? "shutting down" : "starting up"]!</span>")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
return FALSE
for(var/obj/item/mod/module/module as anything in modules)
if(!module.active || (module.allow_flags & MODULE_ALLOW_INACTIVE))
continue
module.on_deactivation(display_message = FALSE)
activating = TRUE
to_chat(wearer, "<span class='notice'>MODsuit [active ? "shutting down" : "starting up"].</span>")
if(do_after(wearer, activation_step_time, FALSE, target = src, allow_moving = TRUE))
if(has_wearer())
to_chat(wearer, "<span class='notice'>[boots] [active ? "relax their grip on your legs" : "seal around your feet"].</span>")
playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
seal_part(boots, seal = !active)
if(do_after(wearer, activation_step_time, FALSE, target = src, allow_moving = TRUE))
if(has_wearer())
to_chat(wearer, "<span class='notice'>[gauntlets] [active ? "become loose around your fingers" : "tighten around your fingers and wrists"].</span>")
playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
seal_part(gauntlets, seal = !active)
if(do_after(wearer, activation_step_time, FALSE, target = src, allow_moving = TRUE))
if(has_wearer())
to_chat(wearer, "<span class='notice'>[chestplate] [active ? "releases your chest" : "cinches tightly against your chest"].</span>")
playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
seal_part(chestplate, seal = !active)
if(do_after(wearer, activation_step_time, FALSE, target = src, allow_moving = TRUE))
if(has_wearer())
to_chat(wearer, "<span class='notice'>[helmet] hisses [active ? "open" : "closed"].</span>")
playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
seal_part(helmet, seal = !active)
if(do_after(wearer, activation_step_time, FALSE, target = src, allow_moving = TRUE))
if(has_wearer())
to_chat(wearer, "<span class='notice'>Systems [active ? "shut down. Parts unsealed. Goodbye" : "started up. Parts sealed. Welcome"], [wearer].</span>")
finish_activation(on = !active)
if(active)
playsound(src, 'sound/machines/synth_yes.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE, frequency = 6000)
if(!malfunctioning)
wearer.playsound_local(get_turf(src), 'sound/mecha/nominal.ogg', 50)
else
playsound(src, 'sound/machines/synth_no.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE, frequency = 6000)
activating = FALSE
SEND_SIGNAL(src, COMSIG_MOD_TOGGLED, user)
return TRUE
///Seals or unseals the given part
/obj/item/mod/control/proc/seal_part(obj/item/clothing/part, seal)
if(seal)
part.icon_state = "[skin]-[part.base_icon_state]-sealed"
part.flags |= part.visor_flags
part.flags_inv |= part.visor_flags_inv
part.flags_cover |= part.visor_flags_cover
part.heat_protection = initial(part.heat_protection)
part.cold_protection = initial(part.cold_protection)
else
part.icon_state = "[skin]-[part.base_icon_state]"
part.flags_cover &= ~part.visor_flags_cover
part.flags_inv &= ~part.visor_flags_inv
part.flags &= ~part.visor_flags
part.heat_protection = NONE
part.cold_protection = NONE
if(ishuman(wearer))
var/mob/living/carbon/human/H = wearer
H.regenerate_icons()
/// Finishes the suit's activation, starts processing
/obj/item/mod/control/proc/finish_activation(on)
active = on
if(active)
for(var/obj/item/mod/module/module as anything in modules)
module.on_suit_activation()
START_PROCESSING(SSobj, src)
else
for(var/obj/item/mod/module/module as anything in modules)
module.on_suit_deactivation()
STOP_PROCESSING(SSobj, src)
update_speed()
update_icon_state()
wearer.regenerate_icons()
/// Quickly deploys all the suit parts and if successful, seals them and turns on the suit. Intended mostly for outfits.
/obj/item/mod/control/proc/quick_activation()
var/seal = TRUE
for(var/obj/item/part as anything in mod_parts)
if(!deploy(null, part))
seal = FALSE
if(!seal)
return
for(var/obj/item/part as anything in mod_parts)
seal_part(part, seal = TRUE)
finish_activation(on = TRUE)
/obj/item/mod/control/proc/has_wearer()
return wearer
/obj/item/mod/control/proc/on_mod_deployed(mob/user)
SEND_SIGNAL(src, COMSIG_MOD_DEPLOYED, user)
/obj/item/mod/control/proc/on_mod_retracted(mob/user)
SEND_SIGNAL(src, COMSIG_MOD_RETRACTED, user)