Skip to content

Commit

Permalink
Revert "[MIRROR] Changes wall leaning into a component, makes windows (
Browse files Browse the repository at this point in the history
…Skyrat-SS13#29526)

Revert "[MIRROR] Changes wall leaning into a component, makes windows leanable (Skyrat-SS13#29400)"

This reverts commit 856444a.
  • Loading branch information
Majkl-J committed Aug 22, 2024
1 parent ecb5c32 commit e2d236e
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 156 deletions.
2 changes: 0 additions & 2 deletions code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -294,5 +294,3 @@
#define COMSIG_MOB_ENSLAVED_TO "mob_enslaved_to"
/// From /obj/item/proc/attack_atom: (mob/living/attacker, atom/attacked)
#define COMSIG_LIVING_ATTACK_ATOM "living_attack_atom"
/// From /mob/living/proc/stop_leaning()
#define COMSIG_LIVING_STOPPED_LEANING "living_stopped_leaning"
111 changes: 0 additions & 111 deletions code/datums/components/leanable.dm

This file was deleted.

31 changes: 0 additions & 31 deletions code/game/objects/structures/window.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
var/datum/material/glass_material_datum = /datum/material/glass
/// Whether or not we're disappearing but dramatically
var/dramatically_disappearing = FALSE
/// If we added a leaning component to ourselves
var/added_leaning = FALSE

/datum/armor/structure_window
melee = 50
Expand Down Expand Up @@ -80,35 +78,6 @@
if (flags_1 & ON_BORDER_1)
AddElement(/datum/element/connect_loc, loc_connections)

/obj/structure/window/mouse_drop_receive(atom/dropping, mob/user, params)
. = ..()
if (added_leaning)
return
/// For performance reasons and to cut down on init times we are "lazy-loading" the leaning component when someone drags their sprite onto us, and then calling dragging code again to trigger the component
AddComponent(/datum/component/leanable, 11, same_turf = (flags_1 & ON_BORDER_1), lean_check = CALLBACK(src, PROC_REF(lean_check)))
added_leaning = TRUE
dropping.base_mouse_drop_handler(src, null, null, params)

/obj/structure/window/proc/lean_check(mob/living/leaner, list/modifiers)
if (!(flags_1 & ON_BORDER_1))
return TRUE

if (leaner.loc == loc)
return dir == REVERSE_DIR(leaner.dir)

return get_dir(src, leaner) == dir && leaner.dir == dir

/obj/structure/window/setDir(newdir)
. = ..()
if(fulltile)
return
// Needed because render targets seem to shift larger then 32x32 icons down constantly. No idea why
pixel_y = 0
pixel_z = 16
if(smoothing_flags & SMOOTH_BORDER_OBJECT)
QUEUE_SMOOTH_NEIGHBORS(src)
QUEUE_SMOOTH(src)

/obj/structure/window/examine(mob/user)
. = ..()

Expand Down
73 changes: 62 additions & 11 deletions code/game/turfs/closed/walls.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define LEANING_OFFSET 11

/turf/closed/wall
name = "wall"
desc = "A huge chunk of iron used to separate rooms." //ICON OVERRIDDEN IN SKYRAT AESTHETICS - SEE MODULE
Expand Down Expand Up @@ -29,11 +31,67 @@
var/girder_type = /obj/structure/girder
/// A turf that will replace this turf when this turf is destroyed
var/decon_type
/// If we added a leaning component to ourselves
var/added_leaning = FALSE

var/list/dent_decals

/turf/closed/wall/mouse_drop_receive(atom/dropping, mob/user, params)
if(dropping != user)
return
if(!iscarbon(dropping) && !iscyborg(dropping))
return
var/mob/living/leaner = dropping
if(leaner.incapacitated(IGNORE_RESTRAINTS) || leaner.stat != CONSCIOUS || HAS_TRAIT(leaner, TRAIT_NO_TRANSFORM))
return
if(!leaner.density || leaner.pulledby || leaner.buckled || !(leaner.mobility_flags & MOBILITY_STAND))
return
if(HAS_TRAIT_FROM(leaner, TRAIT_UNDENSE, LEANING_TRAIT))
return
var/turf/checked_turf = get_step(leaner, REVERSE_DIR(leaner.dir))
if(checked_turf != src)
return
leaner.start_leaning(src)

/mob/living/proc/start_leaning(turf/closed/wall/wall)
var/new_y = base_pixel_y + pixel_y
var/new_x = base_pixel_x + pixel_x
switch(dir)
if(SOUTH)
new_y += LEANING_OFFSET
if(NORTH)
new_y -= LEANING_OFFSET
if(WEST)
new_x += LEANING_OFFSET
if(EAST)
new_x -= LEANING_OFFSET

animate(src, 0.2 SECONDS, pixel_x = new_x, pixel_y = new_y)
add_traits(list(TRAIT_UNDENSE, TRAIT_EXPANDED_FOV), LEANING_TRAIT)
visible_message(
span_notice("[src] leans against [wall]."),
span_notice("You lean against [wall]."),
)
RegisterSignals(src, list(
COMSIG_MOB_CLIENT_PRE_MOVE,
COMSIG_LIVING_DISARM_HIT,
COMSIG_LIVING_GET_PULLED,
COMSIG_MOVABLE_TELEPORTING,
COMSIG_ATOM_DIR_CHANGE,
), PROC_REF(stop_leaning))
update_fov()

/mob/living/proc/stop_leaning()
SIGNAL_HANDLER
UnregisterSignal(src, list(
COMSIG_MOB_CLIENT_PRE_MOVE,
COMSIG_LIVING_DISARM_HIT,
COMSIG_LIVING_GET_PULLED,
COMSIG_MOVABLE_TELEPORTING,
COMSIG_ATOM_DIR_CHANGE,
))
animate(src, 0.2 SECONDS, pixel_x = base_pixel_x, pixel_y = base_pixel_y)
remove_traits(list(TRAIT_UNDENSE, TRAIT_EXPANDED_FOV), LEANING_TRAIT)
update_fov()

/turf/closed/wall/Initialize(mapload)
. = ..()
if(!can_engrave)
Expand All @@ -50,15 +108,6 @@
fixed_underlay = string_assoc_list(fixed_underlay)
underlays += underlay_appearance

/turf/closed/wall/mouse_drop_receive(atom/dropping, mob/user, params)
. = ..()
if (added_leaning)
return
/// For performance reasons and to cut down on init times we are "lazy-loading" the leaning component when someone drags their sprite onto us, and then calling dragging code again to trigger the component
AddComponent(/datum/component/leanable, 11)
added_leaning = TRUE
dropping.base_mouse_drop_handler(src, null, null, params)

/turf/closed/wall/atom_destruction(damage_flag)
. = ..()
dismantle_wall(TRUE, FALSE)
Expand Down Expand Up @@ -335,3 +384,5 @@
/turf/closed/wall/Exited(atom/movable/gone, direction)
. = ..()
SEND_SIGNAL(gone, COMSIG_LIVING_WALL_EXITED, src)

#undef LEANING_OFFSET
1 change: 0 additions & 1 deletion tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,6 @@
#include "code\datums\components\jukebox.dm"
#include "code\datums\components\keep_me_secure.dm"
#include "code\datums\components\knockoff.dm"
#include "code\datums\components\leanable.dm"
#include "code\datums\components\leash.dm"
#include "code\datums\components\life_link.dm"
#include "code\datums\components\light_eater.dm"
Expand Down

0 comments on commit e2d236e

Please sign in to comment.