Skip to content

Commit

Permalink
Merge pull request #11 from Paxilmaniac/woodworks
Browse files Browse the repository at this point in the history
woodworks
  • Loading branch information
Paxilmaniac authored Jun 27, 2024
2 parents 0c561d9 + 0b95e4c commit cd0c859
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 63 deletions.
35 changes: 35 additions & 0 deletions code/modules/fantasystation_content/crafting/palisade.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/obj/structure/railing/fantasy_palisade
name = "palisade"
desc = "A tall fence made of logs driven into the ground."
icon = 'icons/obj/fantasystation_obj/fences.dmi'
icon_state = "palisade"
item_deconstruct = /obj/item/stack/fantasy_logs
layer = ABOVE_MOB_LAYER
climbable = FALSE
max_integrity = 200
resistance_flags = FLAMMABLE
obj_flags = CAN_BE_HIT | BLOCKS_CONSTRUCTION_DIR | IGNORE_DENSITY

/obj/structure/railing/fantasy_palisade/Initialize(mapload)
. = ..()
RegisterSignal(src, COMSIG_ATOM_DIR_CHANGE, PROC_REF(on_change_layer))
adjust_dir_layer(dir)

/obj/structure/railing/fantasy_palisade/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
playsound(src, SFX_TREE_CHOP, 50, vary = TRUE)

/// Kicks the adjust_dir_layer proc into gear when the direction of the palisade changes
/obj/structure/railing/fantasy_palisade/proc/on_change_layer(datum/source, old_dir, new_dir)
SIGNAL_HANDLER
adjust_dir_layer(new_dir)

/// Adjusts the layer of the palisade based on which direction the palisade is facing
/obj/structure/railing/fantasy_palisade/proc/adjust_dir_layer(direction)
layer = (direction & NORTH) ? MOB_LAYER : initial(layer)
plane = (direction & NORTH) ? GAME_PLANE : initial(plane)

/// Swamp wood edition

/obj/structure/railing/fantasy_palisade/swamp
icon_state = "palisade_swamp"
item_deconstruct = /obj/item/stack/fantasy_logs/swamp
1 change: 1 addition & 0 deletions code/modules/fantasystation_content/crafting/sticks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
w_class = WEIGHT_CLASS_NORMAL
force = 15
throwforce = 10
resistance_flags = FLAMMABLE
/// How many variations of sprite does this have?
var/icon_variations = 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
base_icon_state = "stone_spear"
lefthand_file = 'icons/mob/fantasystation_onmobs/inhands/lefthand.dmi'
righthand_file = 'icons/mob/fantasystation_onmobs/inhands/righthand.dmi'
inhand_icon_state = "stone_spear0"
worn_icon = 'icons/mob/fantasystation_onmobs/worn_items/worn.dmi'
worn_icon_state = "stone_spear"
force = 10
Expand Down Expand Up @@ -55,7 +54,6 @@
desc = "A long stick with a sharpened piece of flint attached to the end. Makes good for stabbing or throwing."
icon_state = "flint_spear0"
base_icon_state = "flint_spear"
inhand_icon_state = "flint_spear0"
worn_icon_state = "flint_spear"
throwforce = 20
wound_bonus = -10
Expand Down Expand Up @@ -83,6 +81,7 @@
throwforce = 15
throw_speed = 4
throw_range = 7
demolition_mod = 1.5
embedding = list("pain_mult" = 4, "embed_chance" = 35, "fall_chance" = 10)
attack_verb_continuous = list("chops", "tears", "lacerates", "cuts")
attack_verb_simple = list("chop", "tear", "lacerate", "cut")
Expand Down
51 changes: 51 additions & 0 deletions code/modules/fantasystation_content/crafting/wood.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
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, 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, category = CAT_STRUCTURE),
))

