From 7fd313f813ddd3da2ce65a3751e72310eabd76ef Mon Sep 17 00:00:00 2001 From: JJRcop Date: Sun, 9 Dec 2018 04:59:02 -0500 Subject: [PATCH] Chronosuit fixes extracted from #41350 (#41449) cl JJRcop fix: The chronosuit's teleport animation has been fixed, as has the gun. /cl Since #41350 was closed, I extracted the suit fixes without any balance changes, it works again. Fixes #41443 Closes #41446 Known issue: sometimes newly created icons/appearances stop showing up after some use, but return when reconnecting. --- code/game/objects/items/chrono_eraser.dm | 52 ++++++++-------- .../modules/clothing/spacesuits/chronosuit.dm | 60 ++++++++++--------- 2 files changed, 57 insertions(+), 55 deletions(-) diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm index d476827e512..5b212a5b7cf 100644 --- a/code/game/objects/items/chrono_eraser.dm +++ b/code/game/objects/items/chrono_eraser.dm @@ -53,7 +53,7 @@ can_charge = 0 fire_delay = 50 var/obj/item/chrono_eraser/TED = null - var/obj/effect/chrono_field/field = null + var/obj/structure/chrono_field/field = null var/turf/startpos = null /obj/item/gun/energy/chrono_gun/Initialize() @@ -80,12 +80,12 @@ field_disconnect(field) return ..() -/obj/item/gun/energy/chrono_gun/proc/field_connect(obj/effect/chrono_field/F) - var/mob/living/user = src.loc +/obj/item/gun/energy/chrono_gun/proc/field_connect(obj/structure/chrono_field/F) + var/mob/living/user = loc if(F.gun) if(isliving(user) && F.captured) to_chat(user, "FAIL: [F.captured] already has an existing connection.") - src.field_disconnect(F) + field_disconnect(F) else startpos = get_turf(src) field = F @@ -94,9 +94,9 @@ to_chat(user, "Connection established with target: [F.captured]") -/obj/item/gun/energy/chrono_gun/proc/field_disconnect(obj/effect/chrono_field/F) +/obj/item/gun/energy/chrono_gun/proc/field_disconnect(obj/structure/chrono_field/F) if(F && field == F) - var/mob/living/user = src.loc + var/mob/living/user = loc if(F.gun == src) F.gun = null if(isliving(user) && F.captured) @@ -104,7 +104,7 @@ field = null startpos = null -/obj/item/gun/energy/chrono_gun/proc/field_check(obj/effect/chrono_field/F) +/obj/item/gun/energy/chrono_gun/proc/field_check(obj/structure/chrono_field/F) if(F) if(field == F) var/turf/currentpos = get_turf(src) @@ -134,7 +134,7 @@ /obj/item/projectile/energy/chrono_beam/on_hit(atom/target) if(target && gun && isliving(target)) - var/obj/effect/chrono_field/F = new(target.loc, target, gun) + var/obj/structure/chrono_field/F = new(target.loc, target, gun) gun.field_connect(F) @@ -154,14 +154,16 @@ -/obj/effect/chrono_field +/obj/structure/chrono_field name = "eradication field" desc = "An aura of time-bluespace energy." icon = 'icons/effects/effects.dmi' icon_state = "chronofield" density = FALSE anchored = TRUE - blend_mode = BLEND_MULTIPLY + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF + move_resist = INFINITY + interaction_flags_atom = NONE var/mob/living/captured = null var/obj/item/gun/energy/chrono_gun/gun = null var/tickstokill = 15 @@ -169,10 +171,10 @@ var/preloaded = 0 var/RPpos = null -/obj/effect/chrono_field/New(loc, var/mob/living/target, var/obj/item/gun/energy/chrono_gun/G) +/obj/structure/chrono_field/Initialize(mapload, mob/living/target, obj/item/gun/energy/chrono_gun/G) if(target && isliving(target) && G) target.forceMove(src) - src.captured = target + captured = target var/icon/mob_snapshot = getFlatIcon(target) var/icon/cached_icon = new() @@ -187,13 +189,14 @@ desc = initial(desc) + "
It appears to contain [target.name]." START_PROCESSING(SSobj, src) + return ..() -/obj/effect/chrono_field/Destroy() +/obj/structure/chrono_field/Destroy() if(gun && gun.field_check(src)) gun.field_disconnect(src) return ..() -/obj/effect/chrono_field/update_icon() +/obj/structure/chrono_field/update_icon() var/ttk_frame = 1 - (tickstokill / initial(tickstokill)) ttk_frame = CLAMP(CEILING(ttk_frame * CHRONO_FRAME_COUNT, 1), 1, CHRONO_FRAME_COUNT) if(ttk_frame != RPpos) @@ -202,14 +205,14 @@ underlays = list() //hack: BYOND refuses to update the underlay to match the icon_state otherwise underlays += mob_underlay -/obj/effect/chrono_field/process() +/obj/structure/chrono_field/process() if(captured) if(tickstokill > initial(tickstokill)) for(var/atom/movable/AM in contents) AM.forceMove(drop_location()) qdel(src) else if(tickstokill <= 0) - to_chat(captured, "As the last essence of your being is erased from time, you begin to re-experience your most enjoyable memory. You feel happy...") + to_chat(captured, "As the last essence of your being is erased from time, you are taken back to your most enjoyable memory. You feel happy...") var/mob/dead/observer/ghost = captured.ghostize(1) if(captured.mind) if(ghost) @@ -234,7 +237,7 @@ else qdel(src) -/obj/effect/chrono_field/bullet_act(obj/item/projectile/P) +/obj/structure/chrono_field/bullet_act(obj/item/projectile/P) if(istype(P, /obj/item/projectile/energy/chrono_beam)) var/obj/item/projectile/energy/chrono_beam/beam = P var/obj/item/gun/energy/chrono_gun/Pgun = beam.gun @@ -243,10 +246,10 @@ else return 0 -/obj/effect/chrono_field/assume_air() +/obj/structure/chrono_field/assume_air() return 0 -/obj/effect/chrono_field/return_air() //we always have nominal air and temperature +/obj/structure/chrono_field/return_air() //we always have nominal air and temperature var/datum/gas_mixture/GM = new GM.add_gases(/datum/gas/oxygen, /datum/gas/nitrogen) GM.gases[/datum/gas/oxygen][MOLES] = MOLES_O2STANDARD @@ -254,19 +257,16 @@ GM.temperature = T20C return GM -/obj/effect/chrono_field/Move() +/obj/structure/chrono_field/singularity_act() return -/obj/effect/chrono_field/singularity_act() +/obj/structure/chrono_field/singularity_pull() return -/obj/effect/chrono_field/singularity_pull() +/obj/structure/chrono_field/ex_act() return -/obj/effect/chrono_field/ex_act() - return - -/obj/effect/chrono_field/blob_act(obj/structure/blob/B) +/obj/structure/chrono_field/blob_act(obj/structure/blob/B) return diff --git a/code/modules/clothing/spacesuits/chronosuit.dm b/code/modules/clothing/spacesuits/chronosuit.dm index 2298b01f003..b6863ddba46 100644 --- a/code/modules/clothing/spacesuits/chronosuit.dm +++ b/code/modules/clothing/spacesuits/chronosuit.dm @@ -6,7 +6,7 @@ slowdown = 1 armor = list("melee" = 60, "bullet" = 60, "laser" = 60, "energy" = 60, "bomb" = 30, "bio" = 90, "rad" = 90, "fire" = 100, "acid" = 100) resistance_flags = FIRE_PROOF | ACID_PROOF - var/obj/item/clothing/suit/space/chronos/suit = null + var/obj/item/clothing/suit/space/chronos/suit /obj/item/clothing/head/helmet/space/chronos/dropped() if(suit) @@ -28,8 +28,8 @@ resistance_flags = FIRE_PROOF | ACID_PROOF var/list/chronosafe_items = list(/obj/item/chrono_eraser, /obj/item/gun/energy/chrono_gun) var/list/hands_nodrop = list() - var/obj/item/clothing/head/helmet/space/chronos/helmet = null - var/obj/effect/chronos_cam/camera = null + var/obj/item/clothing/head/helmet/space/chronos/helmet + var/obj/effect/chronos_cam/camera var/datum/action/innate/chrono_teleport/teleport_now = new var/activating = 0 var/activated = 0 @@ -37,10 +37,10 @@ var/teleporting = 0 var/phase_timer_id -/obj/item/clothing/suit/space/chronos/New() - ..() +/obj/item/clothing/suit/space/chronos/Initialize() teleport_now.chronosuit = src teleport_now.target = src + return ..() /obj/item/clothing/suit/space/chronos/proc/new_camera(mob/user) if(camera) @@ -48,6 +48,8 @@ camera = new /obj/effect/chronos_cam(user) camera.holder = user camera.chronosuit = src + user.reset_perspective(camera) + user.set_machine(camera) user.remote_control = camera /obj/item/clothing/suit/space/chronos/ui_action_click() @@ -99,9 +101,11 @@ for(var/obj/item/I in user.held_items) if(I in hands_nodrop) I.item_flags &= ~NODROP + hands_nodrop = null if(camera) camera.remove_target_ui() camera.forceMove(user) + user.reset_perspective(camera) teleport_now.UpdateButtonIcon() /obj/item/clothing/suit/space/chronos/proc/chronowalk(atom/location) @@ -147,7 +151,7 @@ /obj/item/clothing/suit/space/chronos/proc/phase_2(mob/living/carbon/human/user, turf/to_turf, phase_in_ds) if(teleporting && activated && user) - animate(user, alpha = 0, time = 2) + animate(user, color = list(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1, 1,1,1,0), time = 2) phase_timer_id = addtimer(CALLBACK(src, .proc/phase_3, user, to_turf, phase_in_ds), 2, TIMER_STOPPABLE) else finish_chronowalk(user, to_turf) @@ -155,7 +159,7 @@ /obj/item/clothing/suit/space/chronos/proc/phase_3(mob/living/carbon/human/user, turf/to_turf, phase_in_ds) if(teleporting && activated && user) user.forceMove(to_turf) - animate(user, alpha = 255, time = phase_in_ds) + animate(user, color = "#00ccee", time = phase_in_ds) phase_timer_id = addtimer(CALLBACK(src, .proc/phase_4, user, to_turf), phase_in_ds, TIMER_STOPPABLE) else finish_chronowalk(user, to_turf) @@ -240,7 +244,7 @@ helmet.suit = null helmet = null if(camera) - qdel(camera) + QDEL_NULL(camera) /obj/effect/chronos_cam name = "Chronosuit View" @@ -249,10 +253,10 @@ invisibility = INVISIBILITY_ABSTRACT opacity = 0 mouse_opacity = MOUSE_OPACITY_TRANSPARENT - var/mob/holder = null + var/mob/holder var/phase_time = 0 var/phase_time_length = 3 - var/obj/screen/chronos_target/target_ui = null + var/obj/screen/chronos_target/target_ui var/obj/item/clothing/suit/space/chronos/chronosuit /obj/effect/chronos_cam/singularity_act() @@ -265,35 +269,33 @@ if(holder && holder.client && chronosuit) if(target_ui) remove_target_ui() - target_ui = new(null, holder) + target_ui = new(src, holder) holder.client.screen += target_ui /obj/effect/chronos_cam/proc/remove_target_ui() if(target_ui) - qdel(target_ui) - target_ui = null + QDEL_NULL(target_ui) /obj/effect/chronos_cam/relaymove(var/mob/user, direction) if(!holder) qdel(src) return if(user == holder) - if(loc == user) - forceMove(get_turf(user)) - if(user.client && user.client.eye != src) - src.forceMove(user.drop_location()) - user.reset_perspective(src) + if(loc == user || (user.client && user.client.eye != src)) + forceMove(user.drop_location()) user.set_machine(src) + user.reset_perspective(src) var/atom/step = get_step(src, direction) if(step) if((step.x <= TRANSITIONEDGE) || (step.x >= (world.maxx - TRANSITIONEDGE - 1)) || (step.y <= TRANSITIONEDGE) || (step.y >= (world.maxy - TRANSITIONEDGE - 1))) - if(!src.Move(step)) - src.forceMove(step) + if(!Move(step)) + forceMove(step) else - src.forceMove(step) + forceMove(step) if((x == holder.x) && (y == holder.y) && (z == holder.z)) - remove_target_ui() forceMove(user) + user.reset_perspective(user) + remove_target_ui() else if(!target_ui) create_target_ui() phase_time = world.time + phase_time_length @@ -301,6 +303,7 @@ /obj/effect/chronos_cam/check_eye(mob/user) if(user != holder) user.unset_machine() + qdel(src) /obj/effect/chronos_cam/on_unset_machine(mob/user) user.reset_perspective(null) @@ -309,23 +312,22 @@ if(holder) if(holder.remote_control == src) holder.remote_control = null - if(holder.client && (holder.client.eye == src)) + if(holder.client && (holder.machine == src)) holder.unset_machine() return ..() /obj/screen/chronos_target name = "target display" screen_loc = "CENTER,CENTER" - color = "#ff3311" - blend_mode = BLEND_SUBTRACT + color = list(1,0,0,0, 0,1,0,0.8, 0,0,1,0.933, 0,0,0,0, 0,0,0,0) + appearance_flags = KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE -/obj/screen/chronos_target/New(loc, var/mob/living/carbon/human/user) +/obj/screen/chronos_target/Initialize(mapload, mob/living/carbon/human/user) if(user) - var/icon/user_icon = getFlatIcon(user) - icon = user_icon - transform = user.transform + vis_contents += user else qdel(src) + return ..() /datum/action/innate/chrono_teleport name = "Teleport Now"