Merge pull request #5518 from Citadel-Station-13/upstream-merge-35679
[MIRROR] Removes on_mob_turn, on_mob_move and intercept_user_move, speeding up movement
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
var/ghetto = FALSE
|
var/ghetto = FALSE
|
||||||
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
|
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
|
||||||
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
|
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
|
||||||
|
var/datum/component/mobhook
|
||||||
|
|
||||||
/obj/item/twohanded/rcl/attackby(obj/item/W, mob/user)
|
/obj/item/twohanded/rcl/attackby(obj/item/W, mob/user)
|
||||||
if(istype(W, /obj/item/stack/cable_coil))
|
if(istype(W, /obj/item/stack/cable_coil))
|
||||||
@@ -84,7 +85,7 @@
|
|||||||
/obj/item/twohanded/rcl/Destroy()
|
/obj/item/twohanded/rcl/Destroy()
|
||||||
QDEL_NULL(loaded)
|
QDEL_NULL(loaded)
|
||||||
last = null
|
last = null
|
||||||
active = FALSE
|
setActive(FALSE, null) // setactive(FALSE) removes mobhook
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/obj/item/twohanded/rcl/update_icon()
|
/obj/item/twohanded/rcl/update_icon()
|
||||||
@@ -115,18 +116,19 @@
|
|||||||
QDEL_NULL(loaded)
|
QDEL_NULL(loaded)
|
||||||
loaded = null
|
loaded = null
|
||||||
unwield(user)
|
unwield(user)
|
||||||
active = wielded
|
setActive(wielded, user)
|
||||||
return TRUE
|
return TRUE
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
/obj/item/twohanded/rcl/dropped(mob/wearer)
|
/obj/item/twohanded/rcl/dropped(mob/wearer)
|
||||||
..()
|
..()
|
||||||
active = FALSE
|
if(mobhook)
|
||||||
|
setActive(FALSE, mobhook.parent)
|
||||||
last = null
|
last = null
|
||||||
|
|
||||||
/obj/item/twohanded/rcl/attack_self(mob/user)
|
/obj/item/twohanded/rcl/attack_self(mob/user)
|
||||||
..()
|
..()
|
||||||
active = wielded
|
setActive(wielded, user)
|
||||||
if(!active)
|
if(!active)
|
||||||
last = null
|
last = null
|
||||||
else if(!last)
|
else if(!last)
|
||||||
@@ -135,9 +137,15 @@
|
|||||||
last = C
|
last = C
|
||||||
break
|
break
|
||||||
|
|
||||||
/obj/item/twohanded/rcl/on_mob_move(direct, mob/user)
|
/obj/item/twohanded/rcl/proc/setActive(toggle, mob/user)
|
||||||
if(active)
|
active = toggle
|
||||||
trigger(user)
|
if (active && user)
|
||||||
|
if (mobhook && mobhook.parent != user)
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
|
if (!mobhook)
|
||||||
|
mobhook = user.AddComponent(/datum/component/redirect, list(COMSIG_MOVABLE_MOVED), CALLBACK(src, .proc/trigger, user))
|
||||||
|
else
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
|
|
||||||
/obj/item/twohanded/rcl/proc/trigger(mob/user)
|
/obj/item/twohanded/rcl/proc/trigger(mob/user)
|
||||||
if(!isturf(user.loc))
|
if(!isturf(user.loc))
|
||||||
@@ -148,7 +156,7 @@
|
|||||||
|
|
||||||
if(prob(2) && ghetto) //Give ghetto RCLs a 2% chance to jam, requiring it to be reactviated manually.
|
if(prob(2) && ghetto) //Give ghetto RCLs a 2% chance to jam, requiring it to be reactviated manually.
|
||||||
to_chat(user, "<span class='warning'>[src]'s wires jam!</span>")
|
to_chat(user, "<span class='warning'>[src]'s wires jam!</span>")
|
||||||
active = FALSE
|
setActive(FALSE, user)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
if(last)
|
if(last)
|
||||||
|
|||||||
@@ -202,15 +202,6 @@
|
|||||||
/obj/proc/check_uplink_validity()
|
/obj/proc/check_uplink_validity()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/obj/proc/on_mob_move(dir, mob, oldLoc, forced)
|
|
||||||
return
|
|
||||||
|
|
||||||
/obj/proc/on_mob_turn(dir, mob)
|
|
||||||
return
|
|
||||||
|
|
||||||
/obj/proc/intercept_user_move(dir, mob, newLoc, oldLoc)
|
|
||||||
return
|
|
||||||
|
|
||||||
/obj/vv_get_dropdown()
|
/obj/vv_get_dropdown()
|
||||||
. = ..()
|
. = ..()
|
||||||
.["Delete all of type"] = "?_src_=vars;[HrefToken()];delall=[REF(src)]"
|
.["Delete all of type"] = "?_src_=vars;[HrefToken()];delall=[REF(src)]"
|
||||||
|
|||||||
@@ -97,16 +97,19 @@
|
|||||||
|
|
||||||
var/atom/movable/cached_pull //recipe for disaster again.
|
var/atom/movable/cached_pull //recipe for disaster again.
|
||||||
var/afterForceMove = FALSE
|
var/afterForceMove = FALSE
|
||||||
|
var/datum/component/mobhook
|
||||||
|
|
||||||
/obj/item/device/flightpack/proc/changeWearer(mob/changeto)
|
/obj/item/device/flightpack/proc/changeWearer(mob/changeto)
|
||||||
if(wearer)
|
if(wearer)
|
||||||
LAZYREMOVE(wearer.user_movement_hooks, src)
|
LAZYREMOVE(wearer.user_movement_hooks, src)
|
||||||
wearer = null
|
wearer = null
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
cached_pull = null
|
cached_pull = null
|
||||||
if(istype(changeto))
|
if(istype(changeto))
|
||||||
wearer = changeto
|
wearer = changeto
|
||||||
LAZYADD(wearer.user_movement_hooks, src)
|
LAZYADD(wearer.user_movement_hooks, src)
|
||||||
cached_pull = changeto.pulling
|
cached_pull = changeto.pulling
|
||||||
|
mobhook = changeto.AddComponent(/datum/component/redirect, list(COMSIG_MOVABLE_MOVED), CALLBACK(src, .proc/on_mob_move, changeto))
|
||||||
|
|
||||||
/obj/item/device/flightpack/Initialize()
|
/obj/item/device/flightpack/Initialize()
|
||||||
ion_trail = new
|
ion_trail = new
|
||||||
@@ -180,6 +183,7 @@
|
|||||||
QDEL_NULL(part_laser)
|
QDEL_NULL(part_laser)
|
||||||
QDEL_NULL(part_bin)
|
QDEL_NULL(part_bin)
|
||||||
QDEL_NULL(ion_trail)
|
QDEL_NULL(ion_trail)
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
STOP_PROCESSING(SSflightpacks, src)
|
STOP_PROCESSING(SSflightpacks, src)
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|
||||||
@@ -205,27 +209,6 @@
|
|||||||
momentum_y = CLAMP(momentum_y + amounty, -momentum_max, momentum_max)
|
momentum_y = CLAMP(momentum_y + amounty, -momentum_max, momentum_max)
|
||||||
calculate_momentum_speed()
|
calculate_momentum_speed()
|
||||||
|
|
||||||
/obj/item/device/flightpack/intercept_user_move(dir, mob, newLoc, oldLoc)
|
|
||||||
if(!flight)
|
|
||||||
return
|
|
||||||
var/momentum_increment = momentum_gain
|
|
||||||
if(boost)
|
|
||||||
momentum_increment = boost_power
|
|
||||||
if(brake)
|
|
||||||
momentum_increment = 0
|
|
||||||
if(!gravity && !pressure)
|
|
||||||
momentum_increment -= 10
|
|
||||||
switch(dir)
|
|
||||||
if(NORTH)
|
|
||||||
adjust_momentum(0, momentum_increment)
|
|
||||||
if(SOUTH)
|
|
||||||
adjust_momentum(0, -momentum_increment)
|
|
||||||
if(EAST)
|
|
||||||
adjust_momentum(momentum_increment, 0)
|
|
||||||
if(WEST)
|
|
||||||
adjust_momentum(-momentum_increment, 0)
|
|
||||||
return ..()
|
|
||||||
|
|
||||||
//The wearer has momentum left. Move them and take some away, while negating the momentum that moving the wearer would gain. Or force the wearer to lose control if they are incapacitated.
|
//The wearer has momentum left. Move them and take some away, while negating the momentum that moving the wearer would gain. Or force the wearer to lose control if they are incapacitated.
|
||||||
/obj/item/device/flightpack/proc/momentum_drift()
|
/obj/item/device/flightpack/proc/momentum_drift()
|
||||||
if(!flight || !wearer || (momentum_speed == 0))
|
if(!flight || !wearer || (momentum_speed == 0))
|
||||||
@@ -252,7 +235,7 @@
|
|||||||
if(prob(emp_damage * 15))
|
if(prob(emp_damage * 15))
|
||||||
step(wearer, pick(GLOB.alldirs))
|
step(wearer, pick(GLOB.alldirs))
|
||||||
|
|
||||||
/obj/item/device/flightpack/on_mob_move(dir, mob/mob, turf/oldLoc, forced)
|
/obj/item/device/flightpack/proc/on_mob_move(mob/mob, turf/oldLoc, dir, forced)
|
||||||
if(forced)
|
if(forced)
|
||||||
if(cached_pull && istype(oldLoc) && (get_dist(oldLoc, loc) <= 1) && !oldLoc.density)
|
if(cached_pull && istype(oldLoc) && (get_dist(oldLoc, loc) <= 1) && !oldLoc.density)
|
||||||
cached_pull.forceMove(oldLoc)
|
cached_pull.forceMove(oldLoc)
|
||||||
@@ -270,7 +253,22 @@
|
|||||||
afterForceMove = FALSE
|
afterForceMove = FALSE
|
||||||
if(flight)
|
if(flight)
|
||||||
ion_trail.generate_effect()
|
ion_trail.generate_effect()
|
||||||
. = ..()
|
var/momentum_increment = momentum_gain
|
||||||
|
if(boost)
|
||||||
|
momentum_increment = boost_power
|
||||||
|
if(brake)
|
||||||
|
momentum_increment = 0
|
||||||
|
if(!gravity && !pressure)
|
||||||
|
momentum_increment -= 10
|
||||||
|
switch(dir)
|
||||||
|
if(NORTH)
|
||||||
|
adjust_momentum(0, momentum_increment)
|
||||||
|
if(SOUTH)
|
||||||
|
adjust_momentum(0, -momentum_increment)
|
||||||
|
if(EAST)
|
||||||
|
adjust_momentum(momentum_increment, 0)
|
||||||
|
if(WEST)
|
||||||
|
adjust_momentum(-momentum_increment, 0)
|
||||||
|
|
||||||
//Make the wearer lose some momentum.
|
//Make the wearer lose some momentum.
|
||||||
/obj/item/device/flightpack/proc/momentum_decay()
|
/obj/item/device/flightpack/proc/momentum_decay()
|
||||||
|
|||||||
@@ -585,6 +585,7 @@
|
|||||||
armor = list("melee" = 30, "bullet" = 5, "laser" = 5, "energy" = 0, "bomb" = 50, "bio" = 100, "rad" = 100, "fire" = 100, "acid" = 75)
|
armor = list("melee" = 30, "bullet" = 5, "laser" = 5, "energy" = 0, "bomb" = 50, "bio" = 100, "rad" = 100, "fire" = 100, "acid" = 75)
|
||||||
item_color = "ancient"
|
item_color = "ancient"
|
||||||
resistance_flags = FIRE_PROOF
|
resistance_flags = FIRE_PROOF
|
||||||
|
var/datum/component/mobhook
|
||||||
|
|
||||||
/obj/item/clothing/suit/space/hardsuit/ancient
|
/obj/item/clothing/suit/space/hardsuit/ancient
|
||||||
name = "prototype RIG hardsuit"
|
name = "prototype RIG hardsuit"
|
||||||
@@ -596,8 +597,9 @@
|
|||||||
helmettype = /obj/item/clothing/head/helmet/space/hardsuit/ancient
|
helmettype = /obj/item/clothing/head/helmet/space/hardsuit/ancient
|
||||||
resistance_flags = FIRE_PROOF
|
resistance_flags = FIRE_PROOF
|
||||||
var/footstep = 1
|
var/footstep = 1
|
||||||
|
var/datum/component/mobhook
|
||||||
|
|
||||||
/obj/item/clothing/suit/space/hardsuit/ancient/on_mob_move()
|
/obj/item/clothing/suit/space/hardsuit/ancient/proc/on_mob_move()
|
||||||
var/mob/living/carbon/human/H = loc
|
var/mob/living/carbon/human/H = loc
|
||||||
if(!istype(H) || H.wear_suit != src)
|
if(!istype(H) || H.wear_suit != src)
|
||||||
return
|
return
|
||||||
@@ -607,6 +609,24 @@
|
|||||||
else
|
else
|
||||||
footstep++
|
footstep++
|
||||||
|
|
||||||
|
/obj/item/clothing/suit/space/hardsuit/ancient/equipped(mob/user, slot)
|
||||||
|
. = ..()
|
||||||
|
if (slot == slot_wear_suit)
|
||||||
|
if (mobhook && mobhook.parent != user)
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
|
if (!mobhook)
|
||||||
|
mobhook = user.AddComponent(/datum/component/redirect, list(COMSIG_MOVABLE_MOVED), CALLBACK(src, .proc/on_mob_move))
|
||||||
|
else
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
|
|
||||||
|
/obj/item/clothing/suit/space/hardsuit/ancient/dropped()
|
||||||
|
. = ..()
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
|
|
||||||
|
/obj/item/clothing/suit/space/hardsuit/ancient/Destroy()
|
||||||
|
QDEL_NULL(mobhook) // mobhook is not our component
|
||||||
|
return ..()
|
||||||
|
|
||||||
/////////////SHIELDED//////////////////////////////////
|
/////////////SHIELDED//////////////////////////////////
|
||||||
|
|
||||||
/obj/item/clothing/suit/space/hardsuit/shielded
|
/obj/item/clothing/suit/space/hardsuit/shielded
|
||||||
|
|||||||
@@ -283,15 +283,17 @@
|
|||||||
var/field_type = /datum/proximity_monitor/advanced/debug
|
var/field_type = /datum/proximity_monitor/advanced/debug
|
||||||
var/operating = FALSE
|
var/operating = FALSE
|
||||||
var/datum/proximity_monitor/advanced/current = null
|
var/datum/proximity_monitor/advanced/current = null
|
||||||
|
var/datum/component/mobhook
|
||||||
|
|
||||||
/obj/item/device/multitool/field_debug/New()
|
/obj/item/device/multitool/field_debug/Initialize()
|
||||||
|
. = ..()
|
||||||
START_PROCESSING(SSobj, src)
|
START_PROCESSING(SSobj, src)
|
||||||
..()
|
|
||||||
|
|
||||||
/obj/item/device/multitool/field_debug/Destroy()
|
/obj/item/device/multitool/field_debug/Destroy()
|
||||||
STOP_PROCESSING(SSobj, src)
|
STOP_PROCESSING(SSobj, src)
|
||||||
QDEL_NULL(current)
|
QDEL_NULL(current)
|
||||||
..()
|
QDEL_NULL(mobhook)
|
||||||
|
return ..()
|
||||||
|
|
||||||
/obj/item/device/multitool/field_debug/proc/setup_debug_field()
|
/obj/item/device/multitool/field_debug/proc/setup_debug_field()
|
||||||
var/list/new_params = field_params.Copy()
|
var/list/new_params = field_params.Copy()
|
||||||
@@ -301,12 +303,18 @@
|
|||||||
/obj/item/device/multitool/field_debug/attack_self(mob/user)
|
/obj/item/device/multitool/field_debug/attack_self(mob/user)
|
||||||
operating = !operating
|
operating = !operating
|
||||||
to_chat(user, "You turn [src] [operating? "on":"off"].")
|
to_chat(user, "You turn [src] [operating? "on":"off"].")
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
if(!istype(current) && operating)
|
if(!istype(current) && operating)
|
||||||
|
mobhook = user.AddComponent(/datum/component/redirect, list(COMSIG_MOVABLE_MOVED), CALLBACK(src, .proc/on_mob_move))
|
||||||
setup_debug_field()
|
setup_debug_field()
|
||||||
else if(!operating)
|
else if(!operating)
|
||||||
QDEL_NULL(current)
|
QDEL_NULL(current)
|
||||||
|
|
||||||
/obj/item/device/multitool/field_debug/on_mob_move()
|
/obj/item/device/multitool/field_debug/dropped()
|
||||||
|
. = ..()
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
|
|
||||||
|
/obj/item/device/multitool/field_debug/proc/on_mob_move()
|
||||||
check_turf(get_turf(src))
|
check_turf(get_turf(src))
|
||||||
|
|
||||||
/obj/item/device/multitool/field_debug/process()
|
/obj/item/device/multitool/field_debug/process()
|
||||||
|
|||||||
@@ -56,13 +56,3 @@
|
|||||||
nutrition -= HUNGER_FACTOR/10
|
nutrition -= HUNGER_FACTOR/10
|
||||||
if(m_intent == MOVE_INTENT_RUN)
|
if(m_intent == MOVE_INTENT_RUN)
|
||||||
nutrition -= HUNGER_FACTOR/10
|
nutrition -= HUNGER_FACTOR/10
|
||||||
|
|
||||||
/mob/living/carbon/Moved(oldLoc, Dir)
|
|
||||||
. = ..()
|
|
||||||
for(var/obj/O in internal_organs)
|
|
||||||
O.on_mob_move(dir, src, oldLoc)
|
|
||||||
|
|
||||||
/mob/living/carbon/setDir(newdir)
|
|
||||||
. = ..()
|
|
||||||
for(var/obj/O in internal_organs)
|
|
||||||
O.on_mob_turn(newdir, src)
|
|
||||||
|
|||||||
@@ -111,25 +111,10 @@
|
|||||||
if(mob.throwing)
|
if(mob.throwing)
|
||||||
mob.throwing.finalize(FALSE)
|
mob.throwing.finalize(FALSE)
|
||||||
|
|
||||||
if(LAZYLEN(mob.user_movement_hooks))
|
|
||||||
for(var/obj/O in mob.user_movement_hooks)
|
|
||||||
O.intercept_user_move(direct, mob, n, oldloc)
|
|
||||||
|
|
||||||
var/atom/movable/P = mob.pulling
|
var/atom/movable/P = mob.pulling
|
||||||
if(P && !ismob(P) && P.density)
|
if(P && !ismob(P) && P.density)
|
||||||
mob.dir = turn(mob.dir, 180)
|
mob.dir = turn(mob.dir, 180)
|
||||||
|
|
||||||
/mob/Moved(oldLoc, dir, Forced = FALSE)
|
|
||||||
. = ..()
|
|
||||||
for(var/obj/O in contents)
|
|
||||||
O.on_mob_move(dir, src, oldLoc, Forced)
|
|
||||||
|
|
||||||
/mob/setDir(newDir)
|
|
||||||
. = ..()
|
|
||||||
for(var/obj/O in contents)
|
|
||||||
O.on_mob_turn(newDir, src)
|
|
||||||
|
|
||||||
|
|
||||||
///Process_Grab()
|
///Process_Grab()
|
||||||
///Called by client/Move()
|
///Called by client/Move()
|
||||||
///Checks to see if you are being grabbed and if so attemps to break it
|
///Checks to see if you are being grabbed and if so attemps to break it
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
var/static/image/drained_overlay = image(icon = 'icons/obj/guns/energy.dmi', icon_state = "esniper_empty")
|
var/static/image/drained_overlay = image(icon = 'icons/obj/guns/energy.dmi', icon_state = "esniper_empty")
|
||||||
|
|
||||||
var/datum/action/item_action/zoom_lock_action/zoom_lock_action
|
var/datum/action/item_action/zoom_lock_action/zoom_lock_action
|
||||||
|
var/datum/component/mobhook
|
||||||
|
|
||||||
/obj/item/gun/energy/beam_rifle/debug
|
/obj/item/gun/energy/beam_rifle/debug
|
||||||
delay = 0
|
delay = 0
|
||||||
@@ -189,6 +190,7 @@
|
|||||||
STOP_PROCESSING(SSfastprocess, src)
|
STOP_PROCESSING(SSfastprocess, src)
|
||||||
set_user(null)
|
set_user(null)
|
||||||
QDEL_LIST(current_tracers)
|
QDEL_LIST(current_tracers)
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/obj/item/gun/energy/beam_rifle/emp_act(severity)
|
/obj/item/gun/energy/beam_rifle/emp_act(severity)
|
||||||
@@ -258,7 +260,7 @@
|
|||||||
delay_penalty(difference * aiming_time_increase_angle_multiplier)
|
delay_penalty(difference * aiming_time_increase_angle_multiplier)
|
||||||
lastangle = angle
|
lastangle = angle
|
||||||
|
|
||||||
/obj/item/gun/energy/beam_rifle/on_mob_move()
|
/obj/item/gun/energy/beam_rifle/proc/on_mob_move()
|
||||||
check_user()
|
check_user()
|
||||||
if(aiming)
|
if(aiming)
|
||||||
delay_penalty(aiming_time_increase_user_movement)
|
delay_penalty(aiming_time_increase_user_movement)
|
||||||
@@ -284,12 +286,14 @@
|
|||||||
if(user == current_user)
|
if(user == current_user)
|
||||||
return
|
return
|
||||||
stop_aiming(current_user)
|
stop_aiming(current_user)
|
||||||
|
QDEL_NULL(mobhook)
|
||||||
if(istype(current_user))
|
if(istype(current_user))
|
||||||
LAZYREMOVE(current_user.mousemove_intercept_objects, src)
|
LAZYREMOVE(current_user.mousemove_intercept_objects, src)
|
||||||
current_user = null
|
current_user = null
|
||||||
if(istype(user))
|
if(istype(user))
|
||||||
current_user = user
|
current_user = user
|
||||||
LAZYADD(current_user.mousemove_intercept_objects, src)
|
LAZYADD(current_user.mousemove_intercept_objects, src)
|
||||||
|
mobhook = user.AddComponent(/datum/component/redirect, list(COMSIG_MOVABLE_MOVED), CALLBACK(src, .proc/on_mob_move))
|
||||||
|
|
||||||
/obj/item/gun/energy/beam_rifle/onMouseDrag(src_object, over_object, src_location, over_location, params, mob)
|
/obj/item/gun/energy/beam_rifle/onMouseDrag(src_object, over_object, src_location, over_location, params, mob)
|
||||||
if(aiming)
|
if(aiming)
|
||||||
|
|||||||
@@ -161,6 +161,7 @@
|
|||||||
var/list/obj/effect/abstract/eye_lighting/eye_lighting
|
var/list/obj/effect/abstract/eye_lighting/eye_lighting
|
||||||
var/obj/effect/abstract/eye_lighting/on_mob
|
var/obj/effect/abstract/eye_lighting/on_mob
|
||||||
var/image/mob_overlay
|
var/image/mob_overlay
|
||||||
|
var/datum/component/mobhook
|
||||||
|
|
||||||
/obj/item/organ/eyes/robotic/glow/Initialize()
|
/obj/item/organ/eyes/robotic/glow/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
@@ -227,15 +228,20 @@
|
|||||||
if(active)
|
if(active)
|
||||||
deactivate(silent = TRUE)
|
deactivate(silent = TRUE)
|
||||||
|
|
||||||
/obj/item/organ/eyes/robotic/glow/on_mob_move()
|
/obj/item/organ/eyes/robotic/glow/Insert(var/mob/living/carbon/M)
|
||||||
if(QDELETED(owner) || !active)
|
. = ..()
|
||||||
return
|
if (mobhook && mobhook.parent != M)
|
||||||
update_visuals()
|
QDEL_NULL(mobhook)
|
||||||
|
if (!mobhook)
|
||||||
|
mobhook = M.AddComponent(/datum/component/redirect, list(COMSIG_ATOM_DIR_CHANGE), CALLBACK(src, .proc/update_visuals))
|
||||||
|
|
||||||
/obj/item/organ/eyes/robotic/glow/on_mob_turn()
|
/obj/item/organ/eyes/robotic/glow/Remove(mob/living/carbon/M)
|
||||||
if(QDELETED(owner) || !active)
|
. = ..()
|
||||||
return
|
QDEL_NULL(mobhook)
|
||||||
update_visuals()
|
|
||||||
|
/obj/item/organ/eyes/robotic/glow/Destroy()
|
||||||
|
QDEL_NULL(mobhook) // mobhook is not our component
|
||||||
|
return ..()
|
||||||
|
|
||||||
/obj/item/organ/eyes/robotic/glow/proc/activate(silent = FALSE)
|
/obj/item/organ/eyes/robotic/glow/proc/activate(silent = FALSE)
|
||||||
start_visuals()
|
start_visuals()
|
||||||
@@ -251,11 +257,13 @@
|
|||||||
active = FALSE
|
active = FALSE
|
||||||
remove_mob_overlay()
|
remove_mob_overlay()
|
||||||
|
|
||||||
/obj/item/organ/eyes/robotic/glow/proc/update_visuals()
|
/obj/item/organ/eyes/robotic/glow/proc/update_visuals(olddir, newdir)
|
||||||
if((LAZYLEN(eye_lighting) < light_beam_distance) || !on_mob)
|
if((LAZYLEN(eye_lighting) < light_beam_distance) || !on_mob)
|
||||||
regenerate_light_effects()
|
regenerate_light_effects()
|
||||||
var/turf/scanfrom = get_turf(owner)
|
var/turf/scanfrom = get_turf(owner)
|
||||||
var/scandir = owner.dir
|
var/scandir = owner.dir
|
||||||
|
if (newdir && scandir != newdir) // COMSIG_ATOM_DIR_CHANGE happens before the dir change, but with a reference to the new direction.
|
||||||
|
scandir = newdir
|
||||||
if(!istype(scanfrom))
|
if(!istype(scanfrom))
|
||||||
clear_visuals()
|
clear_visuals()
|
||||||
var/turf/scanning = scanfrom
|
var/turf/scanning = scanfrom
|
||||||
@@ -320,4 +328,4 @@
|
|||||||
/obj/item/organ/eyes/moth
|
/obj/item/organ/eyes/moth
|
||||||
name = "moth eyes"
|
name = "moth eyes"
|
||||||
desc = "These eyes seem to have increased sensitivity to bright light, with no improvement to low light vision."
|
desc = "These eyes seem to have increased sensitivity to bright light, with no improvement to low light vision."
|
||||||
flash_protect = -1
|
flash_protect = -1
|
||||||
|
|||||||
Reference in New Issue
Block a user