Skip to content

Commit

Permalink
Apply upstream refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
m-dzianishchyts committed Dec 25, 2024
1 parent bb0a38c commit 00fd3aa
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 196 deletions.
4 changes: 0 additions & 4 deletions modular_ss220/_components/_components.dm

This file was deleted.

3 changes: 0 additions & 3 deletions modular_ss220/_components/_components.dme

This file was deleted.

107 changes: 0 additions & 107 deletions modular_ss220/_components/code/connect_range.dm

This file was deleted.

11 changes: 0 additions & 11 deletions modular_ss220/_misc/code/global_procs.dm
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
/proc/cmp_typepaths_asc(A, B)
return sorttext("[B]","[A]")

///Returns a list of all locations (except the area) the movable is within.
/proc/get_nested_locs(atom/movable/atom_on_location, include_turf = FALSE)
. = list()
var/atom/location = atom_on_location.loc
var/turf/our_turf = get_turf(atom_on_location)
while(location && location != our_turf)
. += location
location = location.loc
if(our_turf && include_turf) //At this point, only the turf is left, provided it exists.
. += our_turf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Signals for /mob/living

/mob/living/CanPass(atom/movable/mover, turf/target, height)
if(SEND_SIGNAL(src, COMSIG_LIVING_CAN_PASS, mover, target, height) & COMPONENT_LIVING_PASSABLE)
/mob/living/CanPass(atom/movable/mover, border_dir)
if(SEND_SIGNAL(src, COMSIG_LIVING_CAN_PASS, mover, border_dir) & COMPONENT_LIVING_PASSABLE)
return TRUE
return ..()

Expand Down
6 changes: 3 additions & 3 deletions modular_ss220/awaymission_gun/code/items/awaymission_gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
/obj/item/gun/energy/laser/awaymission_aeg/Initialize(mapload)
. = ..()
// Force update it incase it spawns outside an away mission and shouldnt be charged
onTransitZ(new_z = loc.z)
on_changed_z_level(new_turf = loc.z)

/obj/item/gun/energy/laser/awaymission_aeg/onTransitZ(old_z, new_z)
/obj/item/gun/energy/laser/awaymission_aeg/on_changed_z_level(turf/old_turf, turf/new_turf)
. = ..()
if(is_away_level(new_z))
if(is_away_level(new_turf))
if(ismob(loc))
to_chat(loc, span_notice("Ваш [src] активируется, начиная аккумулировать энергию из материи сущего."))
selfcharge = TRUE
Expand Down
16 changes: 11 additions & 5 deletions modular_ss220/clumsy_table/code/clumsy_climb_component.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@
var/max_thrown_objects = 15
// max possible thrown objects when not forced
var/max_thrown_objects_low = 5
/// what we set connect_loc to if parent is an atom
var/static/list/default_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(cross),
)

/datum/component/clumsy_climb/Initialize()
if(!isatom(parent))
return COMPONENT_INCOMPATIBLE

if(ismovable(parent))
AddComponent(/datum/component/connect_loc_behalf, parent, default_connections)

/datum/component/clumsy_climb/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, PROC_REF(cross))
RegisterSignal(parent, COMSIG_CLIMBED_ON, PROC_REF(cross))
RegisterSignal(parent, COMSIG_DANCED_ON, PROC_REF(cross))

/datum/component/clumsy_climb/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_CLIMBED_ON, COMSIG_DANCED_ON))
UnregisterSignal(parent, list(COMSIG_CLIMBED_ON, COMSIG_DANCED_ON))

/datum/component/clumsy_climb/proc/cross(atom/table, mob/living/user)
SIGNAL_HANDLER
Expand Down Expand Up @@ -63,8 +69,8 @@

var/list/items_to_throw = list()

var/turf/user_turf = get_turf(user)
for(var/obj/item/candidate_to_throw in user_turf)
var/turf/parent_turf = get_turf(parent)
for(var/obj/item/candidate_to_throw in parent_turf)
if(length(items_to_throw) >= max_thrown_objects)
break

Expand All @@ -74,7 +80,7 @@
items_to_throw += candidate_to_throw

for(var/obj/item/item_to_throw as anything in items_to_throw)
var/atom/thrown_target = get_edge_target_turf(user, get_dir(user_turf, get_step_away(item_to_throw, user_turf)))
var/atom/thrown_target = get_edge_target_turf(user, get_dir(parent_turf, get_step_away(item_to_throw, parent_turf)))
item_to_throw.throw_at(target = thrown_target, range = 1, speed = 1)
item_to_throw.force *= force_mod
item_to_throw.throwforce *= force_mod //no killing using shards :lul:
Expand Down
10 changes: 8 additions & 2 deletions modular_ss220/clumsy_table/code/clumsy_table.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/obj/structure/table/Crossed(atom/movable/AM, oldloc)
AddComponent(/datum/component/clumsy_climb, 5)
/obj/structure/table/Initialize(mapload)
. = ..()
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_crossed)
)
AddElement(/datum/element/connect_loc, loc_connections)

