mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 22:19:30 +01:00
map_export now saves welded airlocks and paper on noticeboards (#91960)
When using `map-export`: - Exports the welded state of an airlock to the welded airlock mapping helper - Exports the paper inside of a noticeboard to pop out and be saved on the same turf Both `airlocks` and `noticeboards` handle the outside objects already in their `Initialization()` procs so I didn't have to change anything. Also I cleaned up the paper code and added some better code documentation to `on_object_saved()`. We convert this:  To this:  ## Why It's Good For The Game There weren't any good examples of using `on_object_saved()` and the documentation was lacking so I wanted to include some proof of concept for a few objects. Also airlocks already save their welded state, but I think it looks better to have it as a mapping helper since it shows up in StrongDMM instead of being a VV edit.
This commit is contained in:
@@ -82,10 +82,13 @@
|
||||
fire = 80
|
||||
acid = 70
|
||||
|
||||
/obj/machinery/door/get_save_vars()
|
||||
. = ..()
|
||||
. += NAMEOF(src, welded)
|
||||
return .
|
||||
/obj/machinery/door/on_object_saved()
|
||||
var/data
|
||||
|
||||
if(welded)
|
||||
data += "[data ? ",\n" : ""][/obj/effect/mapping_helpers/airlock/welded]"
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/door/Initialize(mapload)
|
||||
AddElement(/datum/element/blocks_explosives)
|
||||
|
||||
@@ -13,18 +13,27 @@
|
||||
|
||||
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/noticeboard, 32)
|
||||
|
||||
/obj/structure/noticeboard/on_object_saved()
|
||||
var/data
|
||||
|
||||
for(var/obj/item/paper/paper in contents)
|
||||
var/metadata = generate_tgm_metadata(paper)
|
||||
data += "[data ? ",\n" : ""][paper.type][metadata]"
|
||||
|
||||
return data
|
||||
|
||||
/obj/structure/noticeboard/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
if(!mapload)
|
||||
return
|
||||
|
||||
for(var/obj/item/I in loc)
|
||||
for(var/obj/item/paper/paper in loc)
|
||||
if(notices >= MAX_NOTICES)
|
||||
break
|
||||
if(istype(I, /obj/item/paper))
|
||||
I.forceMove(src)
|
||||
notices++
|
||||
|
||||
paper.forceMove(src)
|
||||
notices++
|
||||
update_appearance(UPDATE_ICON)
|
||||
find_and_hang_on_wall()
|
||||
|
||||
|
||||
@@ -45,7 +45,10 @@ ADMIN_VERB(map_export, R_DEBUG, "Map Export", "Select a part of the map by coord
|
||||
|
||||
/**
|
||||
* A procedure for saving non-standard properties of an object.
|
||||
* For example, saving ore into a silo, and further spavn by coordinates of metal stacks objects
|
||||
* Examples:
|
||||
* Saving material stacks (ie. ore in a silo)
|
||||
* Saving variables that can be shown as mapping helpers (ie. welded airlock mapping helper)
|
||||
* Saving objects inside of another object (ie. paper inside a noticeboard)
|
||||
*/
|
||||
/obj/proc/on_object_saved()
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user