[MIRROR] At first i thought that i was being forced to add a feature 🤮 but then i realized i was being encouraged to refactor 😄. Electrified chair is now a component instead of a failure (#3801)

* At first i thought that i was being forced to add a feature 🤮 but then i realized i was being encouraged to refactor 😄. Electrified chair is now a component instead of a failure (#57117)

* At first i thought that i was being forced to add a feature 🤮 but then i realized i was being encouraged to refactor 😄. Electrified chair is now a component instead of a failure

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
This commit is contained in:
SkyratBot
2021-03-03 14:19:19 +00:00
committed by GitHub
co-authored by Kylerace
parent 0d9d2f6643
commit 6250754697
12 changed files with 303 additions and 79 deletions
@@ -75,23 +75,35 @@
qdel(src)
/obj/structure/chair/attackby(obj/item/W, mob/user, params)
if(W.tool_behaviour == TOOL_WRENCH && !(flags_1&NODECONSTRUCT_1))
W.play_tool_sound(src)
deconstruct()
else if(istype(W, /obj/item/assembly/shock_kit))
if(!user.temporarilyRemoveItemFromInventory(W))
return
var/obj/item/assembly/shock_kit/SK = W
var/obj/structure/chair/e_chair/E = new /obj/structure/chair/e_chair(src.loc)
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE)
E.setDir(dir)
E.part = SK
SK.forceMove(E)
SK.master = E
qdel(src)
else
return ..()
if(flags_1 & NODECONSTRUCT_1)
return . = ..()
if(istype(W, /obj/item/assembly/shock_kit) && !HAS_TRAIT(src, TRAIT_ELECTRIFIED_BUCKLE))
electrify_self(W, user)
return
. = ..()
///allows each chair to request the electrified_buckle component with overlays that dont look ridiculous
/obj/structure/chair/proc/electrify_self(obj/item/assembly/shock_kit/input_shock_kit, mob/user, list/overlays_from_child_procs)
SHOULD_CALL_PARENT(TRUE)
if(!user.temporarilyRemoveItemFromInventory(input_shock_kit))
return
if(!overlays_from_child_procs || overlays_from_child_procs.len == 0)
var/image/echair_over_overlay = image('icons/obj/chairs.dmi', loc, "echair_over")
AddComponent(/datum/component/electrified_buckle, (SHOCK_REQUIREMENT_ITEM | SHOCK_REQUIREMENT_LIVE_CABLE | SHOCK_REQUIREMENT_SIGNAL_RECEIVED_TOGGLE), input_shock_kit, list(echair_over_overlay), FALSE)
else
AddComponent(/datum/component/electrified_buckle, (SHOCK_REQUIREMENT_ITEM | SHOCK_REQUIREMENT_LIVE_CABLE | SHOCK_REQUIREMENT_SIGNAL_RECEIVED_TOGGLE), input_shock_kit, overlays_from_child_procs, FALSE)
if(HAS_TRAIT(src, TRAIT_ELECTRIFIED_BUCKLE))
to_chat(user, "<span class='notice'>You connect the shock kit to the [name], electrifying it </span>")
else
user.put_in_active_hand(input_shock_kit)
to_chat(user, "<span class='notice'> You cannot fit the shock kit onto the [name]!")
/obj/structure/chair/wrench_act(mob/living/user, obj/item/I)
. = ..()
I.play_tool_sound(src)
deconstruct()
/obj/structure/chair/attack_tk(mob/user)
if(!anchored || has_buckled_mobs() || !isturf(user.loc))
@@ -212,6 +224,11 @@
/obj/structure/chair/comfy/shuttle/GetArmrest()
return mutable_appearance('icons/obj/chairs.dmi', "shuttle_chair_armrest")
/obj/structure/chair/comfy/shuttle/electrify_self(obj/item/assembly/shock_kit/input_shock_kit, mob/user, list/overlays_from_child_procs)
if(!overlays_from_child_procs)
overlays_from_child_procs = list(image('icons/obj/chairs.dmi', loc, "echair_over", pixel_x = -1))
. = ..()
/obj/structure/chair/office
anchored = FALSE
buildstackamount = 5
@@ -224,6 +241,11 @@
if(has_gravity())
playsound(src, 'sound/effects/roll.ogg', 100, TRUE)
/obj/structure/chair/office/electrify_self(obj/item/assembly/shock_kit/input_shock_kit, mob/user, list/overlays_from_child_procs)
if(!overlays_from_child_procs)
overlays_from_child_procs = list(image('icons/obj/chairs.dmi', loc, "echair_over", pixel_x = -1))
. = ..()
/obj/structure/chair/office/light
icon_state = "officechair_white"
@@ -10,6 +10,11 @@
armrest = mutable_appearance(icon, "[icon_state]_armrest", ABOVE_MOB_LAYER)
return ..()
/obj/structure/chair/sofa/electrify_self(obj/item/assembly/shock_kit/input_shock_kit, mob/user, list/overlays_from_child_procs)
if(!overlays_from_child_procs)
overlays_from_child_procs = list(image('icons/obj/chairs.dmi', loc, "echair_over", pixel_x = -1))
. = ..()
/obj/structure/chair/sofa/post_buckle_mob(mob/living/M)
. = ..()
update_armrest()
+5 -35
View File
@@ -1,52 +1,22 @@
/obj/structure/chair/e_chair
name = "electric chair"
desc = "Looks absolutely SHOCKING!"
icon_state = "echair0"
var/obj/item/assembly/shock_kit/part = null
var/last_time = 1
item_chair = null
/obj/structure/chair/e_chair/Initialize()
. = ..()
add_overlay(mutable_appearance('icons/obj/chairs.dmi', "echair_over", MOB_LAYER + 1))
var/obj/item/assembly/shock_kit/stored_kit = new(contents)
var/image/export_to_component = image('icons/obj/chairs.dmi', loc, "echair_over")
AddComponent(/datum/component/electrified_buckle, (SHOCK_REQUIREMENT_ITEM | SHOCK_REQUIREMENT_LIVE_CABLE | SHOCK_REQUIREMENT_SIGNAL_RECEIVED_TOGGLE), stored_kit, list(export_to_component))
/obj/structure/chair/e_chair/attackby(obj/item/W, mob/user, params)
if(W.tool_behaviour == TOOL_WRENCH)
var/obj/structure/chair/C = new /obj/structure/chair(loc)
W.play_tool_sound(src)
C.setDir(dir)
part.forceMove(loc)
part.master = null
part = null
qdel(src)
/obj/structure/chair/e_chair/proc/shock()
if(last_time + 50 > world.time)
return
last_time = world.time
// special power handling
var/area/A = get_area(src)
if(!isarea(A))
return
if(!A.powered(AREA_USAGE_EQUIP))
return
A.use_power(AREA_USAGE_EQUIP, 5000)
flick("echair_shock", src)
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(12, 1, src)
s.start()
if(has_buckled_mobs())
for(var/m in buckled_mobs)
var/mob/living/buckled_mob = m
buckled_mob.electrocute_act(85, src, 1)
to_chat(buckled_mob, "<span class='userdanger'>You feel a deep shock course through your body!</span>")
addtimer(CALLBACK(buckled_mob, /mob/living.proc/electrocute_act, 85, src, 1), 1)
visible_message("<span class='danger'>The electric chair went off!</span>", "<span class='hear'>You hear a deep sharp shock!</span>")
/obj/structure/chair/e_chair/post_buckle_mob(mob/living/L)
SEND_SIGNAL(L, COMSIG_ADD_MOOD_EVENT, "dying", /datum/mood_event/deaths_door)
/obj/structure/chair/e_chair/post_unbuckle_mob(mob/living/L)
SEND_SIGNAL(L, COMSIG_CLEAR_MOOD_EVENT, "dying")
. = ..()
+1 -2
View File
@@ -127,8 +127,7 @@
var/obj/item/reagent_containers/RG = I
RG.reagents.add_reagent(/datum/reagent/water, min(RG.volume - RG.reagents.total_volume, RG.amount_per_transfer_from_this))
to_chat(user, "<span class='notice'>You fill [RG] from [src]. Gross.</span>")
else
return ..()
. = ..()
/obj/structure/toilet/secret
var/obj/item/secret