Merge pull request #3034 from Citadel-Station-13/upstream-merge-31138
[MIRROR] Structure istype define
This commit is contained in:
@@ -138,6 +138,8 @@
|
|||||||
|
|
||||||
#define isitem(A) (istype(A, /obj/item))
|
#define isitem(A) (istype(A, /obj/item))
|
||||||
|
|
||||||
|
#define isstructure(A) (istype(A, /obj/structure))
|
||||||
|
|
||||||
#define is_cleanable(A) (istype(A, /obj/effect/decal/cleanable) || istype(A, /obj/effect/rune)) //if something is cleanable
|
#define is_cleanable(A) (istype(A, /obj/effect/decal/cleanable) || istype(A, /obj/effect/rune)) //if something is cleanable
|
||||||
|
|
||||||
#define isorgan(A) (istype(A, /obj/item/organ))
|
#define isorgan(A) (istype(A, /obj/item/organ))
|
||||||
@@ -166,9 +168,9 @@ GLOBAL_LIST_INIT(pointed_types, typecacheof(list(
|
|||||||
#define istimer(O) (istype(O, /obj/item/device/assembly/timer))
|
#define istimer(O) (istype(O, /obj/item/device/assembly/timer))
|
||||||
|
|
||||||
GLOBAL_LIST_INIT(glass_sheet_types, typecacheof(list(
|
GLOBAL_LIST_INIT(glass_sheet_types, typecacheof(list(
|
||||||
/obj/item/stack/sheet/glass,
|
/obj/item/stack/sheet/glass,
|
||||||
/obj/item/stack/sheet/rglass,
|
/obj/item/stack/sheet/rglass,
|
||||||
/obj/item/stack/sheet/plasmaglass,
|
/obj/item/stack/sheet/plasmaglass,
|
||||||
/obj/item/stack/sheet/plasmarglass)))
|
/obj/item/stack/sheet/plasmarglass)))
|
||||||
|
|
||||||
#define is_glass_sheet(O) (is_type_in_typecache(O, GLOB.glass_sheet_types))
|
#define is_glass_sheet(O) (is_type_in_typecache(O, GLOB.glass_sheet_types))
|
||||||
|
|||||||
@@ -1,90 +1,90 @@
|
|||||||
//Just new and forget
|
//Just new and forget
|
||||||
/datum/forced_movement
|
/datum/forced_movement
|
||||||
var/atom/movable/victim
|
var/atom/movable/victim
|
||||||
var/atom/target
|
var/atom/target
|
||||||
var/last_processed
|
var/last_processed
|
||||||
var/steps_per_tick
|
var/steps_per_tick
|
||||||
var/allow_climbing
|
var/allow_climbing
|
||||||
var/datum/callback/on_step
|
var/datum/callback/on_step
|
||||||
var/moved_at_all = FALSE
|
var/moved_at_all = FALSE
|
||||||
//as fast as ssfastprocess
|
//as fast as ssfastprocess
|
||||||
/datum/forced_movement/New(atom/movable/_victim, atom/_target, _steps_per_tick = 0.5, _allow_climbing = FALSE, datum/callback/_on_step = null)
|
/datum/forced_movement/New(atom/movable/_victim, atom/_target, _steps_per_tick = 0.5, _allow_climbing = FALSE, datum/callback/_on_step = null)
|
||||||
victim = _victim
|
victim = _victim
|
||||||
target = _target
|
target = _target
|
||||||
steps_per_tick = _steps_per_tick
|
steps_per_tick = _steps_per_tick
|
||||||
allow_climbing = _allow_climbing
|
allow_climbing = _allow_climbing
|
||||||
on_step = _on_step
|
on_step = _on_step
|
||||||
|
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|
||||||
if(_victim && _target && _steps_per_tick && !_victim.force_moving)
|
if(_victim && _target && _steps_per_tick && !_victim.force_moving)
|
||||||
last_processed = world.time
|
last_processed = world.time
|
||||||
_victim.force_moving = src
|
_victim.force_moving = src
|
||||||
START_PROCESSING(SSfastprocess, src)
|
START_PROCESSING(SSfastprocess, src)
|
||||||
else
|
else
|
||||||
qdel(src) //if you want to overwrite the current forced movement, call qdel(victim.force_moving) before creating this
|
qdel(src) //if you want to overwrite the current forced movement, call qdel(victim.force_moving) before creating this
|
||||||
|
|
||||||
/datum/forced_movement/Destroy()
|
/datum/forced_movement/Destroy()
|
||||||
if(victim.force_moving == src)
|
if(victim.force_moving == src)
|
||||||
victim.force_moving = null
|
victim.force_moving = null
|
||||||
if(moved_at_all)
|
if(moved_at_all)
|
||||||
victim.forceMove(victim.loc) //get the side effects of moving here that require us to currently not be force_moving aka reslipping on ice
|
victim.forceMove(victim.loc) //get the side effects of moving here that require us to currently not be force_moving aka reslipping on ice
|
||||||
STOP_PROCESSING(SSfastprocess, src)
|
STOP_PROCESSING(SSfastprocess, src)
|
||||||
victim = null
|
victim = null
|
||||||
target = null
|
target = null
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/datum/forced_movement/process()
|
/datum/forced_movement/process()
|
||||||
if(QDELETED(victim) || !victim.loc || QDELETED(target) || !target.loc)
|
if(QDELETED(victim) || !victim.loc || QDELETED(target) || !target.loc)
|
||||||
qdel(src)
|
qdel(src)
|
||||||
return
|
return
|
||||||
var/steps_to_take = round(steps_per_tick * (world.time - last_processed))
|
var/steps_to_take = round(steps_per_tick * (world.time - last_processed))
|
||||||
if(steps_to_take)
|
if(steps_to_take)
|
||||||
for(var/i in 1 to steps_to_take)
|
for(var/i in 1 to steps_to_take)
|
||||||
if(TryMove())
|
if(TryMove())
|
||||||
moved_at_all = TRUE
|
moved_at_all = TRUE
|
||||||
if(on_step)
|
if(on_step)
|
||||||
on_step.InvokeAsync()
|
on_step.InvokeAsync()
|
||||||
else
|
else
|
||||||
qdel(src)
|
qdel(src)
|
||||||
return
|
return
|
||||||
last_processed = world.time
|
last_processed = world.time
|
||||||
|
|
||||||
/datum/forced_movement/proc/TryMove(recursive = FALSE)
|
/datum/forced_movement/proc/TryMove(recursive = FALSE)
|
||||||
var/atom/movable/vic = victim //sanic
|
var/atom/movable/vic = victim //sanic
|
||||||
var/atom/tar = target
|
var/atom/tar = target
|
||||||
|
|
||||||
if(!recursive)
|
if(!recursive)
|
||||||
. = step_towards(vic, tar)
|
. = step_towards(vic, tar)
|
||||||
|
|
||||||
//shit way for getting around corners
|
//shit way for getting around corners
|
||||||
if(!.)
|
if(!.)
|
||||||
if(tar.x > vic.x)
|
if(tar.x > vic.x)
|
||||||
if(step(vic, EAST))
|
if(step(vic, EAST))
|
||||||
. = TRUE
|
. = TRUE
|
||||||
else if(tar.x < vic.x)
|
else if(tar.x < vic.x)
|
||||||
if(step(vic, WEST))
|
if(step(vic, WEST))
|
||||||
. = TRUE
|
. = TRUE
|
||||||
|
|
||||||
if(!.)
|
if(!.)
|
||||||
if(tar.y > vic.y)
|
if(tar.y > vic.y)
|
||||||
if(step(vic, NORTH))
|
if(step(vic, NORTH))
|
||||||
. = TRUE
|
. = TRUE
|
||||||
else if(tar.y < vic.y)
|
else if(tar.y < vic.y)
|
||||||
if(step(vic, SOUTH))
|
if(step(vic, SOUTH))
|
||||||
. = TRUE
|
. = TRUE
|
||||||
|
|
||||||
if(!.)
|
if(!.)
|
||||||
if(recursive)
|
if(recursive)
|
||||||
return FALSE
|
return FALSE
|
||||||
else
|
else
|
||||||
. = TryMove(TRUE)
|
. = TryMove(TRUE)
|
||||||
|
|
||||||
. = . && (vic.loc != tar.loc)
|
. = . && (vic.loc != tar.loc)
|
||||||
|
|
||||||
/mob/Collide(atom/A)
|
/mob/Collide(atom/A)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(force_moving && force_moving.allow_climbing && istype(A, /obj/structure))
|
if(force_moving && force_moving.allow_climbing && isstructure(A))
|
||||||
var/obj/structure/S = A
|
var/obj/structure/S = A
|
||||||
if(S.climbable)
|
if(S.climbable)
|
||||||
S.do_climb(src)
|
S.do_climb(src)
|
||||||
|
|||||||
@@ -320,7 +320,7 @@
|
|||||||
for(var/atm in A)
|
for(var/atm in A)
|
||||||
if(!is_type_in_typecache(atm, ctf_object_typecache))
|
if(!is_type_in_typecache(atm, ctf_object_typecache))
|
||||||
qdel(atm)
|
qdel(atm)
|
||||||
if(istype(atm, /obj/structure))
|
if(isstructure(atm))
|
||||||
var/obj/structure/S = atm
|
var/obj/structure/S = atm
|
||||||
S.obj_integrity = S.max_integrity
|
S.obj_integrity = S.max_integrity
|
||||||
|
|
||||||
|
|||||||
@@ -667,7 +667,7 @@
|
|||||||
equip_to_appropriate_slot(MYID)
|
equip_to_appropriate_slot(MYID)
|
||||||
//THIEVING SKILLS END
|
//THIEVING SKILLS END
|
||||||
//-------------TOUCH ME
|
//-------------TOUCH ME
|
||||||
if(istype(TARGET, /obj/structure))
|
if(isstructure(TARGET))
|
||||||
var/obj/structure/STR = TARGET
|
var/obj/structure/STR = TARGET
|
||||||
if(main_hand)
|
if(main_hand)
|
||||||
var/obj/item/W = main_hand
|
var/obj/item/W = main_hand
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
else
|
else
|
||||||
visible_message("<span class='notice'>[src] avoids getting crushed.</span>")
|
visible_message("<span class='notice'>[src] avoids getting crushed.</span>")
|
||||||
else
|
else
|
||||||
if(istype(AM, /obj/structure))
|
if(isstructure(AM))
|
||||||
if(prob(squish_chance))
|
if(prob(squish_chance))
|
||||||
AM.visible_message("<span class='notice'>[src] was crushed under [AM].</span>")
|
AM.visible_message("<span class='notice'>[src] was crushed under [AM].</span>")
|
||||||
adjustBruteLoss(1)
|
adjustBruteLoss(1)
|
||||||
|
|||||||
@@ -275,7 +275,7 @@
|
|||||||
if(O.anchored)
|
if(O.anchored)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if(isitem(O) || istype(O, /obj/structure) || istype(O, /obj/machinery))
|
if(isitem(O) || isstructure(O) || istype(O, /obj/machinery))
|
||||||
cocoon_target = O
|
cocoon_target = O
|
||||||
busy = MOVING_TO_TARGET
|
busy = MOVING_TO_TARGET
|
||||||
stop_automated_movement = 1
|
stop_automated_movement = 1
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca
|
|||||||
faction |= "\ref[owner]"
|
faction |= "\ref[owner]"
|
||||||
|
|
||||||
/mob/living/simple_animal/hostile/mimic/copy/proc/CheckObject(obj/O)
|
/mob/living/simple_animal/hostile/mimic/copy/proc/CheckObject(obj/O)
|
||||||
if((isitem(O) || istype(O, /obj/structure)) && !is_type_in_list(O, GLOB.protected_objects))
|
if((isitem(O) || isstructure(O)) && !is_type_in_list(O, GLOB.protected_objects))
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca
|
|||||||
icon_living = icon_state
|
icon_living = icon_state
|
||||||
copy_overlays(O)
|
copy_overlays(O)
|
||||||
add_overlay(googly_eyes)
|
add_overlay(googly_eyes)
|
||||||
if(istype(O, /obj/structure) || istype(O, /obj/machinery))
|
if(isstructure(O) || istype(O, /obj/machinery))
|
||||||
health = (anchored * 50) + 50
|
health = (anchored * 50) + 50
|
||||||
destroy_objects = 1
|
destroy_objects = 1
|
||||||
if(O.density && O.anchored)
|
if(O.density && O.anchored)
|
||||||
|
|||||||
@@ -57,8 +57,8 @@
|
|||||||
/obj/machinery/field/containment/Crossed(mob/mover)
|
/obj/machinery/field/containment/Crossed(mob/mover)
|
||||||
if(isliving(mover))
|
if(isliving(mover))
|
||||||
shock(mover)
|
shock(mover)
|
||||||
|
|
||||||
if(istype(mover, /obj/machinery) || istype(mover, /obj/structure) || istype(mover, /obj/mecha))
|
if(istype(mover, /obj/machinery) || isstructure(mover) || istype(mover, /obj/mecha))
|
||||||
bump_field(mover)
|
bump_field(mover)
|
||||||
|
|
||||||
/obj/machinery/field/containment/proc/set_master(master1,master2)
|
/obj/machinery/field/containment/proc/set_master(master1,master2)
|
||||||
@@ -90,13 +90,13 @@
|
|||||||
if(isliving(mover))
|
if(isliving(mover))
|
||||||
shock(mover)
|
shock(mover)
|
||||||
return
|
return
|
||||||
if(istype(mover, /obj/machinery) || istype(mover, /obj/structure) || istype(mover, /obj/mecha))
|
if(istype(mover, /obj/machinery) || isstructure(mover) || istype(mover, /obj/mecha))
|
||||||
bump_field(mover)
|
bump_field(mover)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
/obj/machinery/field/CanPass(atom/movable/mover, turf/target)
|
/obj/machinery/field/CanPass(atom/movable/mover, turf/target)
|
||||||
if(hasShocked || isliving(mover) || istype(mover, /obj/machinery) || istype(mover, /obj/structure) || istype(mover, /obj/mecha))
|
if(hasShocked || isliving(mover) || istype(mover, /obj/machinery) || isstructure(mover) || istype(mover, /obj/mecha))
|
||||||
return FALSE
|
return FALSE
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
|
|||||||
@@ -244,7 +244,7 @@
|
|||||||
else if(closest_blob)
|
else if(closest_blob)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
else if(istype(A, /obj/structure))
|
else if(isstructure(A))
|
||||||
var/obj/structure/S = A
|
var/obj/structure/S = A
|
||||||
var/dist = get_dist(source, A)
|
var/dist = get_dist(source, A)
|
||||||
if(dist <= zap_range && (dist < closest_dist || !closest_tesla_coil) && !S.being_shocked)
|
if(dist <= zap_range && (dist < closest_dist || !closest_tesla_coil) && !S.being_shocked)
|
||||||
|
|||||||
@@ -295,7 +295,7 @@
|
|||||||
..()
|
..()
|
||||||
|
|
||||||
/atom/proc/animate_atom_living(var/mob/living/owner = null)
|
/atom/proc/animate_atom_living(var/mob/living/owner = null)
|
||||||
if((isitem(src) || istype(src, /obj/structure)) && !is_type_in_list(src, GLOB.protected_objects))
|
if((isitem(src) || isstructure(src)) && !is_type_in_list(src, GLOB.protected_objects))
|
||||||
if(istype(src, /obj/structure/statue/petrified))
|
if(istype(src, /obj/structure/statue/petrified))
|
||||||
var/obj/structure/statue/petrified/P = src
|
var/obj/structure/statue/petrified/P = src
|
||||||
if(P.petrified_mob)
|
if(P.petrified_mob)
|
||||||
|
|||||||
Reference in New Issue
Block a user