From f429a176e4e8e2c3e88177f74f5a3c90cbc516bc Mon Sep 17 00:00:00 2001 From: Neerti Date: Fri, 30 Mar 2018 05:28:58 -0400 Subject: [PATCH] Adds Map Template Groups Adds ability to have many different 'versions' of a PoI, yet only having one show up per round. An example on how to do this is provided with Radio Free Sif (aka DJOutpost). Just make sure all the different versions have the same 'template_group' value. --- code/game/turfs/flooring/flooring_premade.dm | 14 +++++ code/modules/maps/tg/map_template.dm | 19 ++++++- .../surface_submaps/wilderness/DJOutpost2.dmm | 56 +++++++++++++++++++ .../surface_submaps/wilderness/wilderness.dm | 9 +++ .../wilderness/wilderness_areas.dm | 3 + 5 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 maps/submaps/surface_submaps/wilderness/DJOutpost2.dmm diff --git a/code/game/turfs/flooring/flooring_premade.dm b/code/game/turfs/flooring/flooring_premade.dm index 5e0e2e48a7..559e3ad3a2 100644 --- a/code/game/turfs/flooring/flooring_premade.dm +++ b/code/game/turfs/flooring/flooring_premade.dm @@ -68,12 +68,26 @@ icon_state = "wood" initial_flooring = /decl/flooring/wood +/turf/simulated/floor/wood/broken + icon_state = "wood_broken0" // This gets changed when spawned. + +/turf/simulated/floor/wood/broken/initialize() + break_tile() + return ..() + /turf/simulated/floor/wood/sif name = "alien wooden floor" icon = 'icons/turf/flooring/wood.dmi' icon_state = "sifwood" initial_flooring = /decl/flooring/wood/sif +/turf/simulated/floor/wood/sif/broken + icon_state = "sifwood_broken0" // This gets changed when spawned. + +/turf/simulated/floor/wood/sif/broken/initialize() + break_tile() + return ..() + /turf/simulated/floor/grass name = "grass patch" icon = 'icons/turf/flooring/grass.dmi' diff --git a/code/modules/maps/tg/map_template.dm b/code/modules/maps/tg/map_template.dm index f4446c4cf9..2eb5aab12f 100644 --- a/code/modules/maps/tg/map_template.dm +++ b/code/modules/maps/tg/map_template.dm @@ -13,6 +13,7 @@ var/list/global/map_templates = list() /datum/map_template var/name = "Default Template Name" var/desc = "Some text should go here. Maybe." + var/template_group = null // If this is set, no more than one template in the same group will be spawned, per submap seeding. var/width = 0 var/height = 0 var/mappath = null @@ -67,7 +68,7 @@ var/list/global/map_templates = list() admin_notice("Initializing newly created atom(s) in submap.", R_DEBUG) SSatoms.InitializeAtoms(atoms) - + admin_notice("Initializing atmos pipenets and machinery in submap.", R_DEBUG) SSmachines.setup_atmos_machinery(atmos_machines) @@ -189,6 +190,7 @@ var/list/global/map_templates = list() CHECK_TICK var/list/loaded_submap_names = list() + var/list/template_groups_used = list() // Used to avoid spawning three seperate versions of the same PoI. // Now lets start choosing some. while(budget > 0 && overall_sanity > 0) @@ -209,6 +211,14 @@ var/list/global/map_templates = list() // Can we afford it? if(chosen_template.cost > budget) + priority_submaps -= chosen_template + potential_submaps -= chosen_template + continue + + // Did we already place down a very similar submap? + if(chosen_template.template_group && chosen_template.template_group in template_groups_used) + priority_submaps -= chosen_template + potential_submaps -= chosen_template continue // If so, try to place it. @@ -241,14 +251,21 @@ var/list/global/map_templates = list() CHECK_TICK + // For pretty maploading statistics. if(loaded_submap_names[chosen_template.name]) loaded_submap_names[chosen_template.name] += 1 else loaded_submap_names[chosen_template.name] = 1 + // To avoid two 'related' similar submaps existing at the same time. + if(chosen_template.template_group) + template_groups_used += chosen_template.template_group + + // To deduct the cost. if(chosen_template.cost >= 0) budget -= chosen_template.cost + // Remove the submap from our options. if(chosen_template in priority_submaps) // Always remove priority submaps. priority_submaps -= chosen_template else if(!chosen_template.allow_duplicates) diff --git a/maps/submaps/surface_submaps/wilderness/DJOutpost2.dmm b/maps/submaps/surface_submaps/wilderness/DJOutpost2.dmm new file mode 100644 index 0000000000..231a7ec958 --- /dev/null +++ b/maps/submaps/surface_submaps/wilderness/DJOutpost2.dmm @@ -0,0 +1,56 @@ +"a" = (/turf/template_noop,/area/template_noop) +"b" = (/turf/simulated/wall/wood,/area/submap/DJOutpost1) +"c" = (/obj/structure/grille/broken,/obj/item/weapon/material/shard,/obj/item/weapon/material/shard{tag = "icon-shardmedium"; icon_state = "shardmedium"},/obj/item/stack/rods,/turf/simulated/floor,/area/submap/DJOutpost1) +"d" = (/obj/structure/grille/broken,/obj/item/weapon/material/shard,/turf/simulated/floor,/area/submap/DJOutpost1) +"e" = (/turf/simulated/floor/wood/broken,/area/submap/DJOutpost1) +"f" = (/obj/structure/loot_pile/maint/technical,/turf/simulated/floor/wood/broken,/area/submap/DJOutpost1) +"g" = (/obj/structure/sign/goldenplaque{desc = "An award given to Sif Free Radio for media excellency. It looks fake."; name = "Best Radio Station 2558"; pixel_y = 30},/turf/simulated/floor/wood/broken,/area/submap/DJOutpost1) +"h" = (/obj/structure/cable/yellow{d1 = 2; d2 = 4; icon_state = "2-4"},/obj/structure/loot_pile/maint/technical,/turf/simulated/floor/wood/broken,/area/submap/DJOutpost1) +"i" = (/obj/structure/loot_pile/surface/bones,/turf/simulated/floor/wood/broken,/area/submap/DJOutpost1) +"k" = (/obj/structure/girder,/turf/simulated/floor,/area/submap/DJOutpost1) +"l" = (/obj/structure/bed/chair/office/dark{dir = 1},/obj/structure/cable/yellow{d1 = 1; d2 = 2; icon_state = "1-2"},/turf/simulated/floor/wood/broken,/area/submap/DJOutpost1) +"m" = (/obj/structure/table/steel_reinforced,/obj/item/device/radio/phone,/turf/simulated/floor/outdoors/dirt,/area/submap/DJOutpost1) +"n" = (/obj/item/stack/rods,/turf/template_noop,/area/template_noop) +"o" = (/turf/simulated/floor/outdoors/dirt,/area/submap/DJOutpost1) +"p" = (/obj/structure/loot_pile/surface/bones,/turf/simulated/floor/outdoors/dirt,/area/submap/DJOutpost1) +"q" = (/obj/structure/table/steel_reinforced,/obj/item/device/radio,/obj/structure/cable/yellow,/turf/simulated/floor/wood/broken,/area/submap/DJOutpost1) +"r" = (/turf/simulated/floor/outdoors/rocks,/area/submap/DJOutpost1) +"s" = (/obj/effect/overlay/snow/floor,/turf/simulated/floor{outdoors = 1},/area/submap/DJOutpost1) +"u" = (/obj/effect/decal/cleanable/ash,/turf/simulated/floor/outdoors/dirt,/area/submap/DJOutpost1) +"w" = (/obj/structure/grille/broken,/obj/item/weapon/material/shard{tag = "icon-shardmedium"; icon_state = "shardmedium"},/turf/simulated/floor,/area/submap/DJOutpost1) +"x" = (/obj/structure/girder,/turf/simulated/floor/outdoors/rocks,/area/submap/DJOutpost1) +"y" = (/obj/structure/table/steel_reinforced,/obj/item/device/radio/intercom/syndicate{desc = "Talk through this."; name = "station intercom (General)"},/turf/simulated/floor/outdoors/dirt,/area/submap/DJOutpost1) +"A" = (/obj/item/stack/rods,/turf/simulated/floor/outdoors/dirt,/area/submap/DJOutpost1) +"B" = (/obj/structure/door_assembly/door_assembly_ext,/turf/simulated/floor/outdoors/rocks,/area/submap/DJOutpost1) +"C" = (/obj/structure/grille/broken,/obj/item/weapon/material/shard{icon_state = "medium"},/obj/structure/cable/yellow{d1 = 4; d2 = 8; icon_state = "4-8"},/turf/simulated/floor,/area/submap/DJOutpost1) +"D" = (/obj/item/weapon/material/shard{tag = "icon-shardmedium"; icon_state = "shardmedium"},/turf/template_noop,/area/template_noop) +"F" = (/obj/item/device/transfer_valve,/turf/simulated/floor/outdoors/rocks,/area/submap/DJOutpost1) +"G" = (/obj/structure/grille/broken,/obj/item/weapon/material/shard{icon_state = "medium"},/turf/simulated/floor,/area/submap/DJOutpost1) +"H" = (/obj/item/weapon/material/shard{icon_state = "medium"},/turf/template_noop,/area/template_noop) +"I" = (/obj/machinery/door/airlock/external,/turf/simulated/floor/wood/broken,/area/submap/DJOutpost1) +"J" = (/obj/item/weapon/material/shard,/turf/template_noop,/area/template_noop) +"K" = (/obj/structure/sink{dir = 4; icon_state = "sink"; pixel_x = 15; tag = "icon-sink (EAST)"},/turf/simulated/floor/wood/broken,/area/submap/DJOutpost1) +"L" = (/obj/item/weapon/storage/toolbox/mechanical,/turf/simulated/floor/outdoors/rocks,/area/submap/DJOutpost1) +"M" = (/obj/structure/grille/broken,/obj/item/weapon/material/shard{icon_state = "medium"},/obj/item/stack/rods,/turf/simulated/floor,/area/submap/DJOutpost1) +"N" = (/obj/structure/grille/broken,/obj/item/stack/rods,/turf/simulated/floor,/area/submap/DJOutpost1) +"O" = (/obj/structure/lattice,/turf/simulated/floor/outdoors/dirt,/area/submap/DJOutpost1) +"P" = (/obj/effect/decal/cleanable/ash,/turf/simulated/floor/wood/broken,/area/submap/DJOutpost1) +"S" = (/obj/structure/girder,/turf/simulated/floor/outdoors/dirt,/area/submap/DJOutpost1) + +(1,1,1) = {" +aaaaaaaaaaaaaaaaaa +aaabcbbbbbdbaaaaaa +aabbeekffefbbaaaaa +abbePOSoOeegbbaaaa +nweeOooroOiPhCsoaa +DbeporxrrooOlSruoa +abeOrrrrrLmyqxrroa +abbkxrrFrrxbbkrAoa +abPorrrrrroOfbouaa +abeOorrrropeeboaaa +ndeOokxBxkOPfMHaaa +abbeOkOoOkeKbbaaaa +aabbObePebfbbaaaaa +aaabNbbIbbGbaaaaaa +aaaaJaaaaaaaaaaaaa +"} diff --git a/maps/submaps/surface_submaps/wilderness/wilderness.dm b/maps/submaps/surface_submaps/wilderness/wilderness.dm index 0ef6ace495..c10f45c6ad 100644 --- a/maps/submaps/surface_submaps/wilderness/wilderness.dm +++ b/maps/submaps/surface_submaps/wilderness/wilderness.dm @@ -17,6 +17,7 @@ #include "Lab1.dmm" #include "Rocky4.dmm" #include "DJOutpost1.dmm" +#include "DJOutpost2.dmm" #include "Rockybase.dmm" #include "MHR.dmm" #include "GovPatrol.dmm" @@ -132,6 +133,14 @@ name = "DJOutpost1" desc = "Home of Sif Free Radio, the best - and only - radio station for miles around." mappath = 'maps/submaps/surface_submaps/wilderness/DJOutpost1.dmm' + template_group = "Sif Free Radio" + cost = 5 + +/datum/map_template/surface/wilderness/deep/DJOutpost2 + name = "DJOutpost2" + desc = "The cratered remains of Sif Free Radio, the best - and only - radio station for miles around." + mappath = 'maps/submaps/surface_submaps/wilderness/DJOutpost2.dmm' + template_group = "Sif Free Radio" cost = 5 /datum/map_template/surface/wilderness/deep/Boombase diff --git a/maps/submaps/surface_submaps/wilderness/wilderness_areas.dm b/maps/submaps/surface_submaps/wilderness/wilderness_areas.dm index 3751fa3be6..8e37e52da4 100644 --- a/maps/submaps/surface_submaps/wilderness/wilderness_areas.dm +++ b/maps/submaps/surface_submaps/wilderness/wilderness_areas.dm @@ -54,6 +54,9 @@ /area/submap/DJOutpost1 name = "DJOutpost1" +/area/submap/DJOutpost2 + name = "DJOutpost2" + /area/submap/MHR name = "Manhack Rock"