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
@@ -110,13 +110,20 @@
. = ..()
icon_state = "stalks[rand(1, 5)]"
/obj/structure/flora/bush/konyang_reeds/Crossed(atom/movable/AM, atom/oldloc)
if(istype(AM, /mob/living))
var/mob/living/L = AM
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/flora/bush/konyang_reeds/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
SIGNAL_HANDLER
if(istype(arrived, /mob/living))
var/mob/living/L = arrived
to_chat(L, SPAN_NOTICE("You brush through \the [src] really quite loudly."))
playsound(loc, 'sound/effects/plantshake.ogg', 60, TRUE)
shake_animation()
..()
/obj/structure/flora/bush/konyang_reeds/water
icon_state = "water_stalks"
@@ -37,7 +37,7 @@
playsound(loc, 'sound/effects/plantshake.ogg', 50, 1)
if(do_after(user, 20, src))
if(!stored_item)
if(attacking_item.w_class <= ITEMSIZE_NORMAL)
if(attacking_item.w_class <= WEIGHT_CLASS_NORMAL)
user.drop_from_inventory(attacking_item, src)
stored_item = attacking_item
to_chat(user,SPAN_NOTICE("You hide \the [attacking_item] in [src]."))
@@ -8,6 +8,15 @@
anchored = TRUE
var/open = 1
/obj/structure/pit/Initialize()
. = ..()
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/pit/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/shovel))
visible_message(SPAN_NOTICE("\The [user] starts [open ? "filling" : "digging open"] \the [src]"))
@@ -93,10 +102,11 @@
playsound(src.loc, 'sound/effects/squelch1.ogg', 100, 1)
open()
/obj/structure/pit/Crossed(AM as mob|obj)
for(var/obj/item/landmine/I in contents)
I.Crossed(AM, TRUE)
..()
/obj/structure/pit/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
SIGNAL_HANDLER
// for(var/obj/item/landmine/I in contents)
// I.on_enter(arrived, TRUE)
/obj/structure/pit/closed
name = "mound"
+17 -5
View File
@@ -110,14 +110,26 @@
if(requires_contact)
set_invisibility(INVISIBILITY_OVERMAP)// Effects that require identification have their images cast to the client via sensors.
/obj/effect/overmap/Crossed(var/obj/effect/overmap/visitable/other)
if(istype(other))
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/effect/overmap/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
SIGNAL_HANDLER
if(istype(arrived, /obj/effect/overmap/visitable))
for(var/obj/effect/overmap/visitable/O in loc)
SSskybox.rebuild_skyboxes(O.map_z)
/obj/effect/overmap/Uncrossed(var/obj/effect/overmap/visitable/other)
if(istype(other))
SSskybox.rebuild_skyboxes(other.map_z)
/obj/effect/overmap/proc/on_exit(atom/movable/gone, direction)
SIGNAL_HANDLER
if(istype(gone, /obj/effect/overmap/visitable))
var/obj/effect/overmap/visitable/V = gone
SSskybox.rebuild_skyboxes(V.map_z)
for(var/obj/effect/overmap/visitable/O in loc)
SSskybox.rebuild_skyboxes(O.map_z)
@@ -3,7 +3,7 @@
desc = "A shell of some sort."
icon = 'icons/obj/projectiles.dmi'
icon_state = "nuke"
w_class = ITEMSIZE_HUGE
w_class = WEIGHT_CLASS_HUGE
slowdown = 2
drop_sound = 'sound/items/drop/shell_drop.ogg'
var/projectile_type_override //Override projectile type fired by the gun. This is because certain guns don't use ammo (the Leviathan) but with some we want the ammo to matter.
@@ -291,13 +291,13 @@
if(connected)
connected.attackby(attacking_item, user)
/obj/structure/ship_weapon_dummy/hitby(atom/movable/AM, var/speed = THROWFORCE_SPEED_DIVISOR)
/obj/structure/ship_weapon_dummy/hitby(atom/movable/hitting_atom, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
if(connected)
connected.hitby(AM)
if(ismob(AM))
if(isliving(AM))
var/mob/living/M = AM
M.turf_collision(src, speed)
connected.hitby(arglist(args))
if(ismob(hitting_atom))
if(isliving(hitting_atom))
var/mob/living/M = hitting_atom
M.turf_collision(src, throwingdatum.speed)
return
/obj/structure/ship_weapon_dummy/bullet_act(obj/projectile/P, def_zone)
@@ -21,7 +21,7 @@
desc = "A rough, handmade shell that should fit in a bruiser cannon. This one is filled with shot that causes wide damage, but must get through the hull first."
icon = 'icons/obj/guns/ship/ship_ammo_midshell.dmi'
icon_state = "shell_canister"
w_class = ITEMSIZE_LARGE
w_class = WEIGHT_CLASS_BULKY
impact_type = SHIP_AMMO_IMPACT_FMJ
ammunition_flags = SHIP_AMMO_FLAG_VERY_HEAVY
mob_carry_size = 10 //unathi, dionae and all vaurca can lift these bad boys up.
@@ -91,7 +91,7 @@
desc = "This is a medium power primer for Longbow warheads."
icon = 'icons/obj/guns/ship/ship_ammo_longarm.dmi'
icon_state = "primer_med_obj"
w_class = ITEMSIZE_HUGE
w_class = WEIGHT_CLASS_HUGE
var/primer_state = "primer_med" //This is the overlay state when it gets applied to the projectile.
var/speed = 30 //Somewhat of a misleading name. This is the lag in world ticks between each walk() called by the overmap projectile. Lower is better.
@@ -114,7 +114,7 @@
desc = "This is a generic warhead. Not for use."
icon = 'icons/obj/guns/ship/ship_ammo_longarm.dmi'
icon_state = "generic_warhead_obj"
w_class = ITEMSIZE_HUGE
w_class = WEIGHT_CLASS_HUGE
var/warhead_state = "generic_warhead" //This is the overlay state when it gets applied to the projectile.
var/caliber
var/warhead_type