Skip to content

Commit

Permalink
Added variant sparks and ferrous arg for firelighting.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Feb 29, 2024
1 parent 4e62070 commit 42223e4
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 16 deletions.
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
4 changes: 2 additions & 2 deletions code/game/objects/items/rock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

// 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?.type == /decl/material/solid/metal/iron && material?.type == /decl/material/solid/stone/flint)
spark_at(get_turf(src), amount = 2, spark_type = /datum/effect/effect/system/spark_spread)
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
. = ..()

Expand Down
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: 9 additions & 0 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -653,3 +653,12 @@

/turf/proc/unwet_floor(var/check_very_wet = TRUE)
return

/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
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 @@ -209,6 +209,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 @@ -260,6 +261,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 @@ -313,6 +315,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 @@ -417,6 +420,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 @@ -270,6 +270,7 @@
rich_material_weight = 20
ore_type_value = ORE_SURFACE
ore_data_value = 1
ferrous = TRUE

/decl/material/solid/rutile
name = "rutile"
Expand Down

0 comments on commit 42223e4

Please sign in to comment.