Skip to content
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

Splitting some small changes out of trench PR. #3756

Merged
merged 6 commits into from
Mar 7, 2024
Merged
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
36 changes: 22 additions & 14 deletions code/game/objects/effects/effect_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,35 +98,43 @@ steam.start() -- spawns the effect
icon = 'icons/effects/effects.dmi'
anchored = TRUE
mouse_opacity = MOUSE_OPACITY_UNCLICKABLE
var/spark_sound = "sparks"

/obj/effect/sparks/struck
spark_sound = "light_bic"

/obj/effect/sparks/Initialize()
. = ..()
QDEL_IN(src, 5 SECONDS)
playsound(src.loc, "sparks", 100, 1)
var/turf/T = src.loc
if (isturf(T))
T.hotspot_expose(1000,100)
playsound(loc, spark_sound, 100, 1)
if(isturf(loc))
var/turf/T = loc
T.spark_act()

/obj/effect/sparks/Destroy()
var/turf/T = src.loc
if (isturf(T))
T.hotspot_expose(1000,100)
if(isturf(loc))
var/turf/T = loc
T.spark_act()
return ..()

/obj/effect/sparks/Move()
..()
var/turf/T = src.loc
if (isturf(T))
T.hotspot_expose(1000,100)
. = ..()
if(. && isturf(loc))
var/turf/T = loc
T.spark_act()

/proc/spark_at(turf/location, amount = 3, cardinal_only = FALSE, holder = null)
var/datum/effect/effect/system/spark_spread/sparks = new()
/proc/spark_at(turf/location, amount = 3, cardinal_only = FALSE, holder = null, spark_type = /datum/effect/effect/system/spark_spread)
var/datum/effect/effect/system/spark_spread/sparks = new spark_type
sparks.set_up(amount, cardinal_only, location)
if(holder)
sparks.attach(holder)
sparks.start()

/datum/effect/effect/system/spark_spread
var/spark_type = /obj/effect/sparks

/datum/effect/effect/system/spark_spread/non_electrical
spark_type = /obj/effect/sparks/struck

/datum/effect/effect/system/spark_spread/set_up(n = 3, c = 0, loca)
if(n > 10)
Expand All @@ -147,7 +155,7 @@ steam.start() -- spawns the effect
set waitfor = 0
if(holder)
src.location = get_turf(holder)
var/obj/effect/sparks/sparks = new /obj/effect/sparks(location)
var/obj/effect/sparks/sparks = new spark_type(location)
var/direction
if(src.cardinals)
direction = pick(global.cardinal)
Expand Down
26 changes: 26 additions & 0 deletions code/game/objects/items/rock.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/obj/item/rock
name = "rock"
icon = 'icons/obj/items/rock.dmi'
desc = "The secret is to bang the rocks together, guys."
sharp = TRUE
edge = TRUE
force = 3
material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME

/obj/item/rock/Initialize()
. = ..()
set_extension(src, /datum/extension/tool/variable, list(
TOOL_HATCHET = TOOL_QUALITY_BAD,
TOOL_SHOVEL = TOOL_QUALITY_WORST
))

// TODO: craft a flint striker from a flint and a piece of metal
/obj/item/rock/attackby(obj/item/W, mob/user)
if(W.material?.ferrous && material?.type == /decl/material/solid/stone/flint)
spark_at(get_turf(src), amount = 2, spark_type = /datum/effect/effect/system/spark_spread/non_electrical)
return TRUE
. = ..()

/obj/item/rock/striker/Initialize(var/ml, var/material_key)
material_key = /decl/material/solid/hematite
return ..()
5 changes: 5 additions & 0 deletions code/game/objects/structures/fires.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@
if(oxidizer.gas_flags & XGM_GAS_OXIDIZER)
return TRUE

/obj/structure/fire_source/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
. = ..()
if(!QDELETED(src))
light()

/obj/structure/fire_source/proc/light(var/force)
if(!check_atmos())
return FALSE
Expand Down
9 changes: 8 additions & 1 deletion code/game/turfs/exterior/exterior_dirt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
footstep_type = /decl/footsteps/asteroid
is_fundament_turf = TRUE

/turf/exterior/dirt/fluid_act(var/datum/reagents/fluids)
SHOULD_CALL_PARENT(FALSE)
var/turf/new_turf = ChangeTurf(/turf/exterior/mud, keep_air = TRUE, keep_air_below = TRUE)
return new_turf.fluid_act(fluids)


/turf/exterior/wall/dirt
material = /decl/material/solid/soil
color = COLOR_BEASTY_BROWN
color = "#41311b"

17 changes: 17 additions & 0 deletions code/game/turfs/exterior/exterior_mud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
/turf/exterior/clay/get_diggable_resources()
return dug ? null : list(/obj/item/stack/material/ore/clay = list(3, 2))

