Skip to content

Commit

Permalink
Merge pull request #3820 from MistakeNot4892/fix/materials
Browse files Browse the repository at this point in the history
Various fixes to survival and crafting stuff.
  • Loading branch information
out-of-phaze committed Mar 24, 2024
2 parents e424cac + d9d199e commit 3bf256b
Show file tree
Hide file tree
Showing 23 changed files with 108 additions and 67 deletions.
1 change: 1 addition & 0 deletions code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/mob/proc/InitializeHud()
if(istype(hud_used))
QDEL_NULL(hud_used)
hud_used = initial(hud_used)
if(ispath(hud_used))
hud_used = new hud_used(src)
refresh_lighting_master()
Expand Down
4 changes: 4 additions & 0 deletions code/datums/outfits/equipment/survival_box.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
var/name = "survival box option"
var/box_type

/decl/survival_box_option/none
name = "nothing"
uid = "survival_box_nothing"

/decl/survival_box_option/survival
name = "survival kit"
box_type = /obj/item/storage/box/survival
Expand Down
9 changes: 5 additions & 4 deletions code/datums/outfits/outfit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ var/global/list/outfits_decls_by_type_

if(H.species && !(OUTFIT_ADJUSTMENT_SKIP_SURVIVAL_GEAR & equip_adjustments))
var/decl/survival_box_option/chosen_survival_box = H?.client?.prefs.survival_box_choice
if(outfit_flags & OUTFIT_EXTENDED_SURVIVAL)
H.species.equip_survival_gear(H, /obj/item/storage/box/engineer)
else if(chosen_survival_box?.box_type)
H.species.equip_survival_gear(H, chosen_survival_box.box_type)
if(chosen_survival_box?.box_type)
if(outfit_flags & OUTFIT_EXTENDED_SURVIVAL)
H.species.equip_survival_gear(H, /obj/item/storage/box/engineer)
else
H.species.equip_survival_gear(H, chosen_survival_box.box_type)

if(H.client?.prefs?.give_passport)
global.using_map.create_passport(H)
Expand Down
5 changes: 5 additions & 0 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@
else if (isturf(loc) && (!old_loc || !TURF_IS_MIMICKING(old_loc)) && MOVABLE_SHALL_MIMIC(src))
SSzcopy.discover_movable(src)

if(isturf(loc))
var/turf/T = loc
if(T.reagents)
fluid_act(T.reagents)

//called when src is thrown into hit_atom
/atom/movable/proc/throw_impact(atom/hit_atom, var/datum/thrownthing/TT)
SHOULD_CALL_PARENT(TRUE)
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/__item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,9 @@
/obj/item/proc/equipped(var/mob/user, var/slot)
SHOULD_CALL_PARENT(TRUE)

// Clear our alpha mask.
update_turf_alpha_mask()

add_fingerprint(user)

hud_layerise()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/stacks/stack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
if(!user.is_holding_offhand(src) || !can_split())
return ..()

var/N = input("How many stacks of [src] would you like to split off?", "Split stacks", 1) as num|null
var/N = input(user, "How many stacks of [src] would you like to split off?", "Split stacks", 1) as num|null
if(!N)
return TRUE

Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/stacks/tiles/tile_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
material = /decl/material/solid/organic/plantmatter/grass/dry
color = COLOR_BEIGE
material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME
replacement_turf_type = /turf/floor/woven

