Skip to content

Commit

Permalink
feat(FTL): better takeoff/landing, tweaked mapgen, increased test map…
Browse files Browse the repository at this point in the history
…'s size
  • Loading branch information
Filatelele authored Jul 1, 2024
1 parent e4e0968 commit e3d3756
Show file tree
Hide file tree
Showing 44 changed files with 4,727 additions and 3,478 deletions.
7 changes: 7 additions & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@
#include "code\controllers\subsystems\lighting.dm"
#include "code\controllers\subsystems\lobby.dm"
#include "code\controllers\subsystems\machines.dm"
#include "code\controllers\subsystems\mapgen.dm"
#include "code\controllers\subsystems\mapping.dm"
#include "code\controllers\subsystems\misc_late.dm"
#include "code\controllers\subsystems\open_space.dm"
Expand Down Expand Up @@ -460,6 +461,7 @@
#include "code\datums\helper_datums\teleport.dm"
#include "code\datums\helper_datums\topic_input.dm"
#include "code\datums\looping_sound\looping_sound.dm"
#include "code\datums\looping_sound\ship_engines.dm"
#include "code\datums\looping_sound\weather.dm"
#include "code\datums\movement\_defines.dm"
#include "code\datums\movement\atom_movable.dm"
Expand Down Expand Up @@ -2068,6 +2070,11 @@
#include "code\modules\mapgen\atmosphere\_atmosphere.dm"
#include "code\modules\mapgen\planetary\_PlanetGenerator.dm"
#include "code\modules\mapgen\planetary\AsteroidGenerator.dm"
#include "code\modules\mapgen\planetary\BeachGenerator.dm"
#include "code\modules\mapgen\planetary\JungleGenerator.dm"
#include "code\modules\mapgen\planetary\LavaGenerator.dm"
#include "code\modules\mapgen\planetary\RockGenerator.dm"
#include "code\modules\mapgen\planetary\SnowGenerator.dm"
#include "code\modules\mapgen\planetary\SwampGenerator.dm"
#include "code\modules\mapgen\prefabs\_mapgen_area.dm"
#include "code\modules\mapgen\prefabs\map_templates.dm"
Expand Down
1 change: 0 additions & 1 deletion code/__defines/overmap.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#define FIRE_MODE_ANTI_AIR 1
#define FIRE_MODE_TORPEDO 2
#define FIRE_MODE_AMS_LASER 3
Expand Down
1 change: 1 addition & 0 deletions code/__defines/subsystem-priority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Normal
#define SS_PRIORITY_PROMETHEUS 100
#define SS_PRIORITY_TICKER 100 // Gameticker.
#define SS_PRIORITY_MAPGEN 99
#define SS_PRIORITY_MOB 95 // Mob Life().
#define SS_PRIORITY_MACHINERY 95 // Machinery + powernet ticks.
#define SS_PRIORITY_PHYSICS 94
Expand Down
9 changes: 9 additions & 0 deletions code/_helpers/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ GLOBAL_LIST_EMPTY(station_areas)
/proc/is_not_space_area(area/A)
. = !istype(A, /area/space)

/proc/is_space_area(area/A)
. = istype(A, /area/space)

/proc/is_space_or_mapgen_area(area/A)
. = istype(A, /area/space) || istype(A, /area/generated)

/proc/is_generated_area(area/A)
. = istype(A, /area/generated)

/proc/is_outside_area(area/A)
return A.environment_type == ENVIRONMENT_OUTSIDE

Expand Down
2 changes: 0 additions & 2 deletions code/controllers/subsystems/announce.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ SUBSYSTEM_DEF(announce)
if(!C || !should_recieve_announce(M, zlevels))
continue

M.playsound_local(M.loc, pick('sound/signals/anounce1.ogg', 'sound/signals/anounce2.ogg', 'sound/signals/anounce3.ogg'), 75)

var/datum/announcer/A = get_announcer(M)
var/sound = sound_override || A.sounds[announce_type]

Expand Down
68 changes: 68 additions & 0 deletions code/controllers/subsystems/mapgen.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
SUBSYSTEM_DEF(mapgen)
name = "Mapgen"
wait = 1 SECOND
priority = SS_PRIORITY_MAPGEN

/// Current mapgen datum.
var/datum/map_generator/current_mapgen = null
/// List of all turfs that will be changed by mapgen
var/list/turfs = list()
var/list/generated_turfs = list()
var/list/smooth_queue = list()

