mirror of
https://github.com/Skyrat-SS13/Skyrat-tg.git
synced 2026-08-24 05:18:33 +01:00
Changes wall leaning into a component, makes windows leanable (#85771)
## About The Pull Request Requires #85491 to be merged first, as otherwise leaning on directional windows looks incredibly goofy You can now lean on both fulltile and directional windows, and its possible to easily extend this functionality to other objects. Dunno if this even deserves to be called a refactor so not marking it in any way. ## Why It's Good For The Game Just makes sense that you'd be able to do it ## Changelog 🆑 add: You can now lean on windows the same way you can lean on walls fix: You no longer stop leaning on walls after clicking on anything /🆑
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
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
|
||||
@@ -90,6 +92,24 @@
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user