/obj/item/stack/fantasy_logs
name = "logs"
singular_name = "log"
desc = "The trunks of trees cut into workable segments."
icon = 'icons/obj/fantasystation_obj/harvested_plants_tall.dmi'
icon_state = "log"
base_icon_state = "log"
lefthand_file = 'icons/mob/fantasystation_onmobs/inhands/lefthand.dmi'
righthand_file = 'icons/mob/fantasystation_onmobs/inhands/righthand.dmi'
inhand_icon_state = "stick"
merge_type = /obj/item/stack/fantasy_logs
max_amount = 6
resistance_flags = FLAMMABLE
w_class = WEIGHT_CLASS_NORMAL
force = 15
throwforce = 10
throw_speed = 5
throw_range = 3

/obj/item/stack/fantasy_logs/Initialize(mapload, new_amount, merge, list/mat_override, mat_amt)
. = ..()
update_appearance()

/obj/item/stack/fantasy_logs/get_main_recipes()
. = ..()
. = GLOB.log_recipes

/obj/item/stack/fantasy_logs/update_icon_state()
. = ..()
icon_state = (amount == 1) ? "[base_icon_state]" : "[base_icon_state]_[min(amount, max_amount)]"

/// Swamp version

/obj/item/stack/fantasy_logs/swamp
name = "swamp logs"
singular_name = "swamp log"
icon_state = "log_swamp"
base_icon_state = "log_swamp"
merge_type = /obj/item/stack/fantasy_logs/swamp

/obj/item/stack/fantasy_logs/swamp/get_main_recipes()
. = ..()
. = GLOB.swamp_log_recipes

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
/obj/structure/flora/fantasy_regrowing
name = "tall grass"
desc = "Tall grass, can be cut and used for many things."
harvested_name = "cut grass"
harvested_desc = "Some cut grass, you feel like it used to stand much taller."
icon = 'icons/obj/fantasystation_obj/tall_plants.dmi'
icon_state = "tall_grass"
base_icon_state = "tall_grass"
gender = PLURAL
layer = PROJECTILE_HIT_THRESHHOLD_LAYER //sporangiums up don't shoot
product_types = list(/obj/item/food/grown/grass = 1)
layer = PROJECTILE_HIT_THRESHHOLD_LAYER
product_types = list(/obj/item/fantasy_cut_grass = 1)
harvest_amount_low = 1
harvest_amount_high = 3
harvest_with_hands = TRUE
harvested_name = "shortened mushrooms"
harvested_desc = "Some quickly regrowing mushrooms, formerly known to be quite large."
harvest_message_low = "You pick a mushroom, but fail to collect many shavings from its cap."
harvest_message_med = "You pick a mushroom, carefully collecting the shavings from its cap."
harvest_message_high = "You harvest and collect shavings from several mushroom caps."
harvest_with_hands = FALSE
harvest_message_low = "You cut the grass, managing to collect only a little of it."
harvest_message_med = "You cut the grass, managing to collect a fair amount of it."
harvest_message_high = "You cut the grass, collecting almost all of it."
harvest_message_true_thresholds = TRUE
harvest_verb = "cut"
flora_flags = FLORA_HERBAL
resistance_flags = FLAMMABLE
/// The icon state of the plant when it is harvested
var/harvest_icon_state = "grass_cut"
/// If this takes a knife tool to harvest
var/knife_harvest = TRUE

/obj/structure/flora/fantasy_regrowing/harvest(user, product_amount_multiplier)
if(!..())
Expand All @@ -27,6 +31,42 @@
update_appearance()
return TRUE

/obj/structure/flora/fantasy_regrowing/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_SAW))
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
// Check and see if we need a knife to harvest this
if(knife_harvest && (harvesting_item.tool_behaviour == TOOL_KNIFE))
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

/obj/structure/flora/fantasy_regrowing/regrow()
..()
icon_state = base_icon_state

/// Cut grass

