mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-09 16:12:17 +00:00
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
134 lines
3.5 KiB
Plaintext
134 lines
3.5 KiB
Plaintext
/obj/structure
|
|
icon = 'icons/obj/structures.dmi'
|
|
w_class = ITEMSIZE_NO_CONTAINER
|
|
blocks_emissive = EMISSIVE_BLOCK_GENERIC
|
|
|
|
var/breakable
|
|
var/parts
|
|
var/block_turf_edges = FALSE // If true, turf edge icons will not be made on the turf this occupies.
|
|
|
|
var/list/connections
|
|
var/list/other_connections
|
|
var/list/blend_objects = null // Objects which to blend with //CHOMPEdit default null
|
|
var/list/noblend_objects = null //Objects to avoid blending with (such as children of listed blend objects. //CHOMPEdit default null
|
|
|
|
/obj/structure/Destroy()
|
|
if(parts)
|
|
new parts(loc)
|
|
return ..()
|
|
|
|
/obj/structure/attack_hand(mob/user)
|
|
if(breakable)
|
|
if(HULK in user.mutations)
|
|
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
|
|
attack_generic(user,1,"smashes")
|
|
else if(ishuman(user))
|
|
var/mob/living/carbon/human/H = user
|
|
if(H.species.can_shred(user))
|
|
attack_generic(user,1,"slices")
|
|
SEND_SIGNAL(src, COMSIG_CLIMBABLE_SHAKE_CLIMBERS, user)
|
|
return ..()
|
|
|
|
/obj/structure/attack_tk()
|
|
return
|
|
|
|
/obj/structure/ex_act(severity)
|
|
switch(severity)
|
|
if(1.0)
|
|
qdel(src)
|
|
return
|
|
if(2.0)
|
|
if(prob(50))
|
|
qdel(src)
|
|
return
|
|
if(3.0)
|
|
return
|
|
|
|
/obj/structure/proc/can_touch(var/mob/user)
|
|
if (!user)
|
|
return 0
|
|
if(!Adjacent(user))
|
|
return 0
|
|
if (user.restrained() || user.buckled)
|
|
to_chat(user, span_notice("You need your hands and legs free for this."))
|
|
return 0
|
|
if (user.stat || user.paralysis || user.sleeping || user.lying || user.weakened)
|
|
return 0
|
|
if (isAI(user))
|
|
to_chat(user, span_notice("You need hands for this."))
|
|
return 0
|
|
return 1
|
|
|
|
/obj/structure/attack_generic(var/mob/user, var/damage, var/attack_verb)
|
|
if(!breakable || damage < STRUCTURE_MIN_DAMAGE_THRESHOLD)
|
|
return 0
|
|
visible_message(span_danger("[user] [attack_verb] the [src] apart!"))
|
|
user.do_attack_animation(src)
|
|
spawn(1) qdel(src)
|
|
return 1
|
|
|
|
/obj/structure/proc/can_visually_connect()
|
|
return anchored
|
|
|
|
/obj/structure/proc/can_visually_connect_to(var/obj/structure/S)
|
|
return istype(S, src)
|
|
|
|
/obj/structure/proc/update_connections(propagate = 0)
|
|
var/list/dirs = list()
|
|
var/list/other_dirs = list()
|
|
|
|
for(var/obj/structure/S in orange(src, 1))
|
|
if(can_visually_connect_to(S))
|
|
if(S.can_visually_connect())
|
|
if(propagate)
|
|
S.update_connections()
|
|
S.update_icon()
|
|
dirs += get_dir(src, S)
|
|
|
|
if(!can_visually_connect())
|
|
connections = list("0", "0", "0", "0")
|
|
other_connections = list("0", "0", "0", "0")
|
|
return FALSE
|
|
|
|
for(var/direction in GLOB.cardinal)
|
|
var/turf/T = get_step(src, direction)
|
|
var/success = 0
|
|
for(var/b_type in blend_objects)
|
|
if(istype(T, b_type))
|
|
success = 1
|
|
if(propagate)
|
|
var/turf/simulated/wall/W = T
|
|
if(istype(W))
|
|
W.update_connections(1)
|
|
if(success)
|
|
break // breaks inner loop
|
|
if(!success)
|
|
blend_obj_loop:
|
|
for(var/obj/O in T)
|
|
for(var/b_type in blend_objects)
|
|
if(istype(O, b_type))
|
|
success = 1
|
|
for(var/obj/structure/S in T)
|
|
if(istype(S, src))
|
|
success = 0
|
|
for(var/nb_type in noblend_objects)
|
|
if(istype(O, nb_type))
|
|
success = 0
|
|
|
|
if(success)
|
|
break blend_obj_loop // breaks outer loop
|
|
|
|
if(success)
|
|
dirs += get_dir(src, T)
|
|
other_dirs += get_dir(src, T)
|
|
|
|
refresh_neighbors()
|
|
|
|
connections = dirs_to_corner_states(dirs)
|
|
other_connections = dirs_to_corner_states(other_dirs)
|
|
return TRUE
|
|
|
|
/obj/structure/proc/refresh_neighbors()
|
|
for(var/turf/T as anything in RANGE_TURFS(1, src))
|
|
T.update_icon()
|