mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Some new Safe loot (#29625)
* safeloot * fix * fix * cleanup * lazy events
This commit is contained in:
@@ -86,6 +86,15 @@
|
||||
// atom/movable/mover: the movable itself.
|
||||
/lazy_event/on_moved
|
||||
|
||||
// Called right before an /atom/movable attempts to move or change dir.
|
||||
/lazy_event/on_before_move
|
||||
|
||||
// Called right after an /atom/movable attempts to move or change dir..
|
||||
/lazy_event/on_after_move
|
||||
|
||||
// Called when an /atom/movable attempts to change dir.
|
||||
/lazy_event/on_face
|
||||
|
||||
// Called whenever a datum is destroyed.
|
||||
// Currently, as an optimization, only /atom/movable invokes this but
|
||||
// it can be changed to /datum if the need arises.
|
||||
|
||||
@@ -388,9 +388,9 @@
|
||||
else if(A.pixel_x < -16)
|
||||
change_dir(WEST)
|
||||
|
||||
StartMoving()
|
||||
Facing()
|
||||
EndMoving()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
lazy_invoke_event(/lazy_event/on_face)
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
return
|
||||
|
||||
if(abs(dx) < abs(dy))
|
||||
@@ -404,9 +404,9 @@
|
||||
else
|
||||
change_dir(WEST)
|
||||
|
||||
StartMoving()
|
||||
Facing()
|
||||
EndMoving()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
lazy_invoke_event(/lazy_event/on_face)
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
|
||||
|
||||
// File renamed to mouse.dm?
|
||||
|
||||
@@ -400,7 +400,7 @@
|
||||
if(M.client)
|
||||
spawn(5)//we give it time to fade out
|
||||
M.client.images -= watcher_maps["\ref[M]"]
|
||||
M.callOnFace -= "\ref[src]"
|
||||
M.lazy_unregister_event(/lazy_event/on_face, src, /obj/structure/cult/altar/proc/checkPosition)
|
||||
animate(watcher_maps["\ref[M]"], alpha = 0, time = 5, easing = LINEAR_EASING)
|
||||
|
||||
watching_mobs = list()
|
||||
@@ -410,7 +410,7 @@
|
||||
if(!(user in watching_mobs))
|
||||
user.client.images -= watcher_maps["\ref[user]"]
|
||||
watcher_maps -= "\ref[user]"
|
||||
user.callOnFace -= "\ref[src]"
|
||||
user.lazy_unregister_event(/lazy_event/on_face, src, /obj/structure/cult/altar/proc/checkPosition)
|
||||
animate(watcher_maps["\ref[user]"], alpha = 0, time = 5, easing = LINEAR_EASING)
|
||||
|
||||
watching_mobs -= user
|
||||
@@ -596,7 +596,7 @@
|
||||
animate(watcher_maps["\ref[user]"], alpha = 255, time = 5, easing = LINEAR_EASING)
|
||||
watching_mobs |= user
|
||||
user.client.images |= watcher_maps["\ref[user]"]
|
||||
user.callOnFace["\ref[src]"] = "checkPosition"
|
||||
user.lazy_register_event(/lazy_event/on_face, src, /obj/structure/cult/altar/proc/checkPosition)
|
||||
if ("Commune with Nar-Sie")
|
||||
switch(veil_thickness)
|
||||
if (CULT_MENDED)
|
||||
@@ -1482,7 +1482,7 @@ var/list/bloodstone_list = list()
|
||||
animate(watcher_maps["\ref[user]"], alpha = 255, time = 5, easing = LINEAR_EASING)
|
||||
watching_mobs |= user
|
||||
user.client.images |= watcher_maps["\ref[user]"]
|
||||
user.callOnFace["\ref[src]"] = "checkPosition"
|
||||
user.lazy_register_event(/lazy_event/on_face, src, /obj/structure/cult/bloodstone/proc/checkPosition)
|
||||
|
||||
/obj/structure/cult/bloodstone/proc/checkPosition()
|
||||
for(var/mob/M in watching_mobs)
|
||||
@@ -1495,7 +1495,7 @@ var/list/bloodstone_list = list()
|
||||
if(M.client)
|
||||
spawn(5)//we give it time to fade out
|
||||
M.client.images -= watcher_maps["\ref[M]"]
|
||||
M.callOnFace -= "\ref[src]"
|
||||
M.lazy_unregister_event(/lazy_event/on_face, src, /obj/structure/cult/bloodstone/proc/checkPosition)
|
||||
animate(watcher_maps["\ref[M]"], alpha = 0, time = 5, easing = LINEAR_EASING)
|
||||
|
||||
watching_mobs = list()
|
||||
@@ -1505,7 +1505,7 @@ var/list/bloodstone_list = list()
|
||||
if(!(user in watching_mobs))
|
||||
user.client.images -= watcher_maps["\ref[user]"]
|
||||
watcher_maps -= "\ref[user]"
|
||||
user.callOnFace -= "\ref[src]"
|
||||
user.lazy_unregister_event(/lazy_event/on_face, src, /obj/structure/cult/bloodstone/proc/checkPosition)
|
||||
animate(watcher_maps["\ref[user]"], alpha = 0, time = 5, easing = LINEAR_EASING)
|
||||
|
||||
watching_mobs -= user
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
/atom/movable/Move(NewLoc, Dir = 0, step_x = 0, step_y = 0, var/glide_size_override = 0)
|
||||
if(!loc || !NewLoc)
|
||||
return 0
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
|
||||
if(current_tethers && current_tethers.len)
|
||||
for(var/datum/tether/master_slave/T in current_tethers)
|
||||
@@ -136,6 +137,7 @@
|
||||
break
|
||||
if(get_exact_dist(T.effective_master, NewLoc) > T.tether_distance)
|
||||
change_dir(Dir)
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
return 0
|
||||
for(var/datum/tether/equal/restrictive/R in current_tethers)
|
||||
var/atom/movable/AM
|
||||
@@ -148,9 +150,11 @@
|
||||
break
|
||||
if(get_exact_dist(AM, NewLoc) > R.tether_distance)
|
||||
change_dir(Dir)
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
return 0
|
||||
if(timestopped)
|
||||
if(!pulledby || pulledby.timestopped) //being moved by our wizard maybe?
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
return 0
|
||||
|
||||
var/can_pull_tether = 0
|
||||
@@ -158,6 +162,7 @@
|
||||
if(tether.attempt_to_follow(src,NewLoc))
|
||||
can_pull_tether = 1
|
||||
else
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
return 0
|
||||
|
||||
if(glide_size_override > 0)
|
||||
@@ -168,6 +173,7 @@
|
||||
. = ..()
|
||||
|
||||
update_dir()
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
return
|
||||
|
||||
//We always split up movements into cardinals for issues with diagonal movements.
|
||||
@@ -209,6 +215,7 @@
|
||||
|
||||
if(!loc || (loc == oldloc && oldloc != NewLoc))
|
||||
last_move = 0
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
return
|
||||
|
||||
update_client_hook(loc)
|
||||
@@ -227,6 +234,7 @@
|
||||
src.move_speed = world.timeofday - src.l_move_time
|
||||
src.l_move_time = world.timeofday
|
||||
lazy_invoke_event(/lazy_event/on_moved, list("mover" = src))
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
|
||||
/atom/movable/search_contents_for(path,list/filter_path=null) // For vehicles
|
||||
var/list/found = ..()
|
||||
@@ -401,6 +409,7 @@
|
||||
|
||||
// harderforce is for things like lighting overlays which should only be moved in EXTREMELY specific sitations.
|
||||
/atom/movable/proc/forceMove(atom/destination,var/no_tp=0, var/harderforce = FALSE, glide_size_override = 0)
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
if(glide_size_override)
|
||||
glide_size = glide_size_override
|
||||
var/atom/old_loc = loc
|
||||
@@ -434,6 +443,7 @@
|
||||
var/turf/T = get_turf(destination)
|
||||
if(old_loc && T && old_loc.z != T.z)
|
||||
lazy_invoke_event(/lazy_event/on_z_transition, list("user" = src, "from_z" = old_loc.z, "to_z" = T.z))
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
return 1
|
||||
|
||||
/atom/movable/proc/update_client_hook(atom/destination)
|
||||
|
||||
@@ -106,7 +106,7 @@ var/list/station_holomaps = list()
|
||||
watching_mob = user
|
||||
flick("station_map_activate", src)
|
||||
watching_mob.client.images |= holomap_datum.station_map
|
||||
watching_mob.callOnFace["\ref[src]"] = "checkPosition"
|
||||
watching_mob.lazy_register_event(/lazy_event/on_face, src, /obj/machinery/station_map/proc/checkPosition)
|
||||
if(bogus)
|
||||
to_chat(user, "<span class='warning'>The holomap failed to initialize. This area of space cannot be mapped.</span>")
|
||||
else
|
||||
@@ -143,7 +143,7 @@ var/list/station_holomaps = list()
|
||||
var/mob/M = watching_mob
|
||||
spawn(5)//we give it time to fade out
|
||||
M.client.images -= holomap_datum.station_map
|
||||
watching_mob.callOnFace -= "\ref[src]"
|
||||
watching_mob.lazy_unregister_event(/lazy_event/on_face, src, /obj/machinery/station_map/proc/checkPosition)
|
||||
watching_mob = null
|
||||
animate(holomap_datum.station_map, alpha = 0, time = 5, easing = LINEAR_EASING)
|
||||
|
||||
@@ -417,7 +417,7 @@ var/list/station_holomaps = list()
|
||||
animate(watcher_maps["\ref[user]"], alpha = 255, time = 5, easing = LINEAR_EASING)
|
||||
watching_mobs |= user
|
||||
user.client.images |= watcher_maps["\ref[user]"]
|
||||
user.callOnFace["\ref[src]"] = "checkPosition"
|
||||
user.lazy_register_event(/lazy_event/on_face, src, /obj/machinery/station_map/proc/checkPosition)
|
||||
to_chat(user, "<span class='notice'>A hologram of the station appears before your eyes.</span>")
|
||||
|
||||
|
||||
@@ -432,7 +432,7 @@ var/list/station_holomaps = list()
|
||||
if(M.client)
|
||||
spawn(5)//we give it time to fade out
|
||||
M.client.images -= watcher_maps["\ref[M]"]
|
||||
M.callOnFace -= "\ref[src]"
|
||||
M.lazy_unregister_event(/lazy_event/on_face, src, /obj/machinery/station_map/proc/checkPosition)
|
||||
animate(watcher_maps["\ref[M]"], alpha = 0, time = 5, easing = LINEAR_EASING)
|
||||
|
||||
watching_mobs = list()
|
||||
@@ -442,7 +442,7 @@ var/list/station_holomaps = list()
|
||||
if(!(user in watching_mobs))
|
||||
user.client.images -= watcher_maps["\ref[user]"]
|
||||
watcher_maps -= "\ref[user]"
|
||||
user.callOnFace -= "\ref[src]"
|
||||
user.lazy_unregister_event(/lazy_event/on_face, src, /obj/machinery/station_map/proc/checkPosition)
|
||||
animate(watcher_maps["\ref[user]"], alpha = 0, time = 5, easing = LINEAR_EASING)
|
||||
|
||||
watching_mobs -= user
|
||||
|
||||
@@ -1453,6 +1453,12 @@ var/global/list/image/blood_overlays = list()
|
||||
/obj/item/proc/is_multitool(var/mob/user)
|
||||
return FALSE
|
||||
|
||||
/obj/item/proc/mannequin_equip(var/obj/structure/mannequin/mannequin,var/slot,var/hand_slot)
|
||||
return
|
||||
|
||||
/obj/item/proc/mannequin_unequip(var/obj/structure/mannequin/mannequin)
|
||||
return
|
||||
|
||||
//This proc will be called when the person holding or equipping it talks.
|
||||
/obj/item/proc/affect_speech(var/datum/speech/speech, var/mob/living/L)
|
||||
return
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
src.pixel_y = rand(-5, 5) * PIXEL_MULTIPLIER
|
||||
|
||||
/obj/item/device/maracas/pickup(mob/user)
|
||||
user.callOnFace["\ref[src]"] = "chickchicky"
|
||||
user.lazy_register_event(/lazy_event/on_face, src, /obj/item/device/maracas/proc/chickchicky)
|
||||
chickchicky()
|
||||
|
||||
/obj/item/device/maracas/throw_impact(atom/hit_atom)
|
||||
@@ -30,7 +30,7 @@
|
||||
qdel(src)
|
||||
|
||||
/obj/item/device/maracas/dropped(mob/user)
|
||||
user.callOnFace -= "\ref[src]"
|
||||
user.lazy_unregister_event(/lazy_event/on_face, src, /obj/item/device/maracas/proc/chickchicky)
|
||||
spawn(3)
|
||||
chickchicky()
|
||||
|
||||
|
||||
@@ -95,17 +95,6 @@
|
||||
..()
|
||||
colorchange()
|
||||
|
||||
/obj/item/clothing/accessory/glowstick/phazon/pickup(mob/user)
|
||||
user.callOnFace |= "\ref[src]"
|
||||
user.callOnFace["\ref[src]"] = "colorchange"
|
||||
|
||||
/obj/item/clothing/accessory/glowstick/phazon/dropped(mob/user)
|
||||
..()
|
||||
user.callOnFace -= "\ref[src]"
|
||||
|
||||
/obj/item/clothing/accessory/glowstick/phazon/attack_self()
|
||||
colorchange()
|
||||
|
||||
/obj/item/clothing/accessory/glowstick/phazon/proc/colorchange()
|
||||
var/r = rand(0, 255)
|
||||
var/g = rand(0, 255)
|
||||
@@ -114,6 +103,16 @@
|
||||
set_light(2, l_color = color)
|
||||
update_icon()
|
||||
|
||||
/obj/item/clothing/accessory/glowstick/phazon/pickup(mob/user)
|
||||
user.lazy_register_event(/lazy_event/on_face, src, /obj/item/clothing/accessory/glowstick/phazon/proc/colorchange)
|
||||
|
||||
/obj/item/clothing/accessory/glowstick/phazon/dropped(mob/user)
|
||||
..()
|
||||
user.lazy_unregister_event(/lazy_event/on_face, src, /obj/item/clothing/accessory/glowstick/phazon/proc/colorchange)
|
||||
|
||||
/obj/item/clothing/accessory/glowstick/phazon/attack_self()
|
||||
colorchange()
|
||||
|
||||
/obj/item/clothing/accessory/glowstick/nanotrasen
|
||||
name = "IAA Identifier"
|
||||
desc = "Provided to Internal Affairs Agents to allow them to distinguish each other during field operations, it emits a subtle green glow."
|
||||
|
||||
@@ -317,12 +317,14 @@ var/global/list/reagents_to_log = list(FUEL, PLASMA, PACID, SACID, AMUTATIONTOXI
|
||||
return qdel(src)
|
||||
|
||||
/obj/singularity_pull(S, current_size)
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
if(anchored)
|
||||
if(current_size >= STAGE_FIVE)
|
||||
anchored = 0
|
||||
step_towards(src, S)
|
||||
else
|
||||
step_towards(src, S)
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
|
||||
/obj/proc/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return "<b>NO MULTITOOL_MENU!</b>"
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
var/trapped_strip = 0//1= Mannequin awakens if you try to strip it or to wrench it.
|
||||
var/chaintrap_range = 0//= Range at which mannequin awakens nearby mannequins when it awakens.
|
||||
|
||||
|
||||
/obj/structure/mannequin/New()
|
||||
..()
|
||||
|
||||
@@ -236,6 +237,7 @@
|
||||
if(!item_in_hand)
|
||||
if(get_held_item_by_index(hand_index))
|
||||
var/obj/item/I = held_items[hand_index]
|
||||
I.mannequin_unequip(src)
|
||||
user.put_in_hands(I)
|
||||
held_items[hand_index] = null
|
||||
to_chat(user, "<span class='info'>You pick up \the [I] from \the [src].</span>")
|
||||
@@ -243,14 +245,17 @@
|
||||
if(get_held_item_by_index(hand_index))
|
||||
if(user.drop_item(item_in_hand,src))
|
||||
var/obj/item/I = held_items[hand_index]
|
||||
I.mannequin_unequip(src)
|
||||
user.put_in_hands(I)
|
||||
held_items[hand_index] = item_in_hand
|
||||
item_in_hand.mannequin_equip(src,"hands",hand_index)
|
||||
to_chat(user, "<span class='info'>You switch \the [item_in_hand] and \the [I] on the [src].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You can't drop that!</span>")
|
||||
else
|
||||
if(user.drop_item(item_in_hand,src))
|
||||
held_items[hand_index] = item_in_hand
|
||||
item_in_hand.mannequin_equip(src,"hands",hand_index)
|
||||
to_chat(user, "<span class='info'>You place \the [item_in_hand] on \the [src].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You can't drop that!</span>")
|
||||
@@ -265,6 +270,7 @@
|
||||
if(!item_in_hand)
|
||||
if(clothing[item_slot])
|
||||
var/obj/item/I = clothing[item_slot]
|
||||
I.mannequin_unequip(src)
|
||||
user.put_in_hands(I)
|
||||
clothing[item_slot] = null
|
||||
add_fingerprint(user)
|
||||
@@ -274,8 +280,10 @@
|
||||
if(canEquip(user, item_slot,item_in_hand))
|
||||
if(user.drop_item(item_in_hand,src))
|
||||
var/obj/item/I = clothing[item_slot]
|
||||
I.mannequin_unequip(src)
|
||||
user.put_in_hands(I)
|
||||
clothing[item_slot] = item_in_hand
|
||||
item_in_hand.mannequin_equip(src,item_slot)
|
||||
add_fingerprint(user)
|
||||
to_chat(user, "<span class='info'>You switch \the [item_in_hand] and \the [I] on the [src].</span>")
|
||||
else
|
||||
@@ -286,6 +294,7 @@
|
||||
if(canEquip(user, item_slot,item_in_hand))
|
||||
if(user.drop_item(item_in_hand,src))
|
||||
clothing[item_slot] = item_in_hand
|
||||
item_in_hand.mannequin_equip(src,item_slot)
|
||||
add_fingerprint(user)
|
||||
to_chat(user, "<span class='info'>You place \the [item_in_hand] on \the [src].</span>")
|
||||
else
|
||||
@@ -315,9 +324,11 @@
|
||||
for(var/cloth in clothing)
|
||||
if(clothing[cloth])
|
||||
var/obj/item/cloth_to_drop = clothing[cloth]
|
||||
cloth_to_drop.mannequin_unequip(src)
|
||||
cloth_to_drop.forceMove(loc)
|
||||
clothing[cloth] = null
|
||||
for(var/obj/item_to_drop in held_items)
|
||||
for(var/obj/item/item_to_drop in held_items)
|
||||
item_to_drop.mannequin_unequip(src)
|
||||
item_to_drop.forceMove(loc)
|
||||
held_items -= item_to_drop
|
||||
qdel(src)
|
||||
@@ -620,7 +631,7 @@
|
||||
SLOT_MANNEQUIN_GLOVES = mapping_gloves,
|
||||
SLOT_MANNEQUIN_EARS = mapping_ears,
|
||||
SLOT_MANNEQUIN_OCLOTHING = mapping_suit,
|
||||
SLOT_MANNEQUIN_EYES = mapping_shoes,
|
||||
SLOT_MANNEQUIN_EYES = mapping_glasses,
|
||||
SLOT_MANNEQUIN_BELT = mapping_belt,
|
||||
SLOT_MANNEQUIN_MASK = mapping_mask,
|
||||
SLOT_MANNEQUIN_HEAD = mapping_hat,
|
||||
@@ -634,21 +645,26 @@
|
||||
var/obj/item/clothToWear = new mapped_cloth(src)
|
||||
if(canEquip(null, mapped_slot, clothToWear))
|
||||
clothing[mapped_slot] = clothToWear
|
||||
clothToWear.mannequin_equip(src,mapped_slot)
|
||||
else
|
||||
qdel(clothToWear)
|
||||
|
||||
if(mapping_hand_right)
|
||||
var/obj/item/clothToWear = new mapping_hand_right(src)
|
||||
held_items[GRASP_RIGHT_HAND] = clothToWear
|
||||
clothToWear.mannequin_equip(src,"hands",GRASP_RIGHT_HAND)
|
||||
if(mapping_hand_left)
|
||||
var/obj/item/clothToWear = new mapping_hand_left(src)
|
||||
held_items[GRASP_LEFT_HAND] = clothToWear
|
||||
clothToWear.mannequin_equip(src,"hands",GRASP_LEFT_HAND)
|
||||
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/structure/mannequin/proc/spin()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
change_dir(turn(dir, 90))
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
|
||||
/obj/structure/mannequin/verb/rotate_mannequin()
|
||||
set name = "Rotate Mannequin"
|
||||
|
||||
@@ -394,11 +394,11 @@
|
||||
_color = "jinglebells"
|
||||
|
||||
/obj/item/clothing/accessory/jinglebells/pickup(mob/user)
|
||||
user.callOnFace["\ref[src]"] = "jingle"
|
||||
user.lazy_register_event(/lazy_event/on_face, src, /obj/item/clothing/accessory/jinglebells/proc/jingle)
|
||||
jingle()
|
||||
|
||||
/obj/item/clothing/accessory/jinglebells/dropped(mob/user)
|
||||
user.callOnFace -= "\ref[src]"
|
||||
user.lazy_unregister_event(/lazy_event/on_face, src, /obj/item/clothing/accessory/jinglebells/proc/jingle)
|
||||
|
||||
/obj/item/clothing/accessory/jinglebells/proc/jingle()
|
||||
var/turf/T = get_turf(src)
|
||||
|
||||
@@ -605,7 +605,7 @@ var/list/science_goggles_wearers = list()
|
||||
item_state = "glasses"
|
||||
origin_tech = Tc_POWERSTORAGE + "=5;" + Tc_MATERIALS + "=3" + Tc_ANOMALY + "=4"
|
||||
species_fit = list(GREY_SHAPED, INSECT_SHAPED)
|
||||
var/mob/living/emitter
|
||||
var/atom/movable/emitter
|
||||
var/obj/effect/beam/emitter/eyes/beam
|
||||
var/previous_dir
|
||||
var/turf/previous_loc
|
||||
@@ -614,7 +614,7 @@ var/list/science_goggles_wearers = list()
|
||||
..()
|
||||
if(slot == slot_glasses)
|
||||
emitter = M
|
||||
enable(emitter)
|
||||
enable()
|
||||
processing_objects.Add(src)
|
||||
|
||||
/obj/item/clothing/glasses/emitter/unequipped(mob/M, from_slot)
|
||||
@@ -622,9 +622,20 @@ var/list/science_goggles_wearers = list()
|
||||
previous_dir = null
|
||||
previous_loc = null
|
||||
if(from_slot == slot_glasses)
|
||||
disable(emitter)
|
||||
disable()
|
||||
processing_objects.Remove(src)
|
||||
|
||||
/obj/item/clothing/glasses/emitter/mannequin_equip(var/obj/structure/mannequin/mannequin,var/slot,var/hand_slot)
|
||||
if(slot == SLOT_MANNEQUIN_EYES)
|
||||
emitter = mannequin
|
||||
enable()
|
||||
processing_objects.Add(src)
|
||||
|
||||
/obj/item/clothing/glasses/emitter/mannequin_unequip(var/obj/structure/mannequin/mannequin)
|
||||
previous_dir = null
|
||||
previous_loc = null
|
||||
disable()
|
||||
processing_objects.Remove(src)
|
||||
|
||||
/obj/item/clothing/glasses/emitter/Destroy()
|
||||
disable(emitter)
|
||||
@@ -633,30 +644,37 @@ var/list/science_goggles_wearers = list()
|
||||
previous_loc = null
|
||||
..()
|
||||
|
||||
/obj/item/clothing/glasses/emitter/proc/enable(mob/living/M)
|
||||
/obj/item/clothing/glasses/emitter/proc/enable()
|
||||
if (istype(emitter))
|
||||
emitter.callOnStartMove["\ref[src]"] = "update_emitter_start"
|
||||
emitter.callOnEndMove["\ref[src]"] = "update_emitter_end"
|
||||
emitter.lazy_register_event(/lazy_event/on_before_move, src, /obj/item/clothing/glasses/emitter/proc/update_emitter_start)
|
||||
emitter.lazy_register_event(/lazy_event/on_after_move, src, /obj/item/clothing/glasses/emitter/proc/update_emitter_end)
|
||||
update_emitter()
|
||||
|
||||
/obj/item/clothing/glasses/emitter/proc/disable(mob/living/M)
|
||||
/obj/item/clothing/glasses/emitter/proc/disable()
|
||||
if (beam)
|
||||
qdel(beam)
|
||||
beam = null
|
||||
if (emitter)
|
||||
emitter.callOnStartMove -= "\ref[src]"
|
||||
emitter.callOnEndMove -= "\ref[src]"
|
||||
emitter.lazy_unregister_event(/lazy_event/on_before_move, src, /obj/item/clothing/glasses/emitter/proc/update_emitter_start)
|
||||
emitter.lazy_unregister_event(/lazy_event/on_after_move, src, /obj/item/clothing/glasses/emitter/proc/update_emitter_end)
|
||||
emitter = null
|
||||
|
||||
/obj/item/clothing/glasses/emitter/process()
|
||||
update_emitter()
|
||||
|
||||
/obj/item/clothing/glasses/emitter/proc/update_emitter()
|
||||
if (!emitter || !isturf(emitter.loc) || emitter.lying)
|
||||
if (!emitter || !isturf(emitter.loc))
|
||||
if (beam)
|
||||
qdel(beam)
|
||||
beam = null
|
||||
return
|
||||
if (ismob(emitter))
|
||||
var/mob/M = emitter
|
||||
if (M.lying)
|
||||
if(beam)
|
||||
qdel(beam)
|
||||
beam = null
|
||||
return
|
||||
if (!beam)
|
||||
beam = new /obj/effect/beam/emitter/eyes(emitter.loc)
|
||||
beam.dir = emitter.dir
|
||||
@@ -673,7 +691,11 @@ var/list/science_goggles_wearers = list()
|
||||
beam = null
|
||||
|
||||
/obj/item/clothing/glasses/emitter/proc/update_emitter_end()
|
||||
if (!emitter || !isturf(emitter.loc) || emitter.lying)
|
||||
if (!emitter || !isturf(emitter.loc))
|
||||
return
|
||||
if (ismob(emitter))
|
||||
var/mob/M = emitter
|
||||
if(M.lying)
|
||||
return
|
||||
if (!beam)
|
||||
beam = new /obj/effect/beam/emitter/eyes(emitter.loc)
|
||||
|
||||
@@ -1183,7 +1183,9 @@
|
||||
/obj/item/weapon/reagent_containers/food/snacks/no_raisin,
|
||||
/obj/item/mounted/frame/painting,
|
||||
/obj/item/weapon/aiModule/randomize,
|
||||
/obj/item/weapon/aiModule/core/hogan
|
||||
/obj/item/weapon/aiModule/core/hogan,
|
||||
/obj/item/weapon/gun/portalgun,
|
||||
/obj/item/clothing/glasses/emitter
|
||||
)
|
||||
|
||||
|
||||
@@ -1232,7 +1234,8 @@
|
||||
/obj/item/weapon/gun/projectile/russian,
|
||||
/obj/item/weapon/gun/mahoguny,
|
||||
/obj/item/weapon/gun/stickybomb,
|
||||
/obj/item/weapon/gun/siren
|
||||
/obj/item/weapon/gun/siren,
|
||||
/obj/item/weapon/gun/portalgun
|
||||
)
|
||||
|
||||
/obj/abstract/map/spawner/safe/clothing
|
||||
@@ -1251,7 +1254,8 @@
|
||||
/obj/item/clothing/gloves/anchor_arms,
|
||||
/obj/item/clothing/suit/space/rig/soviet,
|
||||
/obj/item/clothing/suit/space/rig/nazi,
|
||||
/obj/abstract/spawn_all/dredd_gear
|
||||
/obj/abstract/spawn_all/dredd_gear,
|
||||
/obj/item/clothing/glasses/emitter
|
||||
)
|
||||
|
||||
/obj/abstract/map/spawner/safe/medal
|
||||
|
||||
@@ -81,9 +81,9 @@
|
||||
|
||||
if(prob(33) && canmove && isturf(loc) && !pulledby && !(grabbed_by?.len)) //won't move if being pulled
|
||||
|
||||
StartMoving()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
step(src, pick(cardinal))
|
||||
EndMoving()
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
|
||||
if(prob(1))
|
||||
passive_emote()
|
||||
|
||||
@@ -714,9 +714,9 @@ Thanks.
|
||||
if (ok)
|
||||
var/atom/movable/secondarypull = M.pulling
|
||||
M.stop_pulling()
|
||||
M.StartMoving()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
pulling.Move(T, get_dir(pulling, T), glide_size_override = src.glide_size)
|
||||
M.EndMoving()
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
if(M && secondarypull)
|
||||
M.start_pulling(secondarypull)
|
||||
else
|
||||
@@ -1417,9 +1417,9 @@ Thanks.
|
||||
AM.set_glide_size(src.glide_size)
|
||||
if (ismob(AM))
|
||||
var/mob/M = AM
|
||||
M.StartMoving()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
step(M, t)
|
||||
M.EndMoving()
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
else
|
||||
step(AM, t)
|
||||
now_pushing = 0
|
||||
|
||||
@@ -239,11 +239,11 @@ var/global/list/animal_count = list() //Stores types, and amount of animals of t
|
||||
turns_since_move++
|
||||
if(turns_since_move >= turns_per_move)
|
||||
if(!(stop_automated_movement_when_pulled && pulledby)) //Some animals don't move when pulled
|
||||
StartMoving()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
var/destination = get_step(src, pick(cardinal))
|
||||
wander_move(destination)
|
||||
turns_since_move = 0
|
||||
EndMoving()
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
|
||||
handle_automated_speech()
|
||||
|
||||
|
||||
@@ -1581,10 +1581,10 @@ Use this proc preferably at the end of an equipment loadout
|
||||
if(!canface())
|
||||
return 0
|
||||
if (dir!=direction)
|
||||
StartMoving()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
dir = direction
|
||||
Facing()
|
||||
EndMoving()
|
||||
lazy_invoke_event(/lazy_event/on_face)
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
delayNextMove(movement_delay(),additive=1)
|
||||
return 1
|
||||
|
||||
@@ -1604,48 +1604,11 @@ Use this proc preferably at the end of an equipment loadout
|
||||
set hidden = 1
|
||||
return directionface(SOUTH)
|
||||
|
||||
/mob/proc/Facing()
|
||||
var/datum/listener
|
||||
for(var/atomToCall in src.callOnFace)
|
||||
listener = locate(atomToCall)
|
||||
if(listener)
|
||||
call(listener,src.callOnFace[atomToCall])(src)
|
||||
else
|
||||
src.callOnFace -= atomToCall
|
||||
|
||||
|
||||
//this proc allows to set up behaviours that occur the instant BEFORE the mob starts moving from a tile to the next
|
||||
/mob/proc/StartMoving()
|
||||
var/datum/listener
|
||||
for(var/atomToCall in src.callOnStartMove)
|
||||
listener = locate(atomToCall)
|
||||
if(listener)
|
||||
call(listener,src.callOnStartMove[atomToCall])(src)
|
||||
else
|
||||
src.callOnStartMove -= atomToCall
|
||||
|
||||
|
||||
//this proc allows to set up behaviours that occur the instant AFTER the mob finishes moving from a tile to the next
|
||||
/mob/proc/EndMoving()
|
||||
var/datum/listener
|
||||
for(var/atomToCall in src.callOnEndMove)
|
||||
listener = locate(atomToCall)
|
||||
if(listener)
|
||||
call(listener,src.callOnEndMove[atomToCall])(src)
|
||||
else
|
||||
src.callOnEndMove -= atomToCall
|
||||
|
||||
|
||||
/mob/forceMove(atom/destination,var/no_tp=0, var/harderforce = FALSE, glide_size_override = 0)
|
||||
StartMoving()
|
||||
. = ..()
|
||||
EndMoving()
|
||||
|
||||
//Like forceMove(), but for dirs! used in atoms_movable.dm, mainly with chairs and vehicles
|
||||
/mob/change_dir(new_dir, var/changer)
|
||||
StartMoving()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
..()
|
||||
EndMoving()
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
|
||||
/mob/proc/isGoodPickpocket() //If the mob gets bonuses when pickpocketing and such. Currently only used for humans with the Pickpocket's Gloves.
|
||||
return 0
|
||||
|
||||
@@ -107,9 +107,6 @@
|
||||
//SIZE_BIG for big guys
|
||||
//SIZE_HUGE for even bigger guys
|
||||
|
||||
var/list/callOnFace = list()
|
||||
var/list/callOnStartMove = list()
|
||||
var/list/callOnEndMove = list()
|
||||
var/list/pinned = list() // List of things pinning this creature to walls (see living_defense.dm)
|
||||
var/list/embedded = list() // Embedded items, since simple mobs don't have organs.
|
||||
var/list/abilities = list() // For species-derived or admin-given powers.
|
||||
|
||||
@@ -348,7 +348,7 @@
|
||||
mob.last_move_intent = world.time + 10
|
||||
mob.set_glide_size(DELAY2GLIDESIZE(move_delay)) //Since we're moving OUT OF OUR OWN VOLITION AND BY OURSELVES we can update our glide_size here!
|
||||
|
||||
mob.StartMoving()
|
||||
mob.lazy_invoke_event(/lazy_event/on_before_move)
|
||||
// Something with pulling things
|
||||
var/obj/item/weapon/grab/Findgrab = locate() in mob
|
||||
if(Findgrab)
|
||||
@@ -360,7 +360,7 @@
|
||||
if(M)
|
||||
if ((mob.Adjacent(M) || M.loc == mob.loc))
|
||||
var/turf/T = mob.loc
|
||||
M.StartMoving()
|
||||
M.lazy_invoke_event(/lazy_event/on_before_move)
|
||||
step(mob, Dir)
|
||||
if (isturf(M.loc))
|
||||
var/diag = get_dir(mob, M)
|
||||
@@ -368,7 +368,7 @@
|
||||
diag = null
|
||||
if ((get_dist(mob, M) > 1 || diag))
|
||||
step(M, get_dir(M.loc, T))
|
||||
M.EndMoving()
|
||||
M.lazy_invoke_event(/lazy_event/on_after_move)
|
||||
else
|
||||
for(var/mob/M in L)
|
||||
M.other_mobs = 1
|
||||
@@ -376,9 +376,9 @@
|
||||
M.animate_movement = 3
|
||||
for(var/mob/M in L)
|
||||
spawn( 0 )
|
||||
M.StartMoving()
|
||||
M.lazy_invoke_event(/lazy_event/on_before_move)
|
||||
step(M, dir)
|
||||
M.EndMoving()
|
||||
M.lazy_invoke_event(/lazy_event/on_after_move)
|
||||
return
|
||||
spawn( 1 )
|
||||
M.other_mobs = null
|
||||
@@ -395,8 +395,8 @@
|
||||
mob.last_movement=world.time
|
||||
|
||||
if(mob.dir != old_dir)
|
||||
mob.Facing()
|
||||
mob.EndMoving()
|
||||
mob.lazy_invoke_event(/lazy_event/on_face)
|
||||
mob.lazy_invoke_event(/lazy_event/on_after_move)
|
||||
|
||||
/mob/proc/process_confused(var/Dir)
|
||||
if (confused <= 0)
|
||||
@@ -404,12 +404,12 @@
|
||||
. = TRUE
|
||||
var/old_dir = dir
|
||||
if (confused_intensity == CONFUSED_MAGIC)
|
||||
StartMoving()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
step_rand(src)
|
||||
EndMoving()
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
return
|
||||
|
||||
StartMoving()
|
||||
lazy_invoke_event(/lazy_event/on_before_move)
|
||||
switch(Dir)
|
||||
if(NORTH)
|
||||
step(src, pick(NORTHEAST, NORTHWEST))
|
||||
@@ -427,11 +427,11 @@
|
||||
step(src, pick(SOUTH, EAST))
|
||||
if(SOUTHWEST)
|
||||
step(src, pick(SOUTH, WEST))
|
||||
EndMoving()
|
||||
lazy_invoke_event(/lazy_event/on_after_move)
|
||||
|
||||
last_movement=world.time
|
||||
if(dir != old_dir)
|
||||
Facing()
|
||||
lazy_invoke_event(/lazy_event/on_face)
|
||||
|
||||
///Process_Grab()
|
||||
///Called by client/Move(NewLoc, Dir = 0, step_x = 0, step_y = 0, glide_size_override = 0)
|
||||
@@ -513,7 +513,7 @@
|
||||
mob.dir = direct
|
||||
else
|
||||
to_chat(mob, "<span class='warning'>Some strange aura is blocking the way!</span>")
|
||||
mob.lazy_invoke_event(/lazy_event/on_moved, list("mover" = mob))
|
||||
mob.lazy_invoke_event(/lazy_event/on_moved)
|
||||
mob.delayNextMove(movedelay)
|
||||
return 1
|
||||
// Crossed is always a bit iffy
|
||||
@@ -574,13 +574,15 @@
|
||||
var/mob/mobpulled = target
|
||||
var/atom/movable/secondarypull = mobpulled.pulling
|
||||
mobpulled.stop_pulling()
|
||||
mobpulled.StartMoving()
|
||||
mobpulled.lazy_invoke_event(/lazy_event/on_before_move)
|
||||
step(mobpulled, get_dir(mobpulled.loc, dest))
|
||||
mobpulled.EndMoving()
|
||||
mobpulled.lazy_invoke_event(/lazy_event/on_after_move)
|
||||
if(mobpulled && secondarypull)
|
||||
mobpulled.start_pulling(secondarypull)
|
||||
else
|
||||
target.lazy_invoke_event(/lazy_event/on_before_move)
|
||||
step(target, get_dir(target.loc, dest))
|
||||
target.lazy_invoke_event(/lazy_event/on_after_move)
|
||||
target.add_fingerprint(src)
|
||||
|
||||
/mob/proc/movement_delay()
|
||||
|
||||
@@ -858,8 +858,8 @@
|
||||
/datum/disease2/effect/emitter/activate(var/mob/living/mob)
|
||||
if (istype(mob) && !emitter)
|
||||
emitter = mob
|
||||
emitter.callOnStartMove["\ref[src]"] = "update_emitter_start"
|
||||
emitter.callOnEndMove["\ref[src]"] = "update_emitter_end"
|
||||
emitter.lazy_register_event(/lazy_event/on_before_move, src, /datum/disease2/effect/emitter/proc/update_emitter_start)
|
||||
emitter.lazy_register_event(/lazy_event/on_after_move, src, /datum/disease2/effect/emitter/proc/update_emitter_end)
|
||||
|
||||
if(ishuman(mob))
|
||||
var/mob/living/carbon/human/H = mob
|
||||
@@ -926,8 +926,8 @@
|
||||
qdel(beam)
|
||||
beam = null
|
||||
if (emitter)
|
||||
emitter.callOnStartMove -= "\ref[src]"
|
||||
emitter.callOnEndMove -= "\ref[src]"
|
||||
emitter.lazy_unregister_event(/lazy_event/on_before_move, src, /datum/disease2/effect/emitter/proc/update_emitter_start)
|
||||
emitter.lazy_unregister_event(/lazy_event/on_after_move, src, /datum/disease2/effect/emitter/proc/update_emitter_end)
|
||||
emitter = null
|
||||
previous_dir = null
|
||||
previous_loc = null
|
||||
|
||||
@@ -2194,8 +2194,8 @@
|
||||
#include "code\modules\projectiles\guns\gun_parts.dm"
|
||||
#include "code\modules\projectiles\guns\hookshot.dm"
|
||||
#include "code\modules\projectiles\guns\lawgiver.dm"
|
||||
#include "code\modules\projectiles\guns\portalgun.dm"
|
||||
#include "code\modules\projectiles\guns\projectile.dm"
|
||||
#include "code\modules\projectiles\guns\special.dm"
|
||||
#include "code\modules\projectiles\guns\energy\gravitywell.dm"
|
||||
#include "code\modules\projectiles\guns\energy\laser.dm"
|
||||
#include "code\modules\projectiles\guns\energy\lasmusket.dm"
|
||||
|
||||
Reference in New Issue
Block a user