/turf/exterior/clay/drop_diggable_resources()
if(!dug && prob(15))
new /obj/item/rock(src, /decl/material/solid/stone/flint)
return ..()

/turf/exterior/clay/flooded
flooded = /decl/material/liquid/water

Expand All @@ -20,6 +25,12 @@
footstep_type = /decl/footsteps/mud
is_fundament_turf = TRUE

/turf/exterior/mud/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(!reagents?.total_volume)
ChangeTurf(/turf/exterior/dry, keep_air = TRUE, keep_air_below = TRUE)
return
return ..()

/turf/exterior/mud/water
color = COLOR_SKY_BLUE
reagent_type = /decl/material/liquid/water
Expand All @@ -38,3 +49,9 @@
dirt_color = "#ae9e66"
icon = 'icons/turf/exterior/seafloor.dmi'
is_fundament_turf = TRUE

/turf/exterior/dry/fluid_act(datum/reagents/fluids)
SHOULD_CALL_PARENT(FALSE)
var/turf/new_turf = ChangeTurf(/turf/exterior/mud, keep_air = TRUE, keep_air_below = TRUE)
return new_turf.fluid_act(fluids)

11 changes: 8 additions & 3 deletions code/game/turfs/exterior/exterior_sand.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
icon_has_corners = TRUE
possible_states = 4

/turf/exterior/sand/get_diggable_resources()
return dug ? null : list(/obj/item/stack/material/ore/sand = list(3, 2))

/turf/exterior/sand/drop_diggable_resources()
if(!dug && prob(15))
new /obj/item/rock(src, /decl/material/solid/stone/flint)
return ..()

/turf/exterior/sand/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if((temperature > T0C + 1700 && prob(5)) || temperature > T0C + 3000)
handle_melting()
Expand All @@ -22,9 +30,6 @@
color = COLOR_BLUE
height = -(FLUID_DEEP)

/turf/exterior/sand/get_diggable_resources()
return dug ? null : list(/obj/item/stack/material/ore/sand = list(3, 2))

/turf/exterior/sand/handle_melting(list/meltable_materials)
. = ..()
if(icon_state != "glass")
Expand Down
9 changes: 9 additions & 0 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,15 @@
if(fluid_depth <= FLUID_DEEP)
return "mask_deep"

/turf/proc/spark_act(obj/effect/sparks/sparks)
if(simulated)
hotspot_expose(1000,100)
if(prob(25))
for(var/obj/structure/fire_source/fire in contents)
fire.light()
return TRUE
return FALSE

/turf/get_alt_interactions(mob/user)
. = ..()
LAZYADD(., /decl/interaction_handler/show_turf_contents)
Expand Down
1 change: 1 addition & 0 deletions code/modules/materials/_materials.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay)
var/hardness = MAT_VALUE_HARD // Used for edge damage in weapons.
var/reflectiveness = MAT_VALUE_DULL

var/ferrous = FALSE // Can be used as a striker for firemaking.
var/weight = MAT_VALUE_NORMAL // Determines blunt damage/throwforce for weapons.

// Noise when someone is faceplanted onto a table made of this material.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
/decl/material/solid/carbon = 0.02
)
default_solid_form = /obj/item/stack/material/sheet
ferrous = TRUE

/decl/material/solid/metal/steel/generate_recipes(stack_type, reinforce_material)
. = ..()
Expand Down Expand Up @@ -261,6 +262,7 @@
exoplanet_rarity_gas = MAT_RARITY_NOWHERE
dissolves_in = MAT_SOLVENT_IMMUNE
dissolves_into = null
ferrous = TRUE

/decl/material/solid/metal/aluminium
name = "aluminium"
Expand Down Expand Up @@ -314,6 +316,7 @@
exoplanet_rarity_gas = MAT_RARITY_NOWHERE
dissolves_in = MAT_SOLVENT_IMMUNE
dissolves_into = null
ferrous = TRUE

/decl/material/solid/metal/plasteel/generate_recipes(stack_type, reinforce_material)
. = ..()
Expand Down Expand Up @@ -418,6 +421,7 @@
construction_difficulty = MAT_VALUE_NORMAL_DIY
reflectiveness = MAT_VALUE_MATTE
taste_description = "metal"
ferrous = TRUE

/decl/material/solid/metal/iron/affect_ingest(var/mob/living/M, var/removed, var/datum/reagents/holder)
if(M.HasTrait(/decl/trait/metabolically_inert))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@
rich_material_weight = 20
ore_type_value = ORE_SURFACE
ore_data_value = 1
ferrous = TRUE

/decl/material/solid/rutile
name = "rutile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@
. += new/datum/stack_recipe/furniture/planting_bed(src)
. += new/datum/stack_recipe/fountain(src)

