Skip to content

Commit

Permalink
Merge pull request #1 from Maldaris/new-tiles
Browse files Browse the repository at this point in the history
White Sands Tileset + Z-Level
  • Loading branch information
MarkSuckerberg committed Dec 27, 2020
2 parents 6a33f46 + da2b2f9 commit 8aaa902
Show file tree
Hide file tree
Showing 32 changed files with 68,362 additions and 53 deletions.
67,800 changes: 67,800 additions & 0 deletions _maps/map_files/Mining/Whitesands.dmm

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions code/__DEFINES/maps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@ require only minor tweaks.
#define ZTRAIT_AWAY "Away Mission"
#define ZTRAIT_SPACE_RUINS "Space Ruins"
#define ZTRAIT_LAVA_RUINS "Lava Ruins"
#define ZTRAIT_SAND_RUINS "Sand Ruins" //Wasp edit - Whitesands
#define ZTRAIT_ISOLATED_RUINS "Isolated Ruins" //Placing ruins on z levels with this trait will use turf reservation instead of usual placement.

// boolean - weather types that occur on the level
#define ZTRAIT_SNOWSTORM "Weather_Snowstorm"
#define ZTRAIT_ASHSTORM "Weather_Ashstorm"
#define ZTRAIT_ACIDRAIN "Weather_Acidrain"
#define ZTRAIT_TEMPERATURE_GRADIENT "Weather_Gradient" //Wasp edit - Whitesands

// number - bombcap is multiplied by this before being applied to bombs
#define ZTRAIT_BOMBCAP_MULTIPLIER "Bombcap Multiplier"

Expand Down Expand Up @@ -66,9 +73,16 @@ require only minor tweaks.
#define ZTRAITS_SPACE list(ZTRAIT_LINKAGE = CROSSLINKED, ZTRAIT_SPACE_RUINS = TRUE)
#define ZTRAITS_LAVALAND list(\
ZTRAIT_MINING = TRUE, \
ZTRAIT_ASHSTORM = TRUE, \
ZTRAIT_LAVA_RUINS = TRUE, \
ZTRAIT_BOMBCAP_MULTIPLIER = 2, \
ZTRAIT_BASETURF = /turf/open/lava/smooth/lava_land_surface)
#define ZTRAITS_WHITESANDS list(\
ZTRAIT_MINING = TRUE, \
ZTRAIT_TEMPERATURE_GRADIENT = TRUE, \
ZTRAIT_SAND_RUINS = TRUE, \
ZTRAIT_BOMBCAP_MULTIPLIER = 2, \
ZTRAIT_BASETURF = /turf/open/floor/plating/asteroid/whitesands)

#define DL_NAME "name"
#define DL_TRAITS "traits"
Expand Down
5 changes: 5 additions & 0 deletions code/__DEFINES/~wasp_defines/atmospherics.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/datum/gas_mixture/immutable/whitesands_planet
initial_temperature = T20C
var/ws_moles_amount

GLOBAL_DATUM_INIT(ws_planet_atmos, /datum/gas_mixture/immutable/whitesands_planet, new)
5 changes: 5 additions & 0 deletions code/controllers/configuration/entries/game_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@
integer = FALSE
min_val = 0

/datum/config_entry/number/whitesands_budget
config_entry_value = 60
integer = FALSE
min_val = 0

/datum/config_entry/number/space_budget
config_entry_value = 16
integer = FALSE
Expand Down
25 changes: 20 additions & 5 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SUBSYSTEM_DEF(mapping)
var/list/ruins_templates = list()
var/list/space_ruins_templates = list()
var/list/lava_ruins_templates = list()
var/list/sand_ruins_templates = list()
var/datum/space_level/isolated_ruins_z //Created on demand during ruin loading.

var/list/shuttle_templates = list()
Expand Down Expand Up @@ -96,6 +97,10 @@ SUBSYSTEM_DEF(mapping)
for (var/lava_z in lava_ruins)
spawn_rivers(lava_z)

var/list/sand_ruins = levels_by_trait(ZTRAIT_SAND_RUINS)
if (sand_ruins.len)
seedRuins(sand_ruins, CONFIG_GET(number/whitesands_budget), /area/whitesands/surface/outdoors/unexplored, sand_ruins_templates)

