mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Validate map templates uploaded by admins (#39674)
* Move the preloader datum to its own file * Prettify some of the map loader docs * Use src rather than usr in map template verbs * Cache parsed templates between upload and first use * Validate map templates uploaded by admins before use * Add href token to validation report links
This commit is contained in:
committed by
yogstation13-bot
parent
8b9b311dc1
commit
05335f1c86
31
code/modules/mapping/preloader.dm
Normal file
31
code/modules/mapping/preloader.dm
Normal file
@@ -0,0 +1,31 @@
|
||||
// global datum that will preload variables on atoms instanciation
|
||||
GLOBAL_VAR_INIT(use_preloader, FALSE)
|
||||
GLOBAL_DATUM_INIT(_preloader, /datum/map_preloader, new)
|
||||
|
||||
/// Preloader datum
|
||||
/datum/map_preloader
|
||||
parent_type = /datum
|
||||
var/list/attributes
|
||||
var/target_path
|
||||
|
||||
/datum/map_preloader/proc/setup(list/the_attributes, path)
|
||||
if(the_attributes.len)
|
||||
GLOB.use_preloader = TRUE
|
||||
attributes = the_attributes
|
||||
target_path = path
|
||||
|
||||
/datum/map_preloader/proc/load(atom/what)
|
||||
GLOB.use_preloader = FALSE
|
||||
for(var/attribute in attributes)
|
||||
var/value = attributes[attribute]
|
||||
if(islist(value))
|
||||
value = deepCopyList(value)
|
||||
what.vars[attribute] = value
|
||||
|
||||
/area/template_noop
|
||||
name = "Area Passthrough"
|
||||
|
||||
/turf/template_noop
|
||||
name = "Turf Passthrough"
|
||||
icon_state = "noop"
|
||||
bullet_bounce_sound = null
|
||||
Reference in New Issue
Block a user