Hitby refactor (#19624)

Refactored hitby to be in line with TG's version.
Refactored item weight defines to a more clear naming scheme, also in
line with TG's version.
Refactored how the movement bumps are handled, ported signals to handle
them, in preparation for the movement update.
Fixed disposal hit bouncing the hitting atom on the wall.
Items do not push other items anymore if they are tiny.
This commit is contained in:
Fluffy
2024-07-28 20:52:08 +00:00
committed by GitHub
parent b84acb8e03
commit a3a4d46fa7
510 changed files with 2282 additions and 1584 deletions
+18 -8
View File
@@ -20,7 +20,7 @@ LINEN BINS
throwforce = 1
throw_speed = 1
throw_range = 2
w_class = ITEMSIZE_LARGE
w_class = WEIGHT_CLASS_BULKY
drop_sound = 'sound/items/drop/cloth.ogg'
pickup_sound = 'sound/items/pickup/cloth.ogg'
randpixel = 0
@@ -30,6 +30,14 @@ LINEN BINS
var/inuse = FALSE
var/inside_storage_item = FALSE
/obj/item/bedsheet/Initialize()
. = ..()
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/item/bedsheet/afterattack(atom/A, mob/user)
if(istype(A, /obj/structure/bed))
user.drop_item()
@@ -89,9 +97,11 @@ LINEN BINS
else
icon_state = initial(icon_state)
/obj/item/bedsheet/Crossed(H as mob) //Basically, stepping on it resets it to below people.
if(isliving(H))
var/mob/living/M = H
/obj/item/bedsheet/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
SIGNAL_HANDLER
if(isliving(arrived))
var/mob/living/M = arrived
if(M.loc == src.loc)
return
else
@@ -124,12 +134,12 @@ LINEN BINS
if(!fold)
fold = TRUE
slot_flags = null
w_class = ITEMSIZE_SMALL
w_class = WEIGHT_CLASS_SMALL
layer = reset_plane_and_layer()
else
fold = FALSE
slot_flags = SLOT_BACK
w_class = ITEMSIZE_LARGE
w_class = WEIGHT_CLASS_BULKY
update_icon()
inuse = FALSE
return TRUE
@@ -158,14 +168,14 @@ LINEN BINS
if(!roll)
roll = TRUE
slot_flags = null
w_class = ITEMSIZE_NORMAL
w_class = WEIGHT_CLASS_NORMAL
layer = reset_plane_and_layer()
if(user.resting && get_turf(src) == get_turf(user)) // Make them rest
user.lay_down()
else
roll = FALSE
slot_flags = SLOT_BACK
w_class = ITEMSIZE_LARGE
w_class = WEIGHT_CLASS_BULKY
if(layer == initial(layer))
layer = ABOVE_HUMAN_LAYER
if(!user.resting && get_turf(src) == get_turf(user)) // Make them get up
+10 -3
View File
@@ -28,6 +28,12 @@ GLOBAL_LIST_EMPTY(total_active_bonfires)
fuel = rand(1000, 2000)
create_reagents(120)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/bonfire/Destroy()
STOP_PROCESSING(SSprocessing, src)
GLOB.total_active_bonfires -= src
@@ -293,10 +299,11 @@ GLOBAL_LIST_EMPTY(total_active_bonfires)
var/heat_eff = fuel / max_fuel //Less fuel, less heat provided
H.bodytemperature = min(H.bodytemperature + (abs((temp_adj * heat_eff)) / heating_div), 311)
/obj/structure/bonfire/Crossed(AM as mob|obj)
/obj/structure/bonfire/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
SIGNAL_HANDLER
if(on_fire)
burn(AM, TRUE)
..()
burn(arrived, TRUE)
/obj/structure/bonfire/proc/burn(var/mob/living/M, var/entered = FALSE)
if(safe)
@@ -813,7 +813,7 @@
icon_state = "cratescanner"
item_state = "cratescanner"
matter = list(DEFAULT_WALL_MATERIAL = 250, MATERIAL_GLASS = 140)
w_class = ITEMSIZE_SMALL
w_class = WEIGHT_CLASS_SMALL
obj_flags = OBJ_FLAG_CONDUCTABLE
slot_flags = SLOT_BELT
@@ -10,7 +10,7 @@
icon_state = "construction"
anchored = FALSE
density = TRUE
w_class = ITEMSIZE_HUGE
w_class = WEIGHT_CLASS_HUGE
build_amt = 4
obj_flags = OBJ_FLAG_ROTATABLE|OBJ_FLAG_MOVES_UNSUPPORTED
pixel_x = -16
@@ -168,11 +168,11 @@
has_grille_installed = TRUE
return
/obj/structure/window_frame/hitby(atom/movable/AM, speed)
/obj/structure/window_frame/hitby(atom/movable/hitting_atom, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
. = ..()
var/obj/structure/window/W = locate() in get_turf(src)
if(istype(W))
W.hitby(AM)
W.hitby(arglist(args))
/obj/structure/window_frame/wood
color = "#8f5847"
+11 -5
View File
@@ -11,14 +11,20 @@
if(prob(50))
icon_state = "geyser_plume"
/obj/structure/geyser/Crossed(AM as mob|obj, var/ignore_deployment = FALSE)
if(ishuman(AM))
var/mob/living/carbon/human/L = AM
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/geyser/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
SIGNAL_HANDLER
if(ishuman(arrived))
var/mob/living/carbon/human/L = arrived
if(prob(50))
trigger(L)
..()
/obj/structure/geyser/proc/trigger(mob/living/carbon/human/L)
visible_message(SPAN_WARNING("\The [src] spews a cloud of hot steam!"))
flick("geyser_fire", src)
+1 -1
View File
@@ -8,7 +8,7 @@
anchored = 1
density = 1
layer = BELOW_OBJ_LAYER
w_class = ITEMSIZE_HUGE
w_class = WEIGHT_CLASS_HUGE
obj_flags = OBJ_FLAG_MOVES_UNSUPPORTED
pass_flags_self = PASSTABLE
var/state = 0
+5 -5
View File
@@ -49,15 +49,15 @@
health -= 25
healthcheck()
/obj/structure/gore/hitby(atom/movable/AM, var/speed = THROWFORCE_SPEED_DIVISOR)
/obj/structure/gore/hitby(atom/movable/hitting_atom, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
. = ..()
visible_message(SPAN_WARNING("\The [src] was hit by \the [AM]."))
visible_message(SPAN_WARNING("\The [src] was hit by \the [hitting_atom]."))
playsound(loc, 'sound/effects/attackblob.ogg', 100, TRUE)
var/throw_force = 0
if(isobj(AM))
var/obj/O = AM
if(isobj(hitting_atom))
var/obj/O = hitting_atom
throw_force = O.throwforce
else if(ismob(AM))
else if(ismob(hitting_atom))
throw_force = 10
health -= throw_force
healthcheck()
+1 -1
View File
@@ -327,7 +327,7 @@
/obj/structure/grille/crescent/ex_act(var/severity = 2.0)
return
/obj/structure/grille/crescent/hitby()
/obj/structure/grille/crescent/hitby(atom/movable/hitting_atom, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
return
/obj/structure/grille/crescent/bullet_act()
+1 -1
View File
@@ -3,7 +3,7 @@
desc = "The central core of the Hivebot Secondary Transmitter Drone - all that remains after the machine's destruction. Perhaps some data as to the threat can be gleaned from this?"
icon = 'icons/obj/structure/hivebot_head.dmi'
icon_state = "hivebot_head"
w_class = ITEMSIZE_LARGE
w_class = WEIGHT_CLASS_BULKY
breakable = FALSE
climbable = FALSE
density = FALSE
+2 -2
View File
@@ -4,7 +4,7 @@
/obj/item/inflatable
name = "inflatable"
desc_info = "Inflate by using it in your hand. The inflatable barrier will inflate on the turf you are standing on. To deflate it, use the 'deflate' verb."
w_class = ITEMSIZE_SMALL
w_class = WEIGHT_CLASS_SMALL
icon = 'icons/obj/item/inflatables.dmi'
var/deploy_path = null
@@ -286,7 +286,7 @@
icon_state = "inf_box"
item_state = "inf_box"
contained_sprite = TRUE
w_class = ITEMSIZE_NORMAL
w_class = WEIGHT_CLASS_NORMAL
display_contents_with_number = TRUE
max_storage_space = 28
force_column_number = 3 // we want 4 slots to appear, so 3 columns + 1 free (to insert stuff)
+1 -1
View File
@@ -7,7 +7,7 @@
icon_state = "lattice"
density = FALSE
anchored = TRUE
w_class = ITEMSIZE_NORMAL
w_class = WEIGHT_CLASS_NORMAL
layer = ABOVE_TILE_LAYER
obj_flags = OBJ_FLAG_MOVES_UNSUPPORTED
smoothing_flags = SMOOTH_MORE
+1 -1
View File
@@ -175,7 +175,7 @@
desc = "A SalonPro Nano-Mirror(TM) brand mirror! Now a portable version."
icon = 'icons/obj/cosmetics.dmi'
icon_state = "mirror"
w_class = ITEMSIZE_SMALL
w_class = WEIGHT_CLASS_SMALL
/obj/item/mirror/attack_self(mob/user as mob)
if(user.mind)
+1 -1
View File
@@ -4,7 +4,7 @@
icon = 'icons/obj/janitor.dmi'
icon_state = "mopbucket"
density = 1
w_class = ITEMSIZE_NORMAL
w_class = WEIGHT_CLASS_NORMAL
atom_flags = ATOM_FLAG_OPEN_CONTAINER
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite
var/bucketsize = 600 //about 2x the size relative to a regular bucket.
+1 -1
View File
@@ -75,4 +75,4 @@
desc = "An archaic key, probably not used to open any airlock on station."
icon = 'icons/obj/xenoarchaeology.dmi'
icon_state = "unknown1"
w_class = ITEMSIZE_SMALL
w_class = WEIGHT_CLASS_SMALL
+5 -5
View File
@@ -10,7 +10,7 @@
density = FALSE
opacity = FALSE
layer = ABOVE_WINDOW_LAYER
w_class = ITEMSIZE_NORMAL
w_class = WEIGHT_CLASS_NORMAL
obj_flags = OBJ_FLAG_MOVES_UNSUPPORTED
/obj/structure/sign/ex_act(severity)
@@ -36,7 +36,7 @@
name = "sign"
desc = "A sign."
icon = 'icons/obj/signs.dmi'
w_class = ITEMSIZE_HUGE
w_class = WEIGHT_CLASS_HUGE
var/sign_state = ""
/obj/item/sign/attackby(obj/item/attacking_item, mob/user) // Construction.
@@ -353,19 +353,19 @@
name = "empty frame"
desc = "An empty painting frame."
icon_state = "painting_frame"
w_class = ITEMSIZE_SMALL
w_class = WEIGHT_CLASS_SMALL
/obj/item/sign/painting_frame
name = "empty frame"
desc = "An empty painting frame."
icon_state = "painting_frame"
w_class = ITEMSIZE_SMALL
w_class = WEIGHT_CLASS_SMALL
/obj/structure/sign/painting_frame/tsunami_kami
name = "tsunami kami"
desc = "A painting designed to replicate traditional woodblock styles. This one seems to be based off an ancient and venerable painting of a wave, paired with that of a woman."
icon_state = "tsunami_kami"
w_class = ITEMSIZE_SMALL
w_class = WEIGHT_CLASS_SMALL
/obj/structure/sign/painting_frame/hadii
name = "president Hadii portrait"
@@ -575,7 +575,7 @@
pickup_sound = 'sound/items/pickup/axe.ogg'
center_of_mass = list("x" = 17,"y" = 7)
var/origin_type = /obj/structure/bed/roller
w_class = ITEMSIZE_NORMAL
w_class = WEIGHT_CLASS_NORMAL
/obj/item/roller/hover
name = "medical hoverbed"
@@ -286,7 +286,7 @@
icon_state = "chair_item"
item_state = "chair"
base_icon = "chair"
w_class = ITEMSIZE_HUGE
w_class = WEIGHT_CLASS_HUGE
force_divisor = 0.5
origin_type = /obj/structure/bed/stool/chair
@@ -176,7 +176,7 @@
throwforce = 10
throw_range = 5
force_divisor = 0.4
w_class = ITEMSIZE_HUGE
w_class = WEIGHT_CLASS_HUGE
contained_sprite = TRUE
var/material/padding_material
var/obj/structure/bed/stool/origin_type = /obj/structure/bed/stool
@@ -135,7 +135,7 @@
icon_state = "wheelchair_item_preview"
item_state = "wheelchair"
base_icon = "wheelchair"
w_class = ITEMSIZE_HUGE // Can't be put in backpacks. Oh well.
w_class = WEIGHT_CLASS_HUGE // Can't be put in backpacks. Oh well.
origin_type = /obj/structure/bed/stool/chair/office/wheelchair
deploy_verb = "deploy"
@@ -5,7 +5,7 @@
icon_state = "dispenser"
density = TRUE
anchored = TRUE
w_class = ITEMSIZE_HUGE
w_class = WEIGHT_CLASS_HUGE
var/max_tanks = 20
var/oxygen_tanks = 10
var/phoron_tanks = 10
+1 -1
View File
@@ -5,7 +5,7 @@
icon = 'icons/obj/target_stake.dmi'
icon_state = "target_stake"
density = TRUE
w_class = ITEMSIZE_IMMENSE
w_class = WEIGHT_CLASS_GIGANTIC
build_amt = 10
var/obj/item/target/pinned_target
+2 -2
View File
@@ -8,7 +8,7 @@
pickup_sound = 'sound/items/pickup/accessory.ogg'
matter = list(MATERIAL_GLASS = 150, MATERIAL_GOLD = 50)
recyclable = TRUE
w_class = ITEMSIZE_TINY
w_class = WEIGHT_CLASS_TINY
var/closed = FALSE
/obj/item/pocketwatch/AltClick(mob/user)
@@ -56,7 +56,7 @@
pickup_sound = 'sound/items/pickup/accessory.ogg'
matter = list(MATERIAL_GLASS = 150, MATERIAL_GOLD = 50)
recyclable = TRUE
w_class = ITEMSIZE_TINY
w_class = WEIGHT_CLASS_TINY
atom_flags = ITEM_FLAG_NO_BLUDGEON
var/datum/weakref/thrall = null
var/time_counter = 0
+18 -9
View File
@@ -149,6 +149,13 @@
create_reagents(2)
soundloop = new(src, FALSE)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
COMSIG_ATOM_EXITED = PROC_REF(on_exit),
)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/machinery/shower/Destroy()
QDEL_NULL(soundloop)
return ..()
@@ -214,17 +221,19 @@
QDEL_NULL(mymist)
ismist = FALSE
/obj/machinery/shower/Crossed(atom/movable/O)
..()
wash(O)
if(ismob(O))
mobpresent += 1
process_heat(O)
/obj/machinery/shower/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
SIGNAL_HANDLER
/obj/machinery/shower/Uncrossed(atom/movable/O)
if(ismob(O))
INVOKE_ASYNC(src, PROC_REF(wash), arrived)
if(ismob(arrived))
mobpresent += 1
process_heat(arrived)
/obj/machinery/shower/proc/on_exit(atom/movable/gone, direction)
SIGNAL_HANDLER
if(ismob(gone))
mobpresent -= 1
..()
//Yes, showers are super powerful as far as washing goes.
/obj/machinery/shower/proc/wash(atom/movable/O)
@@ -17,7 +17,7 @@
anchored = 0
density = 0
dir = NORTH
w_class = ITEMSIZE_NORMAL
w_class = WEIGHT_CLASS_NORMAL
atom_flags = ATOM_FLAG_CHECKS_BORDER
var/obj/item/airlock_electronics/electronics = null
+14 -14
View File
@@ -11,7 +11,7 @@
icon_state = "pane"
alpha = 196
density = TRUE
w_class = ITEMSIZE_NORMAL
w_class = WEIGHT_CLASS_NORMAL
layer = SIDE_WINDOW_LAYER
anchored = TRUE
atom_flags = ATOM_FLAG_CHECKS_BORDER
@@ -183,27 +183,27 @@
return 0
return 1
/obj/structure/window/hitby(AM as mob|obj, var/speed = THROWFORCE_SPEED_DIVISOR)
/obj/structure/window/hitby(atom/movable/hitting_atom, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
..()
var/tforce = 0
if(ismob(AM))
if(isliving(AM))
var/mob/living/M = AM
M.turf_collision(src, speed, /singleton/sound_category/glasscrack_sound)
if(ismob(hitting_atom))
if(isliving(hitting_atom))
var/mob/living/M = hitting_atom
M.turf_collision(src, throwingdatum.speed, /singleton/sound_category/glasscrack_sound)
return
else
visible_message(SPAN_DANGER("\The [src] was hit by \the [AM]."))
visible_message(SPAN_DANGER("\The [src] was hit by \the [hitting_atom]."))
tforce = 40
else if(isobj(AM))
visible_message(SPAN_DANGER("\The [src] was hit by \the [AM]."))
var/obj/item/I = AM
else if(isobj(hitting_atom))
visible_message(SPAN_DANGER("\The [src] was hit by \the [hitting_atom]."))
var/obj/item/I = hitting_atom
tforce = I.throwforce
if(reinf)
tforce *= 0.25
if(health - tforce <= 7 && !reinf)
anchored = 0
update_nearby_icons()
step(src, get_dir(AM, src))
step(src, get_dir(hitting_atom, src))
take_damage(tforce)
/obj/structure/window/attack_hand(var/mob/living/user)
@@ -480,7 +480,7 @@
/obj/structure/window/reinforced/crescent/ex_act(var/severity = 2)
return
/obj/structure/window/reinforced/crescent/hitby()
/obj/structure/window/reinforced/crescent/hitby(atom/movable/hitting_atom, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
return
/obj/structure/window/reinforced/crescent/take_damage()
@@ -812,7 +812,7 @@
/obj/structure/window/full/reinforced/indestructible/ex_act(var/severity = 2)
return
/obj/structure/window/full/reinforced/indestructible/hitby()
/obj/structure/window/full/reinforced/indestructible/hitby(atom/movable/hitting_atom, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
return
/obj/structure/window/full/reinforced/indestructible/take_damage()
@@ -845,7 +845,7 @@
/obj/structure/window/full/reinforced/polarized/indestructible/ex_act(var/severity = 2)
return
/obj/structure/window/full/reinforced/polarized/indestructible/hitby()
/obj/structure/window/full/reinforced/polarized/indestructible/hitby(atom/movable/hitting_atom, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
return
/obj/structure/window/full/reinforced/polarized/indestructible/take_damage()