Skip to content

Randomized armoury #7073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ SUBSYSTEM_DEF(mapping)
var/list/random_bar_templates = list()
var/list/random_engine_templates = list()
var/list/random_arena_templates = list()
var/list/random_armoury_templates = list()
///Temporary list, where room spawners are kept roundstart. Not used later.
var/list/random_room_spawners = list()
var/list/random_engine_spawners = list()
var/list/random_bar_spawners = list()
var/list/random_armoury_spawners = list()

/datum/controller/subsystem/mapping/PreInit()
..()
Expand Down Expand Up @@ -367,6 +369,7 @@ Used by the AI doomsday and the self-destruct nuke.
random_engine_templates = SSmapping.random_engine_templates
random_bar_templates = SSmapping.random_bar_templates
random_arena_templates = SSmapping.random_arena_templates
random_armoury_templates = SSmapping.random_armoury_templates

current_map = SSmapping.current_map

Expand Down Expand Up @@ -497,6 +500,27 @@ Used by the AI doomsday and the self-destruct nuke.
var/start_time = REALTIMEOFDAY
GLOB.ghost_arena.spawn_random_arena(init = TRUE)
INIT_ANNOUNCE("Loaded Random Arenas in [(REALTIMEOFDAY - start_time) / 10]s!")

/datum/controller/subsystem/mapping/proc/load_random_armoury()
var/start_time = REALTIMEOFDAY
for(var/obj/effect/spawner/random_engines/engine_spawner as() in random_engine_spawners)
var/list/possible_engine_templates = list()
var/datum/map_template/random_room/random_engines/engine_candidate
shuffle_inplace(random_engine_templates)
for(var/ID in random_engine_templates)
engine_candidate = random_engine_templates[ID]
if(current_map.map_name != engine_candidate.station_name || engine_candidate.weight == 0 || engine_spawner.room_height != engine_candidate.template_height || engine_spawner.room_width != engine_candidate.template_width)
engine_candidate = null
continue
possible_engine_templates[engine_candidate] = engine_candidate.weight
if(possible_engine_templates.len)
var/datum/map_template/random_room/random_engines/template = pick_weight(possible_engine_templates)
log_world("Loading random engine template [template.name] ([template.type]) at [AREACOORD(engine_spawner)]")
template.stationinitload(get_turf(engine_spawner), centered = template.centerspawner)
SSmapping.random_engine_spawners -= engine_spawner
qdel(engine_spawner)
random_engine_spawners = null
INIT_ANNOUNCE("Loaded Random Engine in [(REALTIMEOFDAY - start_time)/10]s!")
/// New Random Bars and Engines Spawning - MonkeStation Edit End

/datum/controller/subsystem/mapping/proc/loadWorld()
Expand Down
1 change: 1 addition & 0 deletions code/modules/unit_tests/unit_test.dm
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ GLOBAL_VAR_INIT(focused_tests, focused_tests())
// monkestation start
/obj/effect/spawner/random_engines,
/obj/effect/spawner/random_bar,
/obj/effect/spawner/random_armoury,
/obj/machinery/atm, // starts a timer, and if its being instantly deleted it can cause issues
/obj/machinery/ocean_elevator,
/atom/movable/outdoor_effect,
Expand Down
35 changes: 35 additions & 0 deletions monkestation/code/game/objects/effects/spawners/roomspawner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,38 @@
name = "Tramstation bar spawner"
room_width = 30
room_height = 25

/obj/effect/spawner/random_armoury
name = "random armoury spawner"
icon = 'icons/effects/landmarks_static.dmi'
icon_state = "random_room"
dir = NORTH
var/room_width = 0
var/room_height = 0

/obj/effect/spawner/random_armoury/New(loc, ...)
. = ..()
if(!isnull(SSmapping.random_armoury_spawners))
SSmapping.random_armoury_spawners += src

/obj/effect/spawner/random_armoury/Initialize(mapload)
..()
if(!mapload)
return INITIALIZE_HINT_QDEL

