Skip to content

Commit

Permalink
Merge pull request tgstation#10038 from HippieStation/upstream-pr-826…
Browse files Browse the repository at this point in the history
…2859

[MIRROR] Chronosuit fixes extracted from tgstation#41350
  • Loading branch information
yoyobatty committed Dec 13, 2018
2 parents 1824f88 + df4a356 commit 05c8456
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 55 deletions.
52 changes: 26 additions & 26 deletions code/game/objects/items/chrono_eraser.dm
Expand Up @@ -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()
Expand All @@ -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, "<span class='alert'><b>FAIL: <i>[F.captured]</i> already has an existing connection.</b></span>")
src.field_disconnect(F)
field_disconnect(F)
else
startpos = get_turf(src)
field = F
Expand All @@ -94,17 +94,17 @@
to_chat(user, "<span class='notice'>Connection established with target: <b>[F.captured]</b></span>")


/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)
to_chat(user, "<span class='alert'>Disconnected from target: <b>[F.captured]</b></span>")
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)
Expand Down Expand Up @@ -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)


Expand All @@ -154,25 +154,27 @@



/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
var/mutable_appearance/mob_underlay
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()

Expand All @@ -187,13 +189,14 @@

desc = initial(desc) + "<br><span class='info'>It appears to contain [target.name].</span>"
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)
Expand All @@ -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, "<span class='boldnotice'>As the last essence of your being is erased from time, you begin to re-experience your most enjoyable memory. You feel happy...</span>")
to_chat(captured, "<span class='boldnotice'>As the last essence of your being is erased from time, you are taken back to your most enjoyable memory. You feel happy...</span>")
var/mob/dead/observer/ghost = captured.ghostize(1)
if(captured.mind)
if(ghost)
Expand All @@ -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
Expand All @@ -243,30 +246,27 @@
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
GM.gases[/datum/gas/nitrogen][MOLES] = MOLES_N2STANDARD
GM.temperature = T20C
return GM

/obj/effect/chrono_field/Move()
return

/obj/effect/chrono_field/singularity_act()
/obj/structure/chrono_field/singularity_act()
return

/obj/effect/chrono_field/singularity_pull()
/obj/structure/chrono_field/singularity_pull()
return

/obj/effect/chrono_field/ex_act()
/obj/structure/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


Expand Down
60 changes: 31 additions & 29 deletions code/modules/clothing/spacesuits/chronosuit.dm
Expand Up @@ -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)
Expand All @@ -28,26 +28,28 @@
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
var/cooldowntime = 50 //deciseconds
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)
qdel(camera)
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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -147,15 +151,15 @@

/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)

/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)
Expand Down Expand Up @@ -240,7 +244,7 @@
helmet.suit = null
helmet = null
if(camera)
qdel(camera)
QDEL_NULL(camera)

/obj/effect/chronos_cam
name = "Chronosuit View"
Expand All @@ -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()
Expand All @@ -265,42 +269,41 @@
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

/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)
Expand All @@ -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"
Expand Down

0 comments on commit 05c8456

Please sign in to comment.