fixes some modsuit bugs (#66574)

This commit is contained in:
Fikou
2022-04-29 23:14:46 +02:00
committed by GitHub
parent 39c3f526b4
commit 8b6bdc87b4
2 changed files with 47 additions and 17 deletions
+16 -9
View File
@@ -32,7 +32,7 @@
choose_deploy(user)
break
else
conceal(user, part)
retract(user, part)
for(var/obj/item/checking_part as anything in parts_to_check)
if(checking_part.loc == src)
continue
@@ -54,7 +54,7 @@
if(deploy && part.loc == src)
deploy(null, part)
else if(!deploy && part.loc != src)
conceal(null, part)
retract(null, part)
wearer.visible_message(span_notice("[wearer]'s [src] [deploy ? "deploys" : "retracts"] its' parts with a mechanical hiss."),
span_notice("[src] [deploy ? "deploys" : "retracts"] its' parts with a mechanical hiss."),
span_hear("You hear a mechanical hiss."))
@@ -63,11 +63,17 @@
/// Deploys a part of the suit onto the user.
/obj/item/mod/control/proc/deploy(mob/user, obj/item/part)
if(part.loc != src)
if(!user)
return FALSE
balloon_alert(user, "[part.name] already deployed!")
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(part.slot_flags)
if(overslot)
overslotting_parts[part] = overslot
wearer.transferItemToLoc(overslot, part, force = TRUE)
RegisterSignal(part, COMSIG_ATOM_EXITED, .proc/on_overslot_exit)
if(wearer.equip_to_slot_if_possible(part, part.slot_flags, qdel_on_fail = FALSE, disable_warning = TRUE))
ADD_TRAIT(part, TRAIT_NODROP, MOD_TRAIT)
if(!user)
@@ -77,11 +83,6 @@
span_hear("You hear a mechanical hiss."))
playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
return TRUE
else if(part.loc != src)
if(!user)
return FALSE
balloon_alert(user, "[part.name] already deployed!")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
else
if(!user)
return FALSE
@@ -89,11 +90,17 @@
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/conceal(mob/user, obj/item/part)
/// Retract a part of the suit from the user.
/obj/item/mod/control/proc/retract(mob/user, obj/item/part)
if(part.loc == src)
if(!user)
return FALSE
balloon_alert(user, "[part.name] already retracted!")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
REMOVE_TRAIT(part, TRAIT_NODROP, MOD_TRAIT)
wearer.transferItemToLoc(part, src, force = TRUE)
if(overslotting_parts[part])
UnregisterSignal(part, COMSIG_ATOM_EXITED)
var/obj/item/overslot = overslotting_parts[part]
if(!wearer.equip_to_slot_if_possible(overslot, overslot.slot_flags, qdel_on_fail = FALSE, disable_warning = TRUE))
wearer.dropItemToGround(overslot, force = TRUE, silent = TRUE)
+31 -8
View File
@@ -118,7 +118,7 @@
mod_parts += gauntlets
boots = new /obj/item/clothing/shoes/mod(src)
mod_parts += boots
var/list/all_parts = mod_parts.Copy() + src
var/list/all_parts = mod_parts + src
for(var/obj/item/part as anything in all_parts)
part.name = "[theme.name] [part.name]"
part.desc = "[part.desc] [theme.desc]"
@@ -265,10 +265,12 @@
for(var/obj/item/part as anything in mod_parts)
seal_part(part, seal = FALSE)
for(var/obj/item/part as anything in mod_parts)
conceal(null, part)
retract(null, part)
if(active)
finish_activation(on = FALSE)
unset_wearer()
var/mob/old_wearer = old_loc
old_wearer.temporarilyRemoveItemFromInventory(src)
/obj/item/mod/control/allow_attack_hand_drop(mob/user)
if(user != wearer)
@@ -436,7 +438,7 @@
for(var/obj/item/part as anything in mod_parts)
if(part.loc == src)
continue
conceal(null, part)
retract(null, part)
return ..()
/obj/item/mod/control/worn_overlays(mutable_appearance/standing, isinhands = FALSE, icon_file)
@@ -455,6 +457,7 @@
wearer = user
SEND_SIGNAL(src, COMSIG_MOD_WEARER_SET, wearer)
RegisterSignal(wearer, COMSIG_ATOM_EXITED, .proc/on_exit)
RegisterSignal(wearer, COMSIG_SPECIES_GAIN, .proc/on_species_gain)
update_charge_alert()
for(var/obj/item/mod/module/module as anything in modules)
module.on_equip()
@@ -462,11 +465,21 @@
/obj/item/mod/control/proc/unset_wearer()
for(var/obj/item/mod/module/module as anything in modules)
module.on_unequip()
UnregisterSignal(wearer, list(COMSIG_ATOM_EXITED, COMSIG_PROCESS_BORGCHARGER_OCCUPANT))
UnregisterSignal(wearer, list(COMSIG_ATOM_EXITED, COMSIG_SPECIES_GAIN))
wearer.clear_alert(ALERT_MODSUIT_CHARGE)
SEND_SIGNAL(src, COMSIG_MOD_WEARER_UNSET, wearer)
wearer = null
/obj/item/mod/control/proc/on_species_gain(datum/source, datum/species/new_species, datum/species/old_species)
SIGNAL_HANDLER
var/list/all_parts = mod_parts + src
for(var/obj/item/part in all_parts)
if(!(part.slot_flags in new_species.no_equip) || is_type_in_list(new_species, part.species_exception))
continue
forceMove(drop_location())
return
/obj/item/mod/control/proc/quick_module(mob/user)
if(!length(modules))
return
@@ -598,7 +611,7 @@
toggle_activate(wearer, force_deactivate = TRUE)
/obj/item/mod/control/proc/set_mod_color(new_color)
var/list/all_parts = mod_parts.Copy() + src
var/list/all_parts = mod_parts + src
for(var/obj/item/part as anything in all_parts)
part.remove_atom_colour(WASHABLE_COLOUR_PRIORITY)
part.add_atom_colour(new_color, FIXED_COLOUR_PRIORITY)
@@ -610,7 +623,7 @@
skin = new_skin
var/list/used_skin = theme.skins[new_skin]
alternate_worn_layer = used_skin[CONTROL_LAYER]
var/list/skin_updating = mod_parts.Copy() + src
var/list/skin_updating = mod_parts + src
for(var/obj/item/part as anything in skin_updating)
if(used_skin[MOD_ICON_OVERRIDE])
part.icon = used_skin[MOD_ICON_OVERRIDE]
@@ -637,9 +650,12 @@
part.alternate_worn_layer = category[UNSEALED_LAYER]
mod_parts[part] = part.alternate_worn_layer
if(!category[CAN_OVERSLOT])
if(overslotting_parts[part])
var/obj/item/overslot = overslotting_parts[part]
overslot.forceMove(drop_location())
overslotting_parts -= part
continue
overslotting_parts[part] = null
overslotting_parts |= part
wearer?.regenerate_icons()
/obj/item/mod/control/proc/on_exit(datum/source, atom/movable/part, direction)
@@ -657,7 +673,7 @@
uninstall(part)
return
if(part in mod_parts)
conceal(wearer, part)
retract(wearer, part)
if(active)
INVOKE_ASYNC(src, .proc/toggle_activate, wearer, TRUE)
return
@@ -680,6 +696,13 @@
return
qdel(src)
/obj/item/mod/control/proc/on_overslot_exit(datum/source, atom/movable/overslot, direction)
SIGNAL_HANDLER
if(overslot != overslotting_parts[source])
return
overslotting_parts[source] = null
/obj/item/mod/control/proc/on_potion(atom/movable/source, obj/item/slimepotion/speed/speed_potion, mob/living/user)
SIGNAL_HANDLER