From d600950c56638da26d9f77007457d01bb5bc9fdd Mon Sep 17 00:00:00 2001 From: MarinaGryphon Date: Sat, 31 Aug 2019 13:08:03 -0500 Subject: [PATCH] Circuit Bugfixes (#6930) Fixes a myriad of issues with circuits: Fixes scanners not working with circuit clothing. Fixes buttons etc. not working with circuit clothing. Fixes circuit sensors not working, period. Fixes my accidental deletion of the temperature sensor aspect of the reagent sensor circuit. :'( Fixes circuit gloves and glasses not triggering properly. Makes it so that anchored items cannot be picked up. (Risky? Maybe!) --- code/game/objects/items.dm | 2 +- .../integrated_electronics/core/assemblies.dm | 6 +----- .../core/assemblies/clothing.dm | 20 +++++++++---------- .../integrated_electronics/subtypes/input.dm | 9 +++++---- .../subtypes/manipulation.dm | 2 +- .../subtypes/reagents.dm | 14 ++++++------- html/changelogs/MDP-circfix.yml | 4 ++++ 7 files changed, 27 insertions(+), 30 deletions(-) create mode 100644 html/changelogs/MDP-circfix.yml diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index f0ebefb210a..e7692411b0c 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -157,7 +157,7 @@ return ..(user, distance, "", "It is a [size] item.") /obj/item/attack_hand(mob/user as mob) - if (!user) return + if (!user || anchored) return if (hasorgans(user)) var/mob/living/carbon/human/H = user var/obj/item/organ/external/temp = H.organs_by_name["r_hand"] diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm index 9b4db85b166..a4a77104fdf 100644 --- a/code/modules/integrated_electronics/core/assemblies.dm +++ b/code/modules/integrated_electronics/core/assemblies.dm @@ -232,12 +232,8 @@ IC.assembly = src /obj/item/device/electronic_assembly/afterattack(atom/target, mob/user, proximity) - var/scanned = FALSE for(var/obj/item/integrated_circuit/input/sensor/S in contents) - if(S.sense(target)) - scanned = TRUE - if(scanned) - visible_message("\The [user] waves \the [src] around [target].") + S.sense(target, user) /obj/item/device/electronic_assembly/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/integrated_circuit)) diff --git a/code/modules/integrated_electronics/core/assemblies/clothing.dm b/code/modules/integrated_electronics/core/assemblies/clothing.dm index 29f4667550f..71a9c5cd760 100644 --- a/code/modules/integrated_electronics/core/assemblies/clothing.dm +++ b/code/modules/integrated_electronics/core/assemblies/clothing.dm @@ -53,18 +53,13 @@ /obj/item/clothing/attackby(obj/item/I, mob/user) if(IC) - // This needs to be done in a better way... - if(I.iscrowbar() || I.isscrewdriver() || istype(I, /obj/item/integrated_circuit) || istype(I, /obj/item/weapon/cell) || istype(I, /obj/item/device/integrated_electronics)) - IC.attackby(I, user) + IC.attackby(I, user) else ..() /obj/item/clothing/attack_self(mob/user) if(IC) - if(IC.opened) - IC.attack_self(user) - else - action_circuit.do_work() + IC.attack_self(user) else ..() @@ -92,7 +87,7 @@ // Jumpsuit. /obj/item/clothing/under/circuitry name = "electronic jumpsuit" - desc = "It's a wearable case for electronics. This on is a black jumpsuit with wiring weaved into the fabric." + desc = "It's a wearable case for electronics. This one is a black jumpsuit with wiring weaved into the fabric." icon_state = "circuitry" worn_state = "circuitry" @@ -117,9 +112,10 @@ if(!A || !proximity) return 0 - if(istype(action_circuit) && action_circuit.check_then_do_work()) + if(istype(action_circuit) && action_circuit.check_power()) action_circuit.set_pin_data(IC_OUTPUT, 1, A) action_circuit.push_data() // we have to not return 1 so we can still do normal stuff like picking things up, etc. + action_circuit.activate_pin(1) return 0 // Glasses. @@ -128,7 +124,8 @@ desc = "It's a wearable case for electronics. This one is a pair of goggles, with wiring sticking out. \ Could this augment your vision?" // Sadly it won't, or at least not yet. icon_state = "circuitry" - item_state = "night" // The on-mob sprite would be identical anyways. + item_state = "glasses" + off_state = "denight" /obj/item/clothing/glasses/circuitry/Initialize() setup_integrated_circuit(/obj/item/device/electronic_assembly/clothing/small) @@ -138,9 +135,10 @@ if(!A) return 0 - if(istype(action_circuit) && action_circuit.check_then_do_work()) + if(istype(action_circuit) && action_circuit.check_power()) action_circuit.set_pin_data(IC_OUTPUT, 1, A) action_circuit.push_data() // we have to not return 1 so we can still do normal stuff like picking things up, etc. + action_circuit.activate_pin(1) return 0 // Shoes diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm index af7553391be..ba9da0f62da 100644 --- a/code/modules/integrated_electronics/subtypes/input.dm +++ b/code/modules/integrated_electronics/subtypes/input.dm @@ -189,7 +189,7 @@ power_draw_per_use = 80 /obj/item/integrated_circuit/input/examiner/do_work() - var/atom/movable/H = get_pin_data_as_type(IC_INPUT, 1, /atom/movable) + var/atom/H = get_pin_data_as_type(IC_INPUT, 1, /atom) var/turf/T = get_turf(src) if(!istype(H)) //Invalid input return @@ -497,8 +497,8 @@ spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH power_draw_per_use = 120 -/obj/item/integrated_circuit/input/sensor/proc/sense(var/atom/A) - if(!src.Adjacent(A)) +/obj/item/integrated_circuit/input/sensor/proc/sense(var/atom/A, mob/user) + if(!user.Adjacent(A)) return FALSE var/ignore_bags = get_pin_data(IC_INPUT, 1) if(ignore_bags) @@ -508,6 +508,7 @@ set_pin_data(IC_OUTPUT, 1, A) push_data() activate_pin(1) + user.visible_message(span("notice", "[user] waves [assembly] around [A]."), span("notice", "You scan [A] with [assembly].")) return TRUE /obj/item/integrated_circuit/input/atmo_scanner @@ -918,7 +919,7 @@ return FALSE set_pin_data(IC_OUTPUT, 1, A) push_data() - to_chat(user, "You scan [A] with [assembly].") + user.visible_message(span("notice", "[user] points [assembly] at [A]."), span("notice", "You scan [A] with [assembly].")) activate_pin(1) return TRUE diff --git a/code/modules/integrated_electronics/subtypes/manipulation.dm b/code/modules/integrated_electronics/subtypes/manipulation.dm index 56f31c98df3..332b9629d0b 100644 --- a/code/modules/integrated_electronics/subtypes/manipulation.dm +++ b/code/modules/integrated_electronics/subtypes/manipulation.dm @@ -210,7 +210,7 @@ var/mob/living/M = get_pin_data_as_type(IC_INPUT, 1, /mob/living) if(!istype(M)) //Invalid input return - if(!M.Adjacent(T)) + if(!T.Adjacent(M)) return //Can't reach to_chat(M, "You feel a sharp shock!") spark(get_turf(M), 3, 1) diff --git a/code/modules/integrated_electronics/subtypes/reagents.dm b/code/modules/integrated_electronics/subtypes/reagents.dm index 1a46e3495e7..0f85a316982 100644 --- a/code/modules/integrated_electronics/subtypes/reagents.dm +++ b/code/modules/integrated_electronics/subtypes/reagents.dm @@ -103,16 +103,16 @@ if(isliving(AM)) var/mob/living/L = AM var/turf/T = get_turf(AM) - T.visible_message("[src] is trying to inject [L]!") + T.visible_message("[assembly] is trying to inject [L]!") sleep(3 SECONDS) if(!L.can_be_injected_by(src)) activate_pin(3) return var/contained = reagents.get_reagents() var/trans = reagents.trans_to_mob(L, transfer_amount, CHEM_BLOOD) - message_admins("[src] injected \the [L] with [trans]u of [contained].") + message_admins("[assembly] injected \the [L] with [trans]u of [contained].") to_chat(AM, "You feel a tiny prick!") - visible_message("[src] injects [L]!") + visible_message("[assembly] injects [L]!") else reagents.trans_to(AM, transfer_amount) else @@ -129,7 +129,7 @@ if(!TS.Adjacent(TT)) activate_pin(3) return - var/tramount = Clamp(min(transfer_amount, reagents.maximum_volume - reagents.total_volume), 0, reagents.maximum_volume) + var/tramount = Clamp(min(transfer_amount, reagents.get_free_space()), 0, reagents.maximum_volume) if(ismob(target))//Blood! if(istype(target, /mob/living/carbon)) var/mob/living/carbon/T = target @@ -145,7 +145,6 @@ else activate_pin(3) return - return var/datum/reagent/B if(istype(T, /mob/living/carbon/human)) var/mob/living/carbon/human/H = T @@ -161,7 +160,7 @@ on_reagent_change() reagents.handle_reactions() B = null - visible_message( "Machine takes a blood sample from [target].") + visible_message( "[assembly] takes a blood sample from [target].") else activate_pin(3) return @@ -222,8 +221,7 @@ source = beaker_slot.get_item(FALSE) if(!istype(source) || (!istype(target))) //Invalid input return - var/turf/T = get_turf(src) - if((source.Adjacent(T) || istype(beaker_slot)) && target.Adjacent(T)) + if((src.Adjacent(source) || istype(beaker_slot)) && src.Adjacent(target)) if(!source.reagents || !target.reagents) return if(ismob(source) || ismob(target)) diff --git a/html/changelogs/MDP-circfix.yml b/html/changelogs/MDP-circfix.yml new file mode 100644 index 00000000000..3168f0f9180 --- /dev/null +++ b/html/changelogs/MDP-circfix.yml @@ -0,0 +1,4 @@ +author: MoondancerPony +delete-after: True +changes: + - bugfix: "Fixes a myriad of circuit-related bugs."