// Generate deep space ruins
var/list/space_ruins = levels_by_trait(ZTRAIT_SPACE_RUINS)
if (space_ruins.len)
Expand Down Expand Up @@ -169,6 +174,7 @@ SUBSYSTEM_DEF(mapping)
ruins_templates = SSmapping.ruins_templates
space_ruins_templates = SSmapping.space_ruins_templates
lava_ruins_templates = SSmapping.lava_ruins_templates
sand_ruins_templates = SSmapping.sand_ruins_templates
shuttle_templates = SSmapping.shuttle_templates
shelter_templates = SSmapping.shelter_templates
unused_turfs = SSmapping.unused_turfs
Expand Down Expand Up @@ -254,11 +260,18 @@ SUBSYSTEM_DEF(mapping)
++space_levels_so_far
add_new_zlevel("Empty Area [space_levels_so_far]", ZTRAITS_SPACE)

// load mining
if(config.minetype == "lavaland")
LoadGroup(FailedZs, "Lavaland", "map_files/Mining", "Lavaland.dmm", default_traits = ZTRAITS_LAVALAND)
else if (!isnull(config.minetype))
INIT_ANNOUNCE("WARNING: An unknown minetype '[config.minetype]' was set! This is being ignored! Update the maploader code!")
for(var/minetype in config.minetypes)
if(minetype == "random")
minetype = list(pickweightAllowZero(GLOB.mining_maps))
if(minetype == "lavaland")
LoadGroup(FailedZs, "Lavaland", "map_files/Mining", "Lavaland.dmm", default_traits = ZTRAITS_LAVALAND)
else if (minetype == "whitesands")
LoadGroup(FailedZs, "Whitesands", "map_files/Mining", "Whitesands.dmm", default_traits = ZTRAITS_WHITESANDS)
else if (!isnull(minetype) && minetype != "none")
INIT_ANNOUNCE("WARNING: An unknown minetype '[minetype]' was set! This is being ignored! Update the maploader code!")

GLOB.current_mining_map = pick(config.minetypes)

#endif

if(LAZYLEN(FailedZs)) //but seriously, unless the server's filesystem is messed up this will never happen
Expand Down Expand Up @@ -399,6 +412,8 @@ GLOBAL_LIST_EMPTY(the_station_areas)

if(istype(R, /datum/map_template/ruin/lavaland))
lava_ruins_templates[R.name] = R
// else if(istype(R, /datum/map_template/ruin/whitesands)) - TBA
sand_ruins_templates[R.name] = R
else if(istype(R, /datum/map_template/ruin/space))
space_ruins_templates[R.name] = R
else if(istype(R, /datum/map_template/ruin/station)) //Wasp - Random Engine Framework
Expand Down
15 changes: 15 additions & 0 deletions code/controllers/subsystem/weather.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SUBSYSTEM_DEF(weather)
runlevels = RUNLEVEL_GAME
var/list/processing = list()
var/list/eligible_zlevels = list()
var/list/temperature_gradients = list()
var/list/next_hit_by_zlevel = list() //Used by barometers to know when the next storm is coming

/datum/controller/subsystem/weather/fire()
Expand All @@ -33,6 +34,9 @@ SUBSYSTEM_DEF(weather)
var/randTime = rand(3000, 6000)
next_hit_by_zlevel["[z]"] = addtimer(CALLBACK(src, .proc/make_eligible, z, possible_weather), randTime + initial(W.weather_duration_upper), TIMER_UNIQUE|TIMER_STOPPABLE) //Around 5-10 minutes between weathers

for(var/mix in temperature_gradients)
fire_temperature_update(mix, temperature_gradients[mix])

/datum/controller/subsystem/weather/Initialize(start_timeofday)
for(var/V in subtypesof(/datum/weather))
var/datum/weather/W = V
Expand Down Expand Up @@ -78,3 +82,14 @@ SUBSYSTEM_DEF(weather)
A = W
break
return A

/datum/controller/subsystem/weather/proc/set_temperature_gradient(datum/gas_mixture/immutable/immutable_mix, rate = 1)
LAZYSET(temperature_gradients, immutable_mix, rate)

/datum/controller/subsystem/weather/proc/fire_temperature_update(datum/gas_mixture/immutable/mix, rate = 1)
if (!istype(mix))
CRASH("fire temperature update called on invalid mix: [mix]")
else
var/adjusted_time = (8640000 / SSticker.station_time_rate_multiplier) * rate
var/step = world.time % adjusted_time == 0 ? 0 : (world.time % adjusted_time) / adjusted_time
mix.tick_temperature_gradient(step)
22 changes: 18 additions & 4 deletions code/datums/map_config.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
//defaults to box
// -Cyberboss

GLOBAL_LIST_INIT(mining_maps, list("lavaland" = 0, "whitesands" = 1, "random" = 0))
GLOBAL_VAR_INIT(current_mining_map, "random")
GLOBAL_VAR_INIT(next_mining_map, "random")

/datum/map_config
// Metadata
var/config_filename = "_maps/boxstation.json"
Expand All @@ -22,7 +26,7 @@
var/space_ruin_levels = 7
var/space_empty_levels = 1