if(!length(SSmapping.random_armoury_templates))
message_admins("Room spawner created with no templates available. This shouldn't happen.")
return INITIALIZE_HINT_QDEL
var/list/possible_armoury_templates = list()
var/datum/map_template/random_room/armoury/armoury_candidate

Check failure on line 211 in monkestation/code/game/objects/effects/spawners/roomspawner.dm

View workflow job for this annotation

GitHub Actions / Run Linters / linters

undefined type: /datum/map_template/random_room/armoury
shuffle_inplace(SSmapping.random_armoury_templates)
for(var/ID in SSmapping.random_armoury_templates)
armoury_candidate = SSmapping.random_armoury_templates[ID]
if(armoury_candidate.weight == 0 || room_height != armoury_candidate.template_height || room_width != armoury_candidate.template_width)

Check failure on line 215 in monkestation/code/game/objects/effects/spawners/roomspawner.dm

View workflow job for this annotation

GitHub Actions / Run Linters / linters

OD0404: Unknown identifier "template_width"

Check warning on line 215 in monkestation/code/game/objects/effects/spawners/roomspawner.dm

View workflow job for this annotation

GitHub Actions / Run Linters / linters

field access requires static type: "template_width"

Check warning on line 215 in monkestation/code/game/objects/effects/spawners/roomspawner.dm

View workflow job for this annotation

GitHub Actions / Run Linters / linters

field access requires static type: "template_height"

Check warning on line 215 in monkestation/code/game/objects/effects/spawners/roomspawner.dm

View workflow job for this annotation

GitHub Actions / Run Linters / linters

field access requires static type: "weight"
armoury_candidate = null
continue
possible_armoury_templates[armoury_candidate] = armoury_candidate.weight

Check failure on line 218 in monkestation/code/game/objects/effects/spawners/roomspawner.dm

View workflow job for this annotation

GitHub Actions / Run Linters / linters

OD0404: Type /datum/map_template/random_room/armoury does not exist

Check warning on line 218 in monkestation/code/game/objects/effects/spawners/roomspawner.dm

View workflow job for this annotation

GitHub Actions / Run Linters / linters

field access requires static type: "weight"
if(possible_armoury_templates.len)
var/datum/map_template/random_room/random_armoury/template = pick_weight(possible_armoury_templates)

Check failure on line 220 in monkestation/code/game/objects/effects/spawners/roomspawner.dm

View workflow job for this annotation

GitHub Actions / Run Linters / linters

undefined type: /datum/map_template/random_room/random_armoury
template.load(get_turf(src), centered = template.centerspawner)

Check failure on line 221 in monkestation/code/game/objects/effects/spawners/roomspawner.dm

View workflow job for this annotation

GitHub Actions / Run Linters / linters

OD0404: Type /datum/map_template/random_room/random_armoury does not exist

Check warning on line 221 in monkestation/code/game/objects/effects/spawners/roomspawner.dm

View workflow job for this annotation

GitHub Actions / Run Linters / linters

proc call requires static type: "load"
return INITIALIZE_HINT_QDEL
35 changes: 35 additions & 0 deletions monkestation/code/modules/random_rooms/armouries/armouries
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

/datum/map_template/random_room/random_armoury_base
name = "Default random Armoury"
room_id = "box_default_bar"
mappath = "_maps/~monkestation/RandomBars/Box/default_bar.dmm"
centerspawner = FALSE
template_height = 17
template_width = 11
weight = 6
station_name = "Box Station"

/datum/map_template/random_room/random_armoury_base/clockwork
name = "Clockwork Armoury"
room_id = ""
mappath = ""
weight = 1

/datum/map_template/random_room/random_armoury_base/russian_surplus
name = "USSRMOURY"
room_id = ""
mappath = ""
weight = 1

/datum/map_template/random_room/random_armoury_base/meat
name = "Meat Armaments"
room_id = ""
mappath = ""
weight = 1

/datum/map_template/random_room/random_armoury_base/sponsored_khemtek

/datum/map_template/random_room/random_armoury_base/trashed
/datum/map_template/random_room/random_armoury_base/sponsored_solgov
/datum/map_template/random_room/random_armoury_base/sponsored_

Loading