Stone walls & Mineable ore veins (#5498)

* all the stuff!

* Additional check for mining ore

* Cleans up the file

I usually make messy files and separate stuff out, makes it easier for me to look at. I probably should neaten up again...

* Apply suggestions from code review

Co-authored-by: Gandalf <jzo123@hotmail.com>

* adds examine tip and more ore veins

Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
KathrinBailey
2021-05-10 14:48:57 +01:00
committed by GitHub
co-authored by Gandalf
parent 7fb1b0d0ef
commit 4e15c5e751
6 changed files with 216 additions and 0 deletions
+1
View File
@@ -95,6 +95,7 @@ DEFINE_BITFIELD(smoothing_flags, list(
#define SMOOTH_GROUP_SURVIVAL_TIANIUM_POD S_OBJ(14) ///turf/closed/wall/mineral/titanium/survival/pod, /obj/machinery/door/airlock/survival_pod, /obj/structure/window/shuttle/survival_pod
#define SMOOTH_GROUP_HIERO_WALL S_OBJ(15) ///obj/effect/temp_visual/elite_tumor_wall, /obj/effect/temp_visual/hierophant/wall
#define SMOOTH_GROUP_STONE_WALLS S_OBJ(19) ///turf/closed/wall/mineral/stone, /obj/structure/falsewall/stone // SKYRAT EDIT: Adds stone
#define SMOOTH_GROUP_PAPERFRAME S_OBJ(20) ///obj/structure/window/paperframe, /obj/structure/mineral_door/paperframe
#define SMOOTH_GROUP_WINDOW_FULLTILE S_OBJ(21) ///turf/closed/indestructible/fakeglass, /obj/structure/window/fulltile, /obj/structure/window/reinforced/fulltile, /obj/structure/window/reinforced/tinted/fulltile, /obj/structure/window/plasma/fulltile, /obj/structure/window/plasma/reinforced/fulltile
@@ -0,0 +1,134 @@
/obj/structure/ore_vein
name = "ore vein"
desc = "An ore vein that can mined."
icon = 'modular_skyrat/modules/stone/icons/ore.dmi'
icon_state = "stone"
density = TRUE
anchored = TRUE
/// When we start mining, what do we tell the user they're mining?
var/ore_descriptor = "stone"
/// What type of ore do we drop?
var/ore_type = /obj/item/stack/ore/stone
/// How much ore do we drop?
var/ore_amount = 1
/// If the ore vein has been recently mined. If so, we cannot mine and must wait for it to regenerate.
var/depleted = FALSE
/// How long it takes for the ore to 'respawn' after being mined.
var/regeneration_time = 15 SECONDS
/// How long it takes for a tool to mine the ore vein.
var/mining_time = 3 SECONDS
/// How many unique sprites for ore we have, we will pick them at random.
var/unique_sprites = 1
/// If we should pick a random sprite for the ore vein or not.
var/random_sprite = TRUE
/// Our original description to hold. We'll revert to this when switching between the ore vein being depleted and not.
var/base_desc = ""
/obj/structure/ore_vein/Initialize()
. = ..()
base_desc = desc
if(random_sprite == TRUE)
icon_state += "[rand(1, (unique_sprites))]"
base_icon_state = icon_state
/obj/structure/ore_vein/update_icon_state()
. = ..()
if(depleted == TRUE)
icon_state = "[base_icon_state]_depleted"
else
icon_state = "[base_icon_state]"
/obj/structure/ore_vein/examine()
. = ..()
. += "[depleted ? "The ore vein is exhausted." : ""]"
/obj/structure/ore_vein/attackby(obj/item/W, mob/user, params)
if(W.tool_behaviour != TOOL_MINING)
to_chat(user, "<span class='notice'>You need a pickaxe to mine this.</span>")
return FALSE
if(!ore_type)
to_chat(user, "<span class='notice'>There's no ore to mine!</span>")
return FALSE
if(!ore_amount)
to_chat(user, "<span class='notice'>The [src] is too low quality to yield any useful amount of [ore_descriptor].</span>")
return FALSE
if(depleted == TRUE)
to_chat(user, "<span class='notice'>This ore vein is exhausted.</span>")
return FALSE
// Our early return checks to tell the user what went wrong.
to_chat(user, "<span class='notice'>You start mining the [ore_descriptor]...</span>")
if(W.use_tool(src, user, src.mining_time, volume=50))
to_chat(user, "<span class='notice'>You mine the [ore_descriptor].</span>")
if(ore_type && ore_amount && depleted == FALSE)
new ore_type(loc, ore_amount)
SSblackbox.record_feedback("tally", "pick_used_mining", 1, W.type)
depleted = TRUE
update_icon_state()
addtimer(CALLBACK(src, .proc/regenerate_ore), regeneration_time)
// After the ore vein finishes its wait, we make the ore 'respawn' and return the ore to its original post-Initialize() icon_state.
/obj/structure/ore_vein/proc/regenerate_ore()
depleted = FALSE
update_icon_state()
/obj/structure/ore_vein/stone
name = "stone mine"
desc = "High-quality stone that once mined and refined, creates a robust construction material."
icon_state = "stone"
ore_type = /obj/item/stack/ore/stone
ore_amount = 1
unique_sprites = 2
/obj/structure/ore_vein/iron
name = "iron mine"
desc = "An iron ore vein!"
icon_state = "iron"
ore_descriptor = "iron"
ore_type = /obj/item/stack/ore/iron
ore_amount = 1
unique_sprites = 2
mining_time = 5 SECONDS
/obj/structure/ore_vein/silver
name = "silver mine"
desc = "Silver! In demand for more than it's beautiful lustre."
icon_state = "silver"
ore_descriptor = "silver"
ore_type = /obj/item/stack/ore/silver
ore_amount = 1
unique_sprites = 1
mining_time = 10 SECONDS
regeneration_time = 20 SECONDS
/obj/structure/ore_vein/gold
name = "gold mine"
desc = "Precious shiny gold! A vital component for goods like electronics all the way to un-manned space vehicles."
icon_state = "gold"
ore_descriptor = "gold"
ore_type = /obj/item/stack/ore/gold
ore_amount = 1
unique_sprites = 2
mining_time = 10 SECONDS
regeneration_time = 20 SECONDS
/obj/structure/ore_vein/plasma
name = "plasma mine"
desc = "Solid plasma! It's rather common."
icon_state = "plasma"
ore_descriptor = "plasma"
ore_type = /obj/item/stack/ore/plasma
ore_amount = 1
unique_sprites = 1
mining_time = 5 SECONDS
regeneration_time = 20 SECONDS
/obj/structure/ore_vein/diamond
name = "diamond mine"
desc = "Diamond! It's rare and its industrial applications keep it very valuable."
icon_state = "diamond"
ore_descriptor = "diamond"
ore_type = /obj/item/stack/ore/diamond
ore_amount = 1
unique_sprites = 2
mining_time = 30 SECONDS
regeneration_time = 120 SECONDS
@@ -0,0 +1,79 @@
/obj/item/stack/sheet/mineral/stone
name = "stone"
desc = "Stone brick."
singular_name = "stone block"
icon = 'modular_skyrat/modules/stone/icons/ore.dmi'
icon_state = "sheet-stone"
inhand_icon_state = "sheet-metal"
mats_per_unit = list(/datum/material/stone=MINERAL_MATERIAL_AMOUNT)
throwforce = 10
// flags_1 = null
resistance_flags = FIRE_PROOF
merge_type = /obj/item/stack/sheet/mineral/stone
grind_results = null
point_value = 0
// tableVariant = /obj/structure/table/stone
material_type = /datum/material/stone
matter_amount = 0
// cost = 500
source = null
/datum/material/stone
name = "stone"
desc = "It's stone."
categories = list(MAT_CATEGORY_ORE = TRUE, MAT_CATEGORY_RIGID = TRUE, MAT_CATEGORY_BASE_RECIPES = TRUE, MAT_CATEGORY_ITEM_MATERIAL=TRUE)
sheet_type = /obj/item/stack/sheet/mineral/stone
value_per_unit = 0.005
beauty_modifier = 0.01
/obj/item/stack/ore/stone
name = "unrefined stone"
desc = "Chunks of high-quality stone. This could be cut into bricks to form a really good building material."
icon = 'modular_skyrat/modules/stone/icons/ore.dmi'
icon_state = "stone_ore"
inhand_icon_state = "Iron ore"
singular_name = "unrefined stone chunk"
points = 1
mats_per_unit = list(/datum/material/stone=MINERAL_MATERIAL_AMOUNT)
refined_type = /obj/item/stack/sheet/mineral/stone
mine_experience = 1
scan_state = null
spreadChance = 20
merge_type = /obj/item/stack/ore/stone
/turf/closed/wall/mineral/stone
name = "stone wall"
desc = "A wall made of solid stone brick."
icon = 'modular_skyrat/modules/stone/icons/wall.dmi'
icon_state = "wall-0"
base_icon_state = "wall"
sheet_type = /obj/item/stack/sheet/mineral/stone
slicing_duration = 1.5 SECONDS //literal rock
explosion_block = 2
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_STONE_WALLS)
canSmoothWith = list(SMOOTH_GROUP_STONE_WALLS)
custom_materials = list(/datum/material/stone = 4000)
/turf/closed/indestructible/stone
name = "stone wall"
desc = "A wall made of solid stone brick."
icon = 'modular_skyrat/modules/stone/icons/wall.dmi'
icon_state = "wall-0"
base_icon_state = "wall"
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_STONE_WALLS)
canSmoothWith = list(SMOOTH_GROUP_STONE_WALLS)
custom_materials = list(/datum/material/stone = 4000)
/obj/structure/falsewall/stone
name = "stone wall"
desc = "A wall made of solid stone brick."
icon = 'modular_skyrat/modules/stone/icons/wall.dmi'
icon_state = "wall-0"
base_icon_state = "wall"
mineral = /obj/item/stack/sheet/mineral/stone
walltype = /turf/closed/wall/mineral/stone
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_STONE_WALLS)
canSmoothWith = list(SMOOTH_GROUP_STONE_WALLS)
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

+2
View File
@@ -4272,6 +4272,8 @@
#include "modular_skyrat\modules\specborg\code\game\objects\items\cyborg_items.dm"
#include "modular_skyrat\modules\specborg\code\modules\living\sillicon\robot\robot_module.dm"
#include "modular_skyrat\modules\ssd_indicator\code\mob.dm"
#include "modular_skyrat\modules\stone\code\ore_veins.dm"
#include "modular_skyrat\modules\stone\code\stone.dm"
#include "modular_skyrat\modules\stock_market\code\articles.dm"
#include "modular_skyrat\modules\stock_market\code\computer.dm"
#include "modular_skyrat\modules\stock_market\code\computer_circuitboards.dm"