/datum/controller/subsystem/mapgen/fire(resumed = FALSE)
while(turfs.len)
var/turf/gen_turf = turfs[turfs.len]
if(!istype(gen_turf))
continue

current_mapgen.generate_turf(gen_turf, CHANGETURF_IGNORE_AIR | CHANGETURF_DEFER_CHANGE | CHANGETURF_DEFER_BATCH)
generated_turfs |= gen_turf
turfs.len --
if(MC_TICK_CHECK)
return

while(generated_turfs.len)
var/turf/generated = generated_turfs[generated_turfs.len]
if(!istype(generated))
continue

var/neighbors = RANGE_TURFS(1, generated)
smooth_queue |= generated
for(var/turf/T in neighbors)
smooth_queue |= T

for(var/turf/space/S in neighbors)
S.update_starlight()

generated_turfs.len--
if(MC_TICK_CHECK)
return

while(smooth_queue.len)
var/turf/to_smooth = smooth_queue[smooth_queue.len]
if(!istype(to_smooth))
continue

to_smooth.update_icon()
smooth_queue.len--
if(MC_TICK_CHECK)
return

if(!turfs.len && !generated_turfs.len && !smooth_queue.len)
current_mapgen = null

/datum/controller/subsystem/mapgen/Recover()
current_mapgen = SSmapgen.current_mapgen
turfs = SSmapgen.turfs
generated_turfs = SSmapgen.generated_turfs
smooth_queue = SSmapgen.smooth_queue

// Some queueing mechanism is needed, but not now, not now.
/datum/controller/subsystem/mapgen/proc/generate(datum/map_generator/mapgen, list/turfs)
if(!current_mapgen)
current_mapgen = mapgen
src.turfs = turfs.Copy()
return TRUE
else
return FALSE
12 changes: 11 additions & 1 deletion code/controllers/subsystems/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ SUBSYSTEM_DEF(mapping)
initialize_biomes()
preloadTemplates()
preloadHolodeckTemplates()
preload_level_masks()
lateload_map_zlevels()
return ..()

Expand Down Expand Up @@ -41,11 +42,20 @@ SUBSYSTEM_DEF(mapping)
var/datum/biome/biome_instance = new biome_path()
biomes[biome_path] += biome_instance

/datum/controller/subsystem/mapping/proc/preload_level_masks()
for(var/level = 1; level <= length(GLOB.using_map.map_levels); level++)
var/datum/space_level/L = GLOB.using_map.map_levels[level]

if(!isnull(L.ftl_mask))
L.ftl_mask = new L.ftl_mask()

if(!isnull(L?.mapgen_mask))
L.mapgen_mask = new L.mapgen_mask()

/datum/controller/subsystem/mapping/proc/lateload_map_zlevels()
GLOB.using_map.perform_map_generation(TRUE)

/datum/controller/subsystem/mapping/proc/add_new_zlevel(name, traits = list(), z_type = /datum/space_level)
var/new_z = GLOB.using_map.map_levels.len + 1
var/datum/space_level/S = new z_type()
GLOB.using_map.map_levels.Add(S)
return S
1 change: 1 addition & 0 deletions code/datums/extensions/ship_engines/_engine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ GLOBAL_LIST_EMPTY(ship_engines)

/datum/extension/ship_engine/proc/is_on()
var/obj/machinery/M = holder
M.power_change()
if(M.use_power && M.operable(MAINT))
if(next_on > world.time)
return FALSE
Expand Down
9 changes: 9 additions & 0 deletions code/datums/looping_sound/ship_engines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/datum/looping_sound/ship/engine
mid_sounds = list(
'sound/effects/ship/engine_rocket_loop.ogg' = 1
)
mid_length = 9 SECONDS
start_sound = 'sound/effects/ship/env_ship_up.ogg'
start_length = 4.5 SECONDS
end_sound = 'sound/effects/ship/env_ship_down.ogg'
volume = 100
17 changes: 11 additions & 6 deletions code/modules/mapgen/_MapGenerator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
/// Turf that will be placed on map's edge (7 turfs border)
var/turf/edgeturf

var/list/turf/smooth_queue = list()

/// Given a list of turfs, asynchronously changes a list of turfs and their areas.
/// Does not fill them with objects; this should be done with populate_turfs.
/// This is a wrapper proc for generate_turf(), handling batch processing of turfs.
Expand All @@ -27,25 +29,28 @@
if(!istype(gen_turf))
continue

