mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 04:57:57 +01:00
Converts simple rotation into a bespoke element (#94582)
## About The Pull Request <img width="579" height="67" alt="image" src="https://github.com/user-attachments/assets/d7a4427e-2a6e-44d3-94ba-c90a2d474984" /> Simple rotation components number in the 8-9k range per round, and each contains a needless callback datum as well. These do not need to hold any state and can be bespoke elements, and the proc to do things post_rotation can just be a normal atom proc. <details><summary>Still works as you'd expect, including items that have flag requirements like the wrench</summary>   </details> ## Why It's Good For The Game Makes a heavily used element much more lightweight, saves a few mb of memory. ## Changelog 🆑 refactor: simple rotation component has been refactored into an element Please report any bugs to github. /🆑
This commit is contained in:
@@ -71,7 +71,7 @@
|
||||
|
||||
///This proc adds the rotate component, overwrite this if you for some reason want to change some specific args.
|
||||
/obj/structure/chair/proc/MakeRotate()
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_IGNORE_ANCHORED|ROTATION_GHOSTS_ALLOWED)
|
||||
AddElement(/datum/element/simple_rotation, ROTATION_IGNORE_ANCHORED|ROTATION_GHOSTS_ALLOWED)
|
||||
|
||||
/obj/structure/chair/Destroy()
|
||||
SSjob.latejoin_trackers -= src //These may be here due to the arrivals shuttle
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
///This proc adds the rotate component, overwrite this if you for some reason want to change some specific args.
|
||||
/obj/structure/chair/pew/MakeRotate()
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_REQUIRE_WRENCH|ROTATION_IGNORE_ANCHORED)
|
||||
AddElement(/datum/element/simple_rotation, ROTATION_REQUIRE_WRENCH|ROTATION_IGNORE_ANCHORED)
|
||||
|
||||
/obj/structure/chair/pew/left
|
||||
name = "left wooden pew end"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/obj/structure/cannon/Initialize(mapload)
|
||||
. = ..()
|
||||
create_reagents(charge_size)
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
AddElement(/datum/element/simple_rotation)
|
||||
|
||||
/obj/structure/cannon/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
material = pick(MANNEQUIN_WOOD, MANNEQUIN_PLASTIC)
|
||||
icon_state = "mannequin_[material]_[body_type == FEMALE ? "female" : "male"]"
|
||||
AddElement(/datum/element/strippable, GLOB.strippable_mannequin_items)
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_IGNORE_ANCHORED)
|
||||
AddElement(/datum/element/simple_rotation, ROTATION_IGNORE_ANCHORED)
|
||||
AddComponent(/datum/component/marionette)
|
||||
update_appearance()
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
)
|
||||
AddElement(/datum/element/contextual_screentip_tools, tool_behaviors)
|
||||
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_NEEDS_ROOM)
|
||||
AddElement(/datum/element/simple_rotation, ROTATION_NEEDS_ROOM)
|
||||
|
||||
/obj/structure/railing/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -388,7 +388,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/shower, (-16))
|
||||
|
||||
/obj/structure/showerframe/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
AddElement(/datum/element/simple_rotation)
|
||||
|
||||
/obj/structure/showerframe/attackby(obj/item/tool, mob/living/user, list/modifiers, list/attack_modifiers)
|
||||
if(istype(tool, /obj/item/stock_parts/water_recycler))
|
||||
|
||||
@@ -340,7 +340,7 @@
|
||||
|
||||
/obj/structure/stairs_frame/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
AddElement(/datum/element/simple_rotation)
|
||||
|
||||
/obj/structure/stairs_frame/examine(mob/living/carbon/human/user)
|
||||
. = ..()
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
AddElement(/datum/element/connect_loc, loc_connections)
|
||||
AddComponent(/datum/component/climb_walkable)
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
AddElement(/datum/element/simple_rotation)
|
||||
register_context()
|
||||
|
||||
/obj/structure/steps/add_context(atom/source, list/context, obj/item/held_item, mob/user)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/obj/structure/toiletbong/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation, post_rotation = CALLBACK(src, PROC_REF(post_rotation)))
|
||||
AddElement(/datum/element/simple_rotation)
|
||||
create_storage(storage_type = /datum/storage/toiletbong)
|
||||
|
||||
weed_overlay = mutable_appearance('icons/obj/watercloset.dmi', "[base_icon_state]_overlay")
|
||||
@@ -83,7 +83,7 @@
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
///Called in the simple rotation's post_rotation callback, playing a sound cue to players.
|
||||
/obj/structure/toiletbong/proc/post_rotation(mob/user, degrees)
|
||||
/obj/structure/toiletbong/post_rotation(mob/user, degrees)
|
||||
playsound(src, 'sound/items/deconstruct.ogg', 50)
|
||||
|
||||
/obj/structure/toiletbong/crowbar_act(mob/living/user, obj/item/tool)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
/obj/structure/c_transit_tube/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation, post_rotation = CALLBACK(src, PROC_REF(post_rotation)))
|
||||
AddElement(/datum/element/simple_rotation)
|
||||
|
||||
/obj/structure/c_transit_tube/proc/can_wrench_in_loc(mob/user)
|
||||
var/turf/source_turf = get_turf(loc)
|
||||
@@ -27,7 +27,7 @@
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/structure/c_transit_tube/proc/post_rotation(mob/user, degrees)
|
||||
/obj/structure/c_transit_tube/post_rotation(mob/user, degrees)
|
||||
if(flipped_build_type && degrees == ROTATION_FLIP)
|
||||
setDir(turn(dir, degrees)) //Turn back we don't actually flip
|
||||
flipped = !flipped
|
||||
|
||||
@@ -256,7 +256,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/sink/kitchen, (-16))
|
||||
|
||||
/obj/structure/sinkframe/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation)
|
||||
AddElement(/datum/element/simple_rotation)
|
||||
|
||||
/obj/structure/sinkframe/attackby(obj/item/tool, mob/living/user, list/modifiers, list/attack_modifiers)
|
||||
if(istype(tool, /obj/item/stock_parts/water_recycler))
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
)
|
||||
|
||||
AddElement(/datum/element/connect_loc, loc_connections)
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_NEEDS_ROOM)
|
||||
AddElement(/datum/element/simple_rotation, ROTATION_NEEDS_ROOM)
|
||||
|
||||
/obj/structure/windoor_assembly/Destroy()
|
||||
set_density(FALSE)
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
flags_1 |= ALLOW_DARK_PAINTS_1
|
||||
RegisterSignal(src, COMSIG_OBJ_PAINTED, PROC_REF(on_painted))
|
||||
AddElement(/datum/element/atmos_sensitive, mapload)
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_NEEDS_ROOM, post_rotation = CALLBACK(src, PROC_REF(post_rotation)))
|
||||
AddElement(/datum/element/simple_rotation, ROTATION_NEEDS_ROOM)
|
||||
|
||||
var/static/list/loc_connections = list(
|
||||
COMSIG_ATOM_EXIT = PROC_REF(on_exit),
|
||||
@@ -360,7 +360,7 @@
|
||||
dropped_debris += new /obj/item/stack/rods(location, (fulltile ? 2 : 1))
|
||||
return dropped_debris
|
||||
|
||||
/obj/structure/window/proc/post_rotation(mob/user, degrees)
|
||||
/obj/structure/window/post_rotation(mob/user, degrees)
|
||||
air_update_turf(TRUE, FALSE)
|
||||
|
||||
/obj/structure/window/proc/on_painted(obj/structure/window/source, mob/user, obj/item/toy/crayon/spraycan/spraycan, is_dark_color)
|
||||
|
||||
Reference in New Issue
Block a user