// Placeholder for firemaking.
/decl/material/solid/stone/sandstone
name = "sandstone"
uid = "solid_sandstone"
lore_text = "A clastic sedimentary rock. The cost of boosting it to orbit is almost universally much higher than the actual value of the material."
value = 1.5
melting_point = T0C + 600

/decl/material/solid/stone/flint
name = "flint"
uid = "solid_flint"
lore_text = "A hard, smooth stone traditionally used for making fire."
value = 3
color = "#615f5f"

/decl/material/solid/stone/granite
name = "granite"
uid = "solid_granite"
Expand Down
130 changes: 130 additions & 0 deletions code/modules/random_map/noise/forage.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// These are foul, but apparent we can't reliably access z-level strata during
// SSmapping gen. Using /atom/movable so they don't show up in the mapper.
/atom/movable/spawn_boulder
name = "material boulder spawner"
is_spawnable_type = FALSE
simulated = FALSE
var/spawn_type = /obj/structure/boulder

/atom/movable/spawn_boulder/Initialize()
..()
if(isturf(loc))
if(islist(spawn_type))
spawn_type = pickweight(spawn_type)
new spawn_type(loc, SSmaterials.get_strata_material_type(loc))
return INITIALIZE_HINT_QDEL

/atom/movable/spawn_boulder/rock
name = "material rock spawner"
spawn_type = list(
/obj/item/rock = 10,
/obj/item/rock/striker = 1
)

/datum/random_map/noise/forage
target_turf_type = null
var/static/list/forage = list(
"rocks" = list(
/atom/movable/spawn_boulder,
/atom/movable/spawn_boulder/rock
),
"caves" = list(
"plumphelmet",
"glowbell",
"caverncandle",
"weepingmoon",
"towercap"
),
"shallows" = list(
"rice",
"mollusc",
"clam",
"sugarcane"
),
"cave_shallows" = list(
"algae",
"mollusc",
"clam"
),
"grass" = list(
"carrot",
"berries",
"potato",
"cotton",
"nettle",
"biteleaf",
"harebells",
"poppies",
"sunflowers",
"lavender",
"garlic",
"peppercorn",
"bamboo"
),
)
var/list/trees = list(
/obj/structure/flora/tree/hardwood/ebony
)
var/list/cave_trees = list(
/obj/structure/flora/tree/softwood/towercap
)

/datum/random_map/noise/forage/New()
for(var/category in forage)
var/list/forage_seeds = forage[category]
for(var/forage_seed in forage_seeds)
if(ispath(forage_seed))
continue
forage_seeds -= forage_seed
if(!SSplants.seeds[forage_seed])
log_error("Invalid seed name: [forage_seed]")
else
forage_seeds += SSplants.seeds[forage_seed]
return ..()

/datum/random_map/noise/forage/get_appropriate_path(value)
return

/datum/random_map/noise/forage/get_additional_spawns(value, turf/T)
var/parse_value = noise2value(value)
var/place_prob
var/place_type

if(T.is_outside())
if(istype(T, /turf/exterior/rock))
if(prob(15)) // Static as current map has limited amount of rock turfs
var/rock_type = pick(forage["rocks"])
new rock_type(T)
return
else if(istype(T, /turf/exterior/wildgrass))
if(prob(parse_value * 0.35))
var/tree_type = pick(trees)
new tree_type(T)
return
place_prob = parse_value * 0.3
place_type = pick(forage["grass"])
else if(istype(T, /turf/exterior/mud/water))
place_prob = parse_value * 0.3
place_type = pick(forage["shallows"])
else
if(istype(T, /turf/exterior/mud) && !istype(T, /turf/exterior/mud/water/deep))
if(prob(parse_value * 0.35))
var/tree_type = pick(cave_trees)
new tree_type(T)
return
place_prob = parse_value * 0.6
place_type = pick(forage["caves"])
else if(istype(T, /turf/exterior/dirt))
place_prob = parse_value * 0.3
place_type = pick(forage["caves"])
else if(istype(T, /turf/exterior/mud/water))
place_prob = parse_value * 0.3
place_type = pick(forage["cave_shallows"])

if(place_type && prob(place_prob))
new /obj/structure/flora/plant(T, null, null, place_type)
for(var/stepdir in global.alldirs)
if(prob(15))
var/turf/neighbor = get_step(T, stepdir)
if(istype(neighbor, T.type) && !(locate(/obj/structure/flora/plant) in neighbor))
new /obj/structure/flora/plant(neighbor, null, null, place_type)
Binary file added icons/obj/items/rock.dmi
Binary file not shown.
Binary file modified icons/obj/items/tool/shovels/shovel.dmi
Binary file not shown.
Loading
Loading