// deferring AfterChange() means we don't get huge atmos flows in the middle of making changes
generate_turf(gen_turf, CHANGETURF_IGNORE_AIR | CHANGETURF_DEFER_CHANGE | CHANGETURF_DEFER_BATCH)
CHECK_TICK

for(var/turf/gen_turf in turfs)
if(!istype(gen_turf))
continue

//gen_turf.AfterChange(CHANGETURF_IGNORE_AIR)

//QUEUE_SMOOTH(gen_turf)
//QUEUE_SMOOTH_NEIGHBORS(gen_turf)
var/neighbors = RANGE_TURFS(1, gen_turf)
smooth_queue |= gen_turf
for(var/turf/T in neighbors)
smooth_queue |= T

for(var/turf/space/S in RANGE_TURFS(1, gen_turf))
for(var/turf/space/S in neighbors)
S.update_starlight()

// CHECK_TICK here is fine -- we are assuming that the turfs we're generating are staying relatively constant
CHECK_TICK

for(var/turf/simulated/floor/asteroid/A in smooth_queue)
A.update_icon()
CHECK_TICK

message = "MAPGEN: MAPGEN REF [any2ref(src)] ([type]) HAS FINISHED TURF GEN IN [(REALTIMEOFDAY - start_time)/10]s"
to_world_log(message)

Expand Down
30 changes: 17 additions & 13 deletions code/modules/mapgen/planetary/BeachGenerator.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/area/generated/planetoid/beachplanet
area_flags = AREA_FLAG_CAVES_ALLOWED
base_turf = /turf/simulated/floor/asteroid/beach/grass

/datum/map_generator/planet_generator/beach
mountain_height = 0.95
perlin_zoom = 75

primary_area_type = /area/overmap_encounter/planetoid/beachplanet
primary_area_type = /area/generated/planetoid/beachplanet

biome_table = list(
BIOME_COLDEST = list(
Expand Down Expand Up @@ -112,9 +116,9 @@
/datum/biome/grass/dense
flora_spawn_chance = 70
mob_spawn_list = list(
/mob/living/simple_animal/butterfly = 4,
/mob/living/simple_animal/hostile/retaliate/poison/snake = 5,
/mob/living/simple_animal/hostile/poison/bees = 3,
//mob/living/simple_animal/butterfly = 4,
///mob/living/simple_animal/hostile/retaliate/poison/snake = 5,
//mob/living/simple_animal/hostile/poison/bees = 3,
)
mob_spawn_chance = 2
feature_spawn_chance = 0.1
Expand All @@ -123,7 +127,7 @@
open_turf_types = list(/turf/simulated/floor/asteroid/beach = 1)
mob_spawn_list = list(
/mob/living/simple_animal/crab = 7,
/mob/living/simple_animal/hostile/asteroid/lobstrosity/beach = 5
//mob/living/simple_animal/hostile/asteroid/lobstrosity/beach = 5
)
mob_spawn_chance = 1
flora_spawn_list = list(
Expand All @@ -148,7 +152,7 @@
open_turf_types = list(/turf/simulated/floor/asteroid/beach/water = 1)
flora_spawn_list = list(
/obj/structure/rock/basalt = 1,
/obj/structure/basalt/pile = 1,
//obj/structure/basalt/pile = 1,
)
flora_spawn_chance = 1

Expand All @@ -161,20 +165,20 @@
flora_spawn_chance = 4
flora_spawn_list = list(
/obj/structure/flora/tree/palm = 1,
/obj/structure/flora/rock/basalt = 1,
//obj/structure/flora/rock/basalt = 1,
/obj/structure/rock/pile = 6
)
mob_spawn_chance = 1
mob_spawn_list = list(
/mob/living/simple_animal/hostile/bear/cave = 5,
/mob/living/simple_animal/hostile/asteroid/lobstrosity/beach = 1,
//mob/living/simple_animal/hostile/bear/cave = 5,
//mob/living/simple_animal/hostile/asteroid/lobstrosity/beach = 1,
)

/datum/biome/cave/beach/cove
open_turf_types = list(/turf/simulated/floor/asteroid/beach = 1)
flora_spawn_list = list(
/obj/structure/flora/tree/pine/dead = 1,
/obj/structure/flora/rock/basalt = 1,
//obj/structure/flora/rock/basalt = 1,
/obj/structure/flora/driftwood = 3,
/obj/structure/flora/driftlog = 2
)
Expand All @@ -200,7 +204,7 @@
)
mob_spawn_chance = 5
mob_spawn_list = list(
/mob/living/simple_animal/butterfly = 1,
/mob/living/simple_animal/slime/pet = 1,
/mob/living/simple_animal/hostile/lightgeist = 1
//mob/living/simple_animal/butterfly = 1,
//mob/living/simple_animal/slime/pet = 1,
//mob/living/simple_animal/hostile/lightgeist = 1
)
27 changes: 7 additions & 20 deletions code/modules/mapgen/planetary/JungleGenerator.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/area/overmap_encounter/planetoid/jungle
area_flags = AREA_FLAG_CAVES_ALLOWED
base_turf = /turf/simulated/floor/asteroid/jungle

/datum/map_generator/planet_generator/jungle
perlin_zoom = 65
mountain_height = 0.85
Expand Down Expand Up @@ -98,9 +102,7 @@
flora_spawn_chance = 90
mob_spawn_chance = 0.3
mob_spawn_list = list(
/mob/living/carbon/monkey = 10,
/mob/living/simple_animal/hostile/retaliate/chicken = 10,
/obj/effect/spawner/lootdrop/chicken/jungle/flock = 1
/mob/living/carbon/human/monkey = 10,
)

/datum/biome/jungle/dense
Expand All @@ -121,19 +123,15 @@
)
mob_spawn_chance = 0.6
mob_spawn_list = list(
/mob/living/simple_animal/hostile/gorilla = 1,
/mob/living/carbon/monkey = 6,
/mob/living/simple_animal/hostile/retaliate/chicken = 4,
/obj/effect/spawner/lootdrop/chicken/jungle/flock = 1
/mob/living/carbon/human/monkey = 6,
)

/datum/biome/jungle/plains
open_turf_types = list(/turf/simulated/floor/asteroid/jungle/ = 1)
flora_spawn_chance = 50
mob_spawn_chance = 1
mob_spawn_list = list(
/mob/living/carbon/monkey = 1,
/mob/living/simple_animal/hostile/retaliate/chicken = 1
/mob/living/carbon/human/monkey = 1,
)

/datum/biome/mudlands
Expand All @@ -147,7 +145,6 @@
)
flora_spawn_chance = 20
mob_spawn_chance = 0.05
mob_spawn_list = list(/mob/living/simple_animal/hostile/poison/giant_spider/tarantula = 1)

