From 2f6dc67e421f3d21e88d30af15519dee309e9153 Mon Sep 17 00:00:00 2001 From: Runa Dacino Date: Fri, 7 Apr 2023 14:19:43 +0200 Subject: [PATCH] Adjusts sectors to have real_icons * Previous implementation relied on icon and icon_state at compile time. * This prevented GMs from editing icon_state, as it always reverted to defaults when scanned * GMs can now edit real_icon using var edit->E "Icon" to use non-standard icon_states * GMs can now edit real_icon_state to choose specific state as a simple text var type edit * GMs can call a proc called gmtools_update_omobject_vars(setToHidden) with an argument that forces known locations to become unknown again with an arg of "1" * If GM uses arg of 0, proc simply changes how pilots inside the sector see their own ship by updating real_appearance with real_icon_state --- code/modules/overmap/sectors.dm | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/code/modules/overmap/sectors.dm b/code/modules/overmap/sectors.dm index 4fb71ff02f..fe3b38c9e0 100644 --- a/code/modules/overmap/sectors.dm +++ b/code/modules/overmap/sectors.dm @@ -16,6 +16,11 @@ var/real_desc /// Icon_state prior to being scanned if !known var/unknown_state = "field" + //Set to null. Exists only for admins/GMs when spawning overmap objects. + //We need these as normal functionality relies on initial() which do not work at all with GM shenanigans. + var/real_icon //Holds the .dmi file for icon_state to pick from. Leave null if using standard overmap.dmi + var/real_icon_state //actual icon name to be used. Find examples inside 'icons/obj/overmap.dmi' + var/real_color var/list/map_z = list() var/list/extra_z_levels //if you need to manually insist that these z-levels are part of this sector, for things like edge-of-map step trigger transitions rather than multi-z complexes @@ -84,6 +89,19 @@ //at the moment only used for the OM location renamer. Initializing here in case we want shuttles incl as well in future. Also proc definition convenience. visitable_overmap_object_instances |= src +//To be used by GMs and calling through var edits for the overmap object +//It causes the overmap object to "reinitialize" its real_appearance for known = FALSE objects +//Includes an argument that allows GMs/Admins to set a previously known sector to unknown. Set to any value except 0/False/Null to activate +/obj/effect/overmap/visitable/proc/gmtools_update_omobject_vars(var/setToHidden) + real_appearance = image(real_icon, src, real_icon_state) + real_appearance.override = TRUE + if(!setToHidden && known) // + name = unknown_name + icon = 'icons/obj/overmap.dmi' + icon_state = unknown_state + color = null + desc = "Scan this to find out more information." + known = FALSE // You generally shouldn't destroy these. @@ -141,8 +159,16 @@ name = real_name else name = initial(name) - icon_state = initial(icon_state) - color = initial(color) + if(real_icon_state) //Only true when GMs/Admins play with the object + if(real_icon) //Only true if GMs/Admins want a non-standard icon from outside 'icons/obj/overmap.dmi' + icon = real_icon + icon_state = real_icon_state + else + icon_state = initial(icon_state) + if(real_color) + color = real_color + else + color = initial(color) if(real_desc) desc = real_desc else