/obj/item/fantasy_cut_grass
name = "cut grass"
desc = "A pile of cut grass."
icon = 'icons/obj/fantasystation_obj/harvested_plants.dmi'
icon_state = "grass"
resistance_flags = FLAMMABLE
w_class = WEIGHT_CLASS_SMALL
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
layer = FLY_LAYER
plane = ABOVE_GAME_PLANE
drag_slowdown = 1.5
product_types = list(/obj/item/grown/log/tree = 1)
product_types = list(
/obj/item/stack/fantasy_logs = 1,
)
harvest_amount_low = 6
harvest_amount_high = 10
harvest_message_low = "You manage to gather a few logs from the tree."
Expand All @@ -19,6 +21,7 @@
delete_on_harvest = TRUE
can_uproot = FALSE
flora_flags = FLORA_HERBAL | FLORA_WOODEN
resistance_flags = FLAMMABLE
/// If this tree has a seethrough map
var/seethrough = TRUE
/// If this makes a stump when cut down
Expand Down Expand Up @@ -56,10 +59,14 @@
name = "stump"
desc = "This represents our promise to the elves, and the world itself. To cut down as many trees as possible."
icon_state = "tree_1_stump"
harvest_amount_low = 0
harvest_amount_high = 0
density = FALSE
delete_on_harvest = TRUE
seethrough = FALSE
makes_stumps = FALSE
number_of_sticks = 0
plane = GAME_PLANE

/obj/structure/flora/fantasy_tree/stump/harvest(mob/living/user, product_amount_multiplier)
to_chat(user, span_notice("You manage to remove [src]."))
Expand All @@ -74,6 +81,9 @@
name = "swamp tree"
desc = "A large tree. This one is commonly seen around swamps and bogs."
icon_state = "swamp_tree_1"
product_types = list(
/obj/item/stack/fantasy_logs/swamp = 1,
)

/obj/structure/flora/fantasy_tree/stump/swamp
icon_state = "swamp_tree_1_stump"
Expand All @@ -84,13 +94,14 @@
icon = 'icons/obj/fantasystation_obj/tall_plants.dmi'
icon_state = "bush_1"
pixel_x = 0
harvest_amount_low = 2
harvest_amount_high = 5
harvest_amount_low = 1
harvest_amount_high = 2
harvest_message_low = "You manage to gather a few logs from the bush."
harvest_message_med = "You manage to gather some logs from the bush."
harvest_message_high = "You manage to get most of the wood from the bush."
density = FALSE
number_of_sticks = 0
makes_stumps = FALSE
number_of_sticks = 2

/obj/structure/flora/fantasy_tree/pet_bush/Initialize(mapload)
. = ..()
Expand All @@ -113,6 +124,9 @@
name = "swamp bush"
desc = "A large bush. This one is commonly seen in swamps and bogs"
icon_state = "swamp_bush_1"
product_types = list(
/obj/item/stack/fantasy_logs/swamp = 1,
)

// Random icon versions of the above

Expand Down
Binary file added icons/obj/fantasystation_obj/fences.dmi
Binary file not shown.
Binary file modified icons/obj/fantasystation_obj/harvested_plants.dmi
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -4064,17 +4064,18 @@
#include "code\modules\explorer_drone\exploration_events\resource.dm"
#include "code\modules\explorer_drone\exploration_events\trader.dm"
#include "code\modules\fantasystation_content\crafting\crafting_recipe_fantasy.dm"
#include "code\modules\fantasystation_content\crafting\palisade.dm"
#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\wood.dm"
#include "code\modules\fantasystation_map_generation\map_generator_and_areas\areas.dm"
#include "code\modules\fantasystation_map_generation\map_generator_and_areas\biome_basetype.dm"
#include "code\modules\fantasystation_map_generation\map_generator_and_areas\id_river_generator.dm"
#include "code\modules\fantasystation_map_generation\map_generator_and_areas\surface_generator.dm"
#include "code\modules\fantasystation_map_generation\map_generator_and_areas\biome_types\dirt_biomes.dm"
#include "code\modules\fantasystation_map_generation\map_generator_and_areas\biome_types\pond_biomes.dm"
#include "code\modules\fantasystation_map_generation\map_generator_and_areas\biome_types\swamp_biomes.dm"
#include "code\modules\fantasystation_map_generation\random_resources\dunegrass.dm"
#include "code\modules\fantasystation_map_generation\random_resources\regrowing_wild_plants.dm"
#include "code\modules\fantasystation_map_generation\random_resources\rocks_spawner.dm"
#include "code\modules\fantasystation_map_generation\random_resources\trees.dm"
Expand Down

0 comments on commit cd0c859

Please sign in to comment.