/datum/biome/jungle_wasteland
open_turf_types = list(/turf/simulated/floor/asteroid/jungle/wasteland = 1)
Expand All @@ -170,9 +167,6 @@
)
mob_spawn_chance = 1
mob_spawn_list = list(
/mob/living/simple_animal/hostile/asteroid/wolf/random = 1,
/mob/living/simple_animal/hostile/retaliate/bat = 1,
/mob/living/simple_animal/hostile/retaliate/poison/snake = 1
)
feature_spawn_chance = 0.5
feature_spawn_list = list(
Expand All @@ -185,7 +179,6 @@
/obj/structure/flora/ausbushes/jungleflora/busha = 1,
/obj/structure/flora/ausbushes/jungleflora/bushb = 1,
/obj/structure/flora/ausbushes/jungleflora/bushc = 1,
/obj/structure/flora/ausbushes/jungleflora/bush/large = 1,
/obj/structure/flora/jungleflora/rock/large = 1,
/obj/structure/flora/ausbushes/jungleflora/grassa = 1,
/obj/structure/flora/ausbushes/jungleflora/grassb = 1,
Expand Down Expand Up @@ -220,17 +213,11 @@
)
mob_spawn_chance = 1
mob_spawn_list = list(
/mob/living/simple_animal/hostile/poison/bees = 1,
/mob/living/simple_animal/hostile/mushroom = 1,
/mob/living/simple_animal/pet/dog/corgi/capybara = 1
)

/datum/biome/cave/lush/bright
open_turf_types = list(/turf/simulated/floor/asteroid/jungle = 12, /turf/simulated/floor/asteroid/jungle/water = 1)
flora_spawn_chance = 40
mob_spawn_chance = 1
mob_spawn_list = list(
mob/living/simple_animal/hostile/lightgeist = 1
)
feature_spawn_chance = 0.1
feature_spawn_list = list(/obj/item/staff/plague_bell = 1)
Loading

0 comments on commit e3d3756

Please sign in to comment.