/*
* Wood
Expand Down Expand Up @@ -390,6 +391,7 @@
icon_state = "woven"
material = /decl/material/solid/organic/plantmatter/grass/dry
replacement_turf_type = /turf/floor/woven
material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME | MAT_FLAG_ALTERATION_DESC

/obj/item/stack/tile/roof/try_build_turf(var/mob/user, var/turf/target)

Expand Down
7 changes: 3 additions & 4 deletions code/game/objects/structures/fires.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
return FALSE
if(!process_fuel(ignition_temperature))
return FALSE
last_fuel_burn_temperature = max(last_fuel_burn_temperature, ignition_temperature) // needed for initial burn procs to function
lit = FIRE_LIT
refresh_affected_exterior_turfs()
visible_message(SPAN_DANGER("\The [src] catches alight!"))
Expand Down Expand Up @@ -249,14 +250,12 @@
. = list(type = amount)

/obj/structure/fire_source/proc/burn_material(var/decl/material/mat, var/amount)
var/list/burn_products = mat.get_burn_products(amount, last_fuel_burn_temperature)
. = !isnull(burn_products)
. = mat.get_burn_products(amount, last_fuel_burn_temperature)
if(.)
if(mat.ignition_point && last_fuel_burn_temperature >= mat.ignition_point)
if(mat.accelerant_value > FUEL_VALUE_NONE)
fuel += amount * (1 + material.accelerant_value)
if(mat.burn_temperature)
last_fuel_burn_temperature = max(last_fuel_burn_temperature, mat.burn_temperature)
last_fuel_burn_temperature = max(last_fuel_burn_temperature, mat.burn_temperature)
else if(mat.accelerant_value <= FUEL_VALUE_SUPPRESSANT)
fuel -= amount * mat.accelerant_value
fuel = max(fuel, 0)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/flora/stump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
. = ..()

/obj/structure/flora/stump/create_dismantled_products(turf/T)
. = ..()
if(log_type)
LAZYADD(., new log_type(T, rand(2,3), material?.type, reinf_material?.type))
. = ..()

//Base tree stump
/obj/structure/flora/stump/tree
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/flora/tree.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@
animate(transform=M, pixel_x=init_px, time=6, easing=ELASTIC_EASING)

/obj/structure/flora/tree/create_dismantled_products(turf/T)
. = ..()
if(log_type)
LAZYADD(., new log_type(T, rand(max(1,round(log_amount*0.5)), log_amount), material?.type, reinf_material?.type))
if(stump_type)
var/obj/structure/flora/stump/stump = new stump_type(T, material, reinf_material)
stump.icon_state = icon_state //A bit dirty maybe, but its probably not worth writing a whole system for this when we have 3 kinds of trees..
if(paint_color)
stump.set_color()
. = ..()

/obj/structure/flora/tree/pine
name = "pine tree"
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/exterior/exterior_dirt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@

/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)
var/turf/new_turf = ChangeTurf(/turf/exterior/mud, keep_air = TRUE, keep_air_below = TRUE, keep_height = TRUE)
return new_turf.fluid_act(fluids)
2 changes: 1 addition & 1 deletion code/game/turfs/exterior/exterior_ice.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@

/turf/exterior/snow/handle_melting(list/meltable_materials)
. = ..()
ChangeTurf(/turf/exterior/ice)
ChangeTurf(/turf/exterior/ice, keep_height = TRUE)
9 changes: 7 additions & 2 deletions code/game/turfs/exterior/exterior_mud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@
footstep_type = /decl/footsteps/mud
is_fundament_turf = TRUE

/turf/exterior/mud/drop_diggable_resources()
if(get_physical_height() > -(FLUID_DEEP))
return list(/obj/item/stack/material/lump/large/soil = list(3, 2))
return ..()

/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)
ChangeTurf(/turf/exterior/dry, keep_air = TRUE, keep_air_below = TRUE, keep_height = TRUE)
return
return ..()

Expand All @@ -52,6 +57,6 @@

/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)
var/turf/new_turf = ChangeTurf(/turf/exterior/mud, keep_air = TRUE, keep_air_below = TRUE, keep_height = TRUE)
return new_turf.fluid_act(fluids)

3 changes: 3 additions & 0 deletions code/game/turfs/turf_changing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
if(update_open_turfs_above)
update_open_above(old_open_turf_type)

for(var/atom/movable/AM in W.contents)
AM.update_turf_alpha_mask()

/turf/proc/transport_properties_from(turf/other)
if(other.zone)
if(!air)
Expand Down
12 changes: 9 additions & 3 deletions code/game/turfs/walls/wall_natural.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
var/ramp_slope_direction
var/image/ore_overlay
var/static/list/exterior_wall_shine_cache = list()
var/being_mined = FALSE

/turf/wall/natural/get_paint_examine_message()
return SPAN_NOTICE("It has been <font color = '[paint_color]'>noticeably discoloured</font> by the elements.")
Expand Down Expand Up @@ -65,11 +66,16 @@

// Drill out natural walls.
/turf/wall/natural/handle_wall_tool_interactions(obj/item/W, mob/user)
if(IS_PICK(W))
if(IS_PICK(W) && !being_mined)
if(W.material?.hardness < max(material?.hardness, reinf_material?.hardness))
to_chat(user, SPAN_WARNING("\The [W] is not hard enough to dig through \the [src]."))
else if(W.do_tool_interaction(TOOL_PICK, user, src, 2 SECONDS, suffix_message = destroy_artifacts(W, INFINITY)))
dismantle_wall()
else
if(being_mined)
return TRUE
being_mined = TRUE
if(W.do_tool_interaction(TOOL_PICK, user, src, 2 SECONDS, suffix_message = destroy_artifacts(W, INFINITY)))
dismantle_wall()
being_mined = FALSE
return TRUE
return FALSE

Expand Down
4 changes: 2 additions & 2 deletions code/game/turfs/walls/wall_natural_xenoarch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@
if(newDepth >= 200) // This means the rock is mined out fully
if(artifact_find)
if( excavation_level > 0 || prob(15) )
var/obj/structure/boulder/B = new(src, material?.type, paint_color)
var/obj/structure/boulder/excavated/B = new(src, material?.type, paint_color)
B.artifact_find = artifact_find
else
place_artifact_debris(1)
artifact_find = null
SSxenoarch.artifact_spawning_turfs -= src
else if(prob(5))
new /obj/structure/boulder(src, material?.type)
new /obj/structure/boulder/excavated(src, material?.type)
dismantle_wall()
return

Expand Down
28 changes: 20 additions & 8 deletions code/modules/butchery/butchery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,26 @@

/obj/structure/meat_hook/on_update_icon()
..()
if(occupant)
occupant.set_dir(SOUTH)
var/image/I = image(null)
I.appearance = occupant
var/matrix/M = matrix()
M.Turn(occupant.butchery_rotation)
I.transform = M
add_overlay(I)
if(!occupant)
return

occupant.set_dir(SOUTH)

var/image/I = image(null)
I.appearance = occupant
I.appearance_flags |= RESET_COLOR | RESET_ALPHA | RESET_TRANSFORM
I.pixel_x = null
I.pixel_y = null
I.pixel_z = null
I.pixel_w = null
I.layer = FLOAT_LAYER
I.plane = FLOAT_PLANE

var/matrix/M = matrix()
M.Turn(occupant.butchery_rotation)
I.transform = M

add_overlay(I)

/obj/structure/meat_hook/mob_breakout(mob/living/escapee)
. = ..()
Expand Down
8 changes: 6 additions & 2 deletions code/modules/client/preference_setup/general/04_equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@
if(!ispath(pref.starting_cash_choice, /decl/starting_cash_choice))
pref.starting_cash_choice = global.using_map.default_starting_cash_choice

if(!pref.survival_box_choice && length(global.using_map.survival_box_choices)) // if you have at least one box available, 'none' must be its own bespoke option
pref.survival_box_choice = global.using_map.survival_box_choices[global.using_map.survival_box_choices[1]]
// if you have at least one box available, 'none' must be its own bespoke option
if(length(global.using_map.survival_box_choices))
if(!pref.survival_box_choice || !(pref.survival_box_choice.type in global.using_map.survival_box_choices))
pref.survival_box_choice = global.using_map.survival_box_choices[global.using_map.survival_box_choices[1]]
else
pref.survival_box_choice = null

/datum/category_item/player_setup_item/physical/equipment/content()
. = list()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/crafting/pottery/pottery_structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
icon = 'icons/obj/structures/kiln.dmi'
icon_state = ICON_STATE_WORLD
density = TRUE
cap_last_fuel_burn = FALSE
cap_last_fuel_burn = null

var/list/pottery = list()
var/maximum_items = 3
Expand Down
7 changes: 7 additions & 0 deletions code/modules/crafting/stack_recipes/recipes_planks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
result_type = /obj/item/stick
difficulty = MAT_VALUE_EASY_DIY

/decl/stack_recipe/planks/bucket
result_type = /obj/item/chems/glass/bucket/wood
difficulty = MAT_VALUE_EASY_DIY

/decl/stack_recipe/planks/noticeboard
result_type = /obj/structure/noticeboard
on_floor = TRUE
Expand Down Expand Up @@ -116,3 +120,6 @@

/decl/stack_recipe/planks/furniture/chest
result_type = /obj/structure/closet/crate/chest

/decl/stack_recipe/planks/furniture/meathook
result_type = /obj/structure/meat_hook/improvised
6 changes: 5 additions & 1 deletion code/modules/materials/material_sheets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
plural_name = "sheets"
abstract_type = /obj/item/stack/material
is_spawnable_type = FALSE // Mapped subtypes set this so they can be spawned from the verb.
material_alteration = MAT_FLAG_ALTERATION_COLOR
var/can_be_pulverized = FALSE
var/can_be_reinforced = FALSE
var/decl/material/reinf_material
Expand Down Expand Up @@ -188,7 +189,10 @@

/obj/item/stack/material/on_update_icon()
. = ..()
alpha = 100 + max(1, amount/25)*(material.opacity * 255)
if(material)
alpha = 100 + max(1, amount/25)*(material.opacity * 255)
else
alpha = initial(alpha)
update_state_from_amount()
if(drying_wetness > 0)
var/image/I = new(icon, icon_state)
Expand Down
42 changes: 9 additions & 33 deletions code/modules/random_map/automata/caves.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,16 @@
floor_type = /turf/exterior/barren
target_turf_type = /turf/unsimulated/mask

var/mineral_turf = /turf/wall/natural/random
var/list/ore_turfs = list()
var/list/minerals_sparse
var/list/minerals_rich

/datum/random_map/automata/cave_system/New(var/tx, var/ty, var/tz, var/tlx, var/tly, var/do_not_apply, var/do_not_announce, var/used_area)
if(!minerals_sparse)
minerals_sparse = SSmaterials.weighted_minerals_sparse
if(!minerals_rich)
minerals_rich = SSmaterials.weighted_minerals_rich
..()
var/sparse_mineral_turf = /turf/wall/natural/random
var/rich_mineral_turf = /turf/wall/natural/random/high_chance
var/list/ore_turfs = list()

/datum/random_map/automata/cave_system/get_appropriate_path(var/value)
switch(value)
if(DOOR_CHAR, EMPTY_CHAR)
return mineral_turf
if(DOOR_CHAR)
return sparse_mineral_turf
if(EMPTY_CHAR)
return rich_mineral_turf
if(FLOOR_CHAR)
return floor_type
if(WALL_CHAR)
Expand Down Expand Up @@ -69,37 +63,19 @@
if(!origin_x) origin_x = 1
if(!origin_y) origin_y = 1
if(!origin_z) origin_z = 1

var/tmp_cell
var/new_path
var/num_applied = 0
for (var/thing in block(locate(origin_x, origin_y, origin_z), locate(limit_x, limit_y, origin_z)))
var/turf/T = thing
new_path = null
if (!T || (target_turf_type && !istype(T, target_turf_type)))
continue

tmp_cell = TRANSLATE_COORD(T.x, T.y)

var/minerals
switch (map[tmp_cell])
if(DOOR_CHAR)
new_path = mineral_turf
minerals = pickweight(minerals_sparse)
if(EMPTY_CHAR)
new_path = mineral_turf
minerals = pickweight(minerals_rich)
if(FLOOR_CHAR)
new_path = floor_type
if(WALL_CHAR)
new_path = wall_type

new_path = get_appropriate_path(map[tmp_cell])
if (!new_path)
continue

num_applied += 1
T.ChangeTurf(new_path, minerals)
T.ChangeTurf(new_path)
get_additional_spawns(map[tmp_cell], T)
CHECK_TICK

game_log("ASGEN", "Applied [num_applied] turfs.")
Loading

0 comments on commit 3bf256b

Please sign in to comment.