Skip to content

Commit

Permalink
Merge pull request #21 from Paxilmaniac/build-a-wall
Browse files Browse the repository at this point in the history
adds log wall construction
  • Loading branch information
Paxilmaniac authored Jun 29, 2024
2 parents ba1a142 + 09d2bda commit 3e6a5aa
Show file tree
Hide file tree
Showing 18 changed files with 145 additions and 5 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#define TOOL_ROLLINGPIN "rolling pin"
/// Can be used to scrape rust off an any atom; which will result in the Rust Component being qdel'd
#define TOOL_RUSTSCRAPER "rustscraper"
/// Used to actually cut down trees, in order to save tool_saw for other stuff
#define TOOL_AXE "axe"

// If delay between the start and the end of tool operation is less than MIN_TOOL_SOUND_DELAY,
// tool sound is only played when op is started. If not, it's played twice.
Expand Down
2 changes: 2 additions & 0 deletions code/__HELPERS/names.dm
Original file line number Diff line number Diff line change
Expand Up @@ -372,5 +372,7 @@ GLOBAL_DATUM(syndicate_code_response_regex, /regex)
return "a blood filter"
if(TOOL_ROLLINGPIN)
return "a rolling pin"
if(TOOL_AXE)
return "an axe"
else
return "something... but the gods didn't set this up right (Please report this bug)"
1 change: 1 addition & 0 deletions code/game/objects/items/debug_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
TOOL_WELDER,
TOOL_WIRECUTTER,
TOOL_WRENCH,
TOOL_AXE,
)

/obj/item/debug/omnitool/attack_self(mob/user)
Expand Down
1 change: 1 addition & 0 deletions code/modules/asset_cache/assets/crafting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
TOOL_BLOODFILTER = icon('icons/obj/medical/surgery_tools.dmi', "bloodfilter"),
TOOL_ROLLINGPIN = icon('icons/obj/service/kitchen.dmi', "rolling_pin"),
TOOL_RUSTSCRAPER = icon('icons/obj/tools.dmi', "wirebrush"),
TOOL_AXE = icon('icons/obj/weapons/fireaxe.dmi', "fireaxe1"),
)

