Refactored CollidedWith (#19541)

Refactored CollidedWith()
This commit is contained in:
Fluffy
2024-06-29 10:01:18 +00:00
committed by GitHub
parent d63d63d78c
commit d8d67ebd3a
31 changed files with 317 additions and 183 deletions
+4 -2
View File
@@ -19,8 +19,10 @@ var/list/obj/effect/bump_teleporter/BUMP_TELEPORTERS = list()
BUMP_TELEPORTERS -= src
return ..()
/obj/effect/bump_teleporter/CollidedWith(atom/user)
if(!ismob(user))
/obj/effect/bump_teleporter/CollidedWith(atom/bumped_atom)
. = ..()
if(!ismob(bumped_atom))
//user.forceMove(src.loc) //Stop at teleporter location
return
+3 -3
View File
@@ -30,11 +30,11 @@
precision = precise
/obj/effect/portal/CollidedWith(mob/M)
set waitfor = FALSE
/obj/effect/portal/CollidedWith(atom/bumped_atom)
. = ..()
if(does_teleport)
teleport(M)
teleport(bumped_atom)
/obj/effect/portal/Crossed(AM)
set waitfor = FALSE
+4 -4
View File
@@ -233,7 +233,7 @@
if(AM.loc != loc)
AM.forceMove(loc)
captured = WEAKREF(L)
buckle(L)
INVOKE_ASYNC(src, PROC_REF(buckle), L)
layer = L.layer + 0.1
playsound(src, 'sound/weapons/beartrap_shut.ogg', 100, 1)
deployed = FALSE
@@ -282,9 +282,9 @@
release()
/obj/item/trap/animal/CollidedWith(atom/AM)
if(deployed && is_type_in_list(AM, allowed_mobs))
Crossed(AM)
/obj/item/trap/animal/CollidedWith(atom/bumped_atom)
if(deployed && is_type_in_list(bumped_atom, allowed_mobs))
Crossed(bumped_atom)
else
..()
+5 -3
View File
@@ -72,9 +72,11 @@
else
icon_state = initial(icon_state)
/obj/structure/grille/CollidedWith(atom/user)
if(ismob(user))
shock(user, 70)
/obj/structure/grille/CollidedWith(atom/bumped_atom)
. = ..()
if(ismob(bumped_atom))
shock(bumped_atom, 70)
/obj/structure/grille/attack_hand(mob/user as mob)
+21 -13
View File
@@ -65,10 +65,10 @@
if(lock)
. += SPAN_NOTICE("It appears to have a lock.")
/obj/structure/simple_door/CollidedWith(atom/user)
/obj/structure/simple_door/CollidedWith(atom/bumped_atom)
..()
if(!state)
return TryToSwitchState(user)
return TryToSwitchState(bumped_atom)
return
/obj/structure/simple_door/attack_ai(mob/user as mob) //those aren't machinery, they're just big fucking slabs of a mineral
@@ -123,22 +123,30 @@
isSwitchingStates = 1
playsound(loc, material.dooropen_noise, 100, 1)
flick("[material.door_icon_base]opening",src)
sleep(10)
density = 0
opacity = 0
state = 1
update_icon()
isSwitchingStates = 0
update_nearby_tiles()
addtimer(CALLBACK(src, PROC_REF(change_state_after_openclode), TRUE), 1 SECONDS)
/obj/structure/simple_door/proc/Close()
isSwitchingStates = 1
playsound(loc, material.dooropen_noise, 100, 1)
flick("[material.door_icon_base]closing",src)
sleep(10)
density = 1
opacity = 1
state = 0
addtimer(CALLBACK(src, PROC_REF(change_state_after_openclode), FALSE), 1 SECONDS)
/**
* Complete the open/close of the door
*
* * to_open - Whether the door is to be set as open, if FALSE, it is to be set as closed instead
*/
/obj/structure/simple_door/proc/change_state_after_openclode(to_open = FALSE)
if(to_open)
density = 0
opacity = 0
state = 1
else
density = 1
opacity = 1
state = 0
update_icon()
isSwitchingStates = 0
update_nearby_tiles()