/obj/structure/table/proc/on_crossed(atom/crosser)
AddComponent(/datum/component/clumsy_climb, 5)

/obj/structure/table/do_climb(mob/living/user)
. = ..()
Expand Down
1 change: 0 additions & 1 deletion modular_ss220/modular_ss220.dme
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

// --- MAINTENANCE --- //
#include "_rust_utils/_rust_utils.dme"
#include "_components/_components.dme"
#include "_defines220/_defines220.dme"
#include "_signals220/_signals220.dme"
#include "_misc/_misc.dme"
Expand Down
18 changes: 13 additions & 5 deletions modular_ss220/objects/code/officetoys.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
. = ..()
countdown = new(src)

/obj/item/hourglass/attack_self__legacy__attackchain(mob/user)
/obj/item/hourglass/activate_self(mob/user)

Check failure on line 19 in modular_ss220/objects/code/officetoys.dm

View workflow job for this annotation

GitHub Actions / Run Linters

Attack Chain

modular_ss220/objects/code/officetoys.dm:19: legacy type with migrated proc /obj/item/hourglass/activate_self(...)
. = ..()
if(.)
return
if(hand_activated)
toggle(user)

Expand Down Expand Up @@ -109,12 +111,12 @@
else
icon_state = "[initial(icon_state)]"

/obj/item/toy/desk/attack_self__legacy__attackchain(mob/user)
/obj/item/hourglass/attack_self__legacy__attackchain(mob/user)
. = ..()
on = !on
if(activation_sound)
playsound(src.loc, activation_sound, 75, 1)
update_icon()
return TRUE

/obj/item/toy/desk/examine(mob/user)
. = ..()
Expand Down Expand Up @@ -155,7 +157,10 @@
. = ..()
soundloop = new(list(src), FALSE)

/obj/item/toy/desk/newtoncradle/attack_self__legacy__attackchain(mob/user)
/obj/item/toy/desk/newtoncradle/activate_self(mob/user)
. = ..()
if(.)
return
on = !on
update_icon()
if(on)
Expand All @@ -173,7 +178,10 @@
. = ..()
soundloop = new(list(src), FALSE)

/obj/item/toy/desk/fan/attack_self__legacy__attackchain(mob/user)
/obj/item/toy/desk/fan/activate_self(mob/user)
. = ..()
if(.)
return
on = !on
update_icon()
if(on)
Expand Down
41 changes: 24 additions & 17 deletions modular_ss220/objects/code/platform.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
/obj/structure/platform/Initialize(mapload)
. = ..()
CheckLayer()
var/static/list/loc_connections = list(
COMSIG_ATOM_EXIT = PROC_REF(on_atom_exit),
)
AddElement(/datum/element/connect_loc, loc_connections)

/obj/structure/platform/New()
..()
Expand Down Expand Up @@ -87,23 +91,27 @@
qdel(src)


/obj/structure/platform/CheckExit(atom/movable/O, turf/target)
/obj/structure/platform/proc/on_atom_exit(datum/source, atom/movable/leaving, direction)
SIGNAL_HANDLER

if(!anchored)
CheckLayer()
if(istype(O, /obj/structure/platform))
return FALSE
if(istype(O, /obj/item/projectile) || istype(O, /obj/effect))
return TRUE
if(corner)
return !density
if(O && O.throwing)
return TRUE
if(((flags & ON_BORDER) && get_dir(loc, target) == dir))
return FALSE
else
return TRUE
if(istype(leaving, /obj/structure/platform))
return COMPONENT_ATOM_BLOCK_EXIT
if(istype(leaving, /obj/item/projectile) || istype(leaving, /obj/effect))
return
var/mob/living/M = leaving
if(istype(M))
if(HAS_TRAIT(M, TRAIT_FLYING) || M.floating || (IS_HORIZONTAL(M) && HAS_TRAIT(M, TRAIT_CONTORTED_BODY)))
return
if(leaving.throwing)
return
if(leaving.move_force >= MOVE_FORCE_EXTREMELY_STRONG)
return
if(!(flags & ON_BORDER) || direction == dir)
return COMPONENT_ATOM_BLOCK_EXIT

/obj/structure/platform/CanPass(atom/movable/mover, turf/target)
/obj/structure/platform/CanPass(atom/movable/mover, border_dir)
if(!anchored)
CheckLayer()
if(istype(mover, /obj/structure/platform))
Expand All @@ -117,10 +125,9 @@
var/obj/structure/S = locate(/obj/structure) in get_turf(mover)
if(S && S.climbable && !(S.flags & ON_BORDER) && climbable && isliving(mover))// Climbable objects allow you to universally climb over others
return TRUE
if(!(flags & ON_BORDER) || get_dir(loc, target) == dir)
if(!(flags & ON_BORDER) || border_dir == dir)
return FALSE
else
return TRUE
return TRUE

/obj/structure/platform/do_climb(mob/living/user)
if(!can_touch(user) || !climbable)
Expand Down
Loading

0 comments on commit 00fd3aa

Please sign in to comment.