for(var/tool in tool_icons)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
force = 15
throwforce = 10
sharpness = SHARP_EDGED
tool_behaviour = TOOL_SAW
tool_behaviour = TOOL_AXE
toolspeed = 2
slapcraft_recipe_list = list(
/datum/crafting_recipe/fantasystation/stone_axe,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
worn_icon_state = "stone_axe"
w_class = WEIGHT_CLASS_NORMAL
sharpness = SHARP_EDGED
tool_behaviour = TOOL_SAW
tool_behaviour = TOOL_AXE
toolspeed = 1.75
force = 15
throwforce = 15
Expand Down
73 changes: 73 additions & 0 deletions code/modules/fantasystation_content/crafting/walls.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/turf/closed/wall/fantasystation
name = "wall"
desc = "A huge chunk of { SPACE INTENTIONALLY LEFT BLANK } used to separate rooms."
icon = 'icons/obj/fantasystation_obj/walls/swamp_log.dmi'
icon_state = "swamp_log-0"
base_icon_state = "swamp_log"
rust_resistance = RUST_RESISTANCE_ORGANIC

baseturfs = /turf/baseturf_bottom

flags_ricochet = RICOCHET_HARD

can_engrave = TRUE
sheet_type = /obj/item/stack/fantasy_logs/swamp
sheet_amount = 1
girder_type = null
slicing_duration = 7 SECONDS
/// What sound the wall makes when dismantled
var/dismantle_sound = SFX_TREE_CHOP

/turf/closed/wall/fantasystation/deconstruction_hints(mob/user)
return span_notice("The logs could probably be <b>hacked apart</b> with an <b>axe</b>.")

/turf/closed/wall/fantasystation/dismantle_wall(devastated = FALSE, explode = FALSE)
if(devastated)
devastate_wall()
else
playsound(src, dismantle_sound, 100, TRUE)
var/newgirder = break_wall()
if(newgirder) //maybe we don't /want/ a girder!
transfer_fingerprints_to(newgirder)

for(var/obj/O in src.contents) //Eject contents!
if(istype(O, /obj/structure/sign/poster))
var/obj/structure/sign/poster/P = O
INVOKE_ASYNC(P, TYPE_PROC_REF(/obj/structure/sign/poster, roll_and_drop), src)
if(decon_type)
ChangeTurf(decon_type, flags = CHANGETURF_INHERIT_AIR)
else
ScrapeAway()
QUEUE_SMOOTH_NEIGHBORS(src)

/turf/closed/wall/fantasystation/try_decon(obj/item/attacking_item, mob/user)
if(attacking_item.tool_behaviour != TOOL_AXE)
return FALSE
if(!attacking_item.tool_start_check(user, amount=round(slicing_duration / 50)))
return FALSE

to_chat(user, span_notice("You begin hacking through the logs..."))
if(attacking_item.use_tool(src, user, slicing_duration, volume=100))
if(iswallturf(src))
to_chat(user, span_notice("You break through the stacked logs."))
dismantle_wall()
return TRUE

return FALSE

/// Now for the actual walls, starting with logs

/turf/closed/wall/fantasystation/log
name = "log wall"
desc = "A stack of logs set in the ground to keep the outside out, and the inside in."
icon = 'icons/obj/fantasystation_obj/walls/log.dmi'
icon_state = "log-0"
base_icon_state = "log"
sheet_type = /obj/item/stack/fantasy_logs

/turf/closed/wall/fantasystation/log/swamp
name = "swamp log wall"
icon = 'icons/obj/fantasystation_obj/walls/swamp_log.dmi'
icon_state = "swamp_log-0"
base_icon_state = "swamp_log"
sheet_type = /obj/item/stack/fantasy_logs/swamp
2 changes: 2 additions & 0 deletions code/modules/fantasystation_content/crafting/wood.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
GLOBAL_LIST_INIT(log_recipes, list(
new/datum/stack_recipe("palisade", /obj/structure/railing/fantasy_palisade, 2, time = 3 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_CHECK_DIRECTION | CRAFT_ON_SOLID_GROUND, category = CAT_STRUCTURE),
new/datum/stack_recipe("wall", /turf/closed/wall/fantasystation/log, 3, time = 5 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ON_SOLID_GROUND, category = CAT_STRUCTURE),
))

GLOBAL_LIST_INIT(swamp_log_recipes, list(
new/datum/stack_recipe("palisade", /obj/structure/railing/fantasy_palisade/swamp, 2, time = 3 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_CHECK_DIRECTION | CRAFT_ON_SOLID_GROUND, category = CAT_STRUCTURE),
new/datum/stack_recipe("wall", /turf/closed/wall/fantasystation/log/swamp, 3, time = 5 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ON_SOLID_GROUND, category = CAT_STRUCTURE),
))

/obj/item/stack/fantasy_logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

if(harvesting_item)
//Check to see if wooden flora is being attacked by a saw item (letting the items on/off state control this is better than putting them in the list)
if((flora_flags & FLORA_WOODEN) && (harvesting_item.tool_behaviour == TOOL_SAW))
if((flora_flags & FLORA_WOODEN) && (harvesting_item.tool_behaviour == TOOL_AXE))
return TRUE
//Check to see if stone flora is being attacked by a mining item (same reason as above)
if((flora_flags & FLORA_STONE) && (harvesting_item.tool_behaviour == TOOL_MINING))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,50 @@
var/makes_stumps = TRUE
/// How many sticks this tree makes when cut down
var/number_of_sticks = 3
/// If the tree makes a dramatic sound when felled
var/felling_sound = 'sound/fantasystation/nature/tree_fell.ogg'

/obj/structure/flora/fantasy_tree/Initialize(mapload)
. = ..()
if(seethrough)
AddComponent(/datum/component/seethrough, get_seethrough_map())

/obj/structure/flora/fantasy_tree/can_harvest(mob/user, obj/item/harvesting_item)

if(flags_1 & HOLOGRAM_1)
return FALSE
if(harvested || !harvestable)
return null

if(harvesting_item)
//Check to see if wooden flora is being attacked by a saw item (letting the items on/off state control this is better than putting them in the list)
if((flora_flags & FLORA_WOODEN) && (harvesting_item.tool_behaviour == TOOL_AXE))
return TRUE
//Check to see if stone flora is being attacked by a mining item (same reason as above)
if((flora_flags & FLORA_STONE) && (harvesting_item.tool_behaviour == TOOL_MINING))
return TRUE
//We checked all item interactions and could not harvest, lets return
return FALSE

//If there was no harvesting item supplied, check if it is hand harvestable
if(harvest_with_hands)
return TRUE

return FALSE

///Return a see_through_map, examples in seethrough.dm
/obj/structure/flora/fantasy_tree/proc/get_seethrough_map()
return SEE_THROUGH_MAP_THREE_X_TWO
return SEE_THROUGH_MAP_DEFAULT

/obj/structure/flora/fantasy_tree/harvest(mob/living/user, product_amount_multiplier)
. = ..()
if(!makes_stumps)
return
var/turf/my_turf = get_turf(src)
playsound(my_turf, SFX_TREE_CHOP, 100 , FALSE, FALSE)
if(felling_sound)
playsound(my_turf, felling_sound, 50, TRUE)
else
playsound(my_turf, SFX_TREE_CHOP, 100 , TRUE)
var/obj/structure/flora/fantasy_tree/stump/new_stump = new(my_turf)
new_stump.name = "[name] stump"
new_stump.icon_state = "[icon_state]_stump"
Expand All @@ -67,6 +95,7 @@
makes_stumps = FALSE
number_of_sticks = 0
plane = GAME_PLANE
felling_sound = null

/obj/structure/flora/fantasy_tree/stump/harvest(mob/living/user, product_amount_multiplier)
to_chat(user, span_notice("You manage to remove [src]."))
Expand Down Expand Up @@ -102,6 +131,7 @@
density = FALSE
makes_stumps = FALSE
number_of_sticks = 2
felling_sound = null

/obj/structure/flora/fantasy_tree/pet_bush/Initialize(mapload)
. = ..()
Expand Down
Binary file added icons/obj/fantasystation_obj/walls/log.dmi
Binary file not shown.
Binary file added icons/obj/fantasystation_obj/walls/log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions icons/obj/fantasystation_obj/walls/log.png.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
output_name = "log"
template = "bitmask/diagonal_32x32.toml"

[icon_size]
x = 32
y = 32

[output_icon_size]
x = 32
y = 32

[cut_pos]
x = 16
y = 8
Binary file added icons/obj/fantasystation_obj/walls/swamp_log.dmi
Binary file not shown.
Binary file added icons/obj/fantasystation_obj/walls/swamp_log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions icons/obj/fantasystation_obj/walls/swamp_log.png.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
output_name = "swamp_log"
template = "bitmask/diagonal_32x32.toml"

[icon_size]
x = 32
y = 32

[output_icon_size]
x = 32
y = 32

[cut_pos]
x = 16
y = 8
Binary file added sound/fantasystation/nature/tree_fell.ogg
Binary file not shown.
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -4071,6 +4071,7 @@
#include "code\modules\fantasystation_content\crafting\rock_and_stone.dm"
#include "code\modules\fantasystation_content\crafting\sticks.dm"
#include "code\modules\fantasystation_content\crafting\tools_weapons.dm"
#include "code\modules\fantasystation_content\crafting\walls.dm"
#include "code\modules\fantasystation_content\crafting\wood.dm"
#include "code\modules\fantasystation_content\food\grown_plants_addons.dm"
#include "code\modules\fantasystation_content\food\roots.dm"
Expand Down

0 comments on commit 3e6a5aa

Please sign in to comment.