var/minetype = "lavaland"
var/list/minetypes = list("whitesands")

var/allow_custom_shuttles = TRUE
var/shuttles = list(
Expand Down Expand Up @@ -123,8 +127,10 @@
log_world("map_config space_empty_levels is not a number!")
return

if ("minetype" in json)
minetype = json["minetype"]
if (islist("minetype"))
minetypes = json["minetype"]
else if ("minetype" in json)
minetypes = list(json["minetype"])

allow_custom_shuttles = json["allow_custom_shuttles"] != FALSE

Expand All @@ -140,4 +146,12 @@
. += "_maps/[map_path]/[file]"

/datum/map_config/proc/MakeNextMap()
return config_filename == "data/next_map.json" || fcopy(config_filename, "data/next_map.json")
var/success = config_filename == "data/next_map.json" || fcopy(config_filename, "data/next_map.json")
var/json = file("data/next_map.json")
json = file2text(json)
json = json_decode(json)
json["minetype"] = GLOB.next_mining_map
json = json_encode(json)
fdel("data/next_map.json")
json = text2file(json, "data/next_map.json")
return success
137 changes: 108 additions & 29 deletions code/datums/weather/weather.dm
Original file line number Diff line number Diff line change
@@ -1,50 +1,94 @@
//The effects of weather occur across an entire z-level. For instance, lavaland has periodic ash storms that scorch most unprotected creatures.
/**
* Causes weather to occur on a z level in certain area types
*
* The effects of weather occur across an entire z-level. For instance, lavaland has periodic ash storms that scorch most unprotected creatures.
* Weather always occurs on different z levels at different times, regardless of weather type.
* Can have custom durations, targets, and can automatically protect indoor areas.
*
*/

/datum/weather
/// name of weather
var/name = "space wind"
/// description of weather
var/desc = "Heavy gusts of wind blanket the area, periodically knocking down anyone caught in the open."

var/telegraph_message = "<span class='warning'>The wind begins to pick up.</span>" //The message displayed in chat to foreshadow the weather's beginning
var/telegraph_duration = 300 //In deciseconds, how long from the beginning of the telegraph until the weather begins
var/telegraph_sound //The sound file played to everyone on an affected z-level
var/telegraph_overlay //The overlay applied to all tiles on the z-level

var/weather_message = "<span class='userdanger'>The wind begins to blow ferociously!</span>" //Displayed in chat once the weather begins in earnest
var/weather_duration = 1200 //In deciseconds, how long the weather lasts once it begins
var/weather_duration_lower = 1200 //See above - this is the lowest possible duration
var/weather_duration_upper = 1500 //See above - this is the highest possible duration
/// The message displayed in chat to foreshadow the weather's beginning
var/telegraph_message = "<span class='warning'>The wind begins to pick up.</span>"
/// In deciseconds, how long from the beginning of the telegraph until the weather begins
var/telegraph_duration = 300
/// The sound file played to everyone on an affected z-level
var/telegraph_sound
/// The overlay applied to all tiles on the z-level
var/telegraph_overlay

/// Displayed in chat once the weather begins in earnest
var/weather_message = "<span class='userdanger'>The wind begins to blow ferociously!</span>"
/// In deciseconds, how long the weather lasts once it begins
var/weather_duration = 1200
/// See above - this is the lowest possible duration
var/weather_duration_lower = 1200
/// See above - this is the highest possible duration
var/weather_duration_upper = 1500
/// Looping sound while weather is occuring
var/weather_sound
/// Area overlay while the weather is occuring
var/weather_overlay
/// Color to apply to the area while weather is occuring
var/weather_color = null

var/end_message = "<span class='danger'>The wind relents its assault.</span>" //Displayed once the weather is over
var/end_duration = 300 //In deciseconds, how long the "wind-down" graphic will appear before vanishing entirely
/// Displayed once the weather is over
var/end_message = "<span class='danger'>The wind relents its assault.</span>"
/// In deciseconds, how long the "wind-down" graphic will appear before vanishing entirely
var/end_duration = 300
/// Sound that plays while weather is ending
var/end_sound
/// Area overlay while weather is ending
var/end_overlay

var/area_type = /area/space //Types of area to affect
var/list/impacted_areas = list() //Areas to be affected by the weather, calculated when the weather begins
var/list/protected_areas = list()//Areas that are protected and excluded from the affected areas.
var/impacted_z_levels // The list of z-levels that this weather is actively affecting

var/overlay_layer = AREA_LAYER //Since it's above everything else, this is the layer used by default. TURF_LAYER is below mobs and walls if you need to use that.
/// Types of area to affect
var/area_type = /area/space
/// TRUE value protects areas with outdoors marked as false, regardless of area type
var/protect_indoors = FALSE
/// Areas to be affected by the weather, calculated when the weather begins
var/list/impacted_areas = list()
/// Areas that are protected and excluded from the affected areas.
var/list/protected_areas = list()
/// The list of z-levels that this weather is actively affecting
var/impacted_z_levels

/// Since it's above everything else, this is the layer used by default. TURF_LAYER is below mobs and walls if you need to use that.
var/overlay_layer = AREA_LAYER
/// Plane for the overlay
var/overlay_plane = BLACKNESS_PLANE
var/aesthetic = FALSE //If the weather has no purpose other than looks
var/immunity_type = "storm" //Used by mobs to prevent them from being affected by the weather
/// If the weather has no purpose other than looks
var/aesthetic = FALSE
/// Used by mobs to prevent them from being affected by the weather
var/immunity_type = "storm"

var/stage = END_STAGE //The stage of the weather, from 1-4
/// The stage of the weather, from 1-4
var/stage = END_STAGE

// These are read by the weather subsystem and used to determine when and where to run the weather.
var/probability = 0 // Weight amongst other eligible weather. If zero, will never happen randomly.
var/target_trait = ZTRAIT_STATION // The z-level trait to affect when run randomly or when not overridden.
/// Weight amongst other eligible weather. If zero, will never happen randomly.
var/probability = 0
/// The z-level trait to affect when run randomly or when not overridden.
var/target_trait = ZTRAIT_STATION

/// Whether a barometer can predict when the weather will happen
var/barometer_predictable = FALSE
var/next_hit_time = 0 //For barometers to know when the next storm will hit
/// For barometers to know when the next storm will hit
var/next_hit_time = 0

/datum/weather/New(z_levels)
..()
impacted_z_levels = z_levels

/**
* Telegraphs the beginning of the weather on the impacted z levels
*
* Sends sounds and details to mobs in the area
* Calculates duration and hit areas, and makes a callback for the actual weather to start
*
*/
/datum/weather/proc/telegraph()
if(stage == STARTUP_STAGE)
return
Expand All @@ -56,6 +100,8 @@
affectareas -= get_areas(V)
for(var/V in affectareas)
var/area/A = V
if(protect_indoors && !A.outdoors)
continue
if(A.z in impacted_z_levels)
impacted_areas |= A
weather_duration = rand(weather_duration_lower, weather_duration_upper)
Expand All @@ -70,6 +116,13 @@
SEND_SOUND(M, sound(telegraph_sound))
addtimer(CALLBACK(src, .proc/start), telegraph_duration)

/**
* Starts the actual weather and effects from it
*
* Updates area overlays and sends sounds and messages to mobs to notify them
* Begins dealing effects from weather to mobs in the area
*
*/
/datum/weather/proc/start()
if(stage >= MAIN_STAGE)
return
Expand All @@ -84,6 +137,13 @@
SEND_SOUND(M, sound(weather_sound))
addtimer(CALLBACK(src, .proc/wind_down), weather_duration)

/**
* Weather enters the winding down phase, stops effects
*
* Updates areas to be in the winding down phase
* Sends sounds and messages to mobs to notify them
*
*/
/datum/weather/proc/wind_down()
if(stage >= WIND_DOWN_STAGE)
return
Expand All @@ -98,26 +158,45 @@
SEND_SOUND(M, sound(end_sound))
addtimer(CALLBACK(src, .proc/end), end_duration)

/**
* Fully ends the weather
*
* Effects no longer occur and area overlays are removed
* Removes weather from processing completely
*
*/
/datum/weather/proc/end()
if(stage == END_STAGE)
return 1
stage = END_STAGE
STOP_PROCESSING(SSweather, src)
update_areas()

/datum/weather/proc/can_weather_act(mob/living/L) //Can this weather impact a mob?
/**
* Returns TRUE if the living mob can be affected by the weather
*
*/
/datum/weather/proc/can_weather_act(mob/living/L)
var/turf/mob_turf = get_turf(L)
if(mob_turf && !(mob_turf.z in impacted_z_levels))
return
if(immunity_type in L.weather_immunities)
return
if(!(get_area(L) in impacted_areas))
return
return 1
return TRUE

/datum/weather/proc/weather_act(mob/living/L) //What effect does this weather have on the hapless mob?
/**
* Affects the mob with whatever the weather does
*
*/
/datum/weather/proc/weather_act(mob/living/L)
return

/**
* Updates the overlays on impacted areas
*
*/
/datum/weather/proc/update_areas()
for(var/V in impacted_areas)
var/area/N = V
Expand Down
Loading

0 comments on commit 8aaa902

Please sign in to comment.