Skip to content

Commit

Permalink
worm farms take a little time to produce food, better fertilizer (#24…
Browse files Browse the repository at this point in the history
…477)

* worm farms take a little time to produce food, better fertilizer

* Update modular_skyrat/modules/ashwalkers/code/buildings/ash_farming.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_skyrat/modules/ashwalkers/code/buildings/ash_farming.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_skyrat/modules/ashwalkers/code/buildings/ash_farming.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_skyrat/modules/ashwalkers/code/buildings/ash_farming.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_skyrat/modules/ashwalkers/code/buildings/ash_farming.dm

Co-authored-by: Bloop <[email protected]>

* Update modular_skyrat/modules/ashwalkers/code/buildings/ash_farming.dm

Co-authored-by: Bloop <[email protected]>

---------

Co-authored-by: Bloop <[email protected]>
  • Loading branch information
2 people authored and FFMirrorBot committed Oct 22, 2023
1 parent 25f3841 commit 04a1b2a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 38 deletions.
80 changes: 49 additions & 31 deletions modular_skyrat/modules/ashwalkers/code/buildings/ash_farming.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/datum/component/simple_farm
///whether you can actually farm it at the moment
var/allow_plant = FALSE
///whether we limit the amount of plants you can have per turf
var/one_per_turf = TRUE
///the reference to the movable parent the component is attached to
Expand All @@ -14,7 +12,6 @@
return COMPONENT_INCOMPATIBLE
atom_parent = parent
//important to allow people to just straight up set allowing to plant
allow_plant = set_plant
one_per_turf = set_turf_limit
pixel_shift = set_shift
//now lets register the signals
Expand All @@ -32,11 +29,6 @@
*/
/datum/component/simple_farm/proc/check_attack(datum/source, obj/item/attacking_item, mob/user)
SIGNAL_HANDLER
//if it behaves like a shovel
if(attacking_item.tool_behaviour == TOOL_SHOVEL)
//flip the allow plant-- we either cover or uncover the plantable bit
allow_plant = !allow_plant
atom_parent.balloon_alert_to_viewers("[allow_plant ? "uncovered" : "covered"] the growing place!")

//if its a seed, lets try to plant
if(istype(attacking_item, /obj/item/seeds))
Expand All @@ -61,11 +53,7 @@
* check_examine is meant to listen for the COMSIG_ATOM_EXAMINE signal, where it will put additional information in the examine
*/
/datum/component/simple_farm/proc/check_examine(datum/source, mob/user, list/examine_list)
if(allow_plant)
examine_list += span_notice("You are able to plant seeds here!")

else
examine_list += span_warning("You need to use a shovel before you can plant seeds here!")
examine_list += span_notice("You are able to plant seeds here!")

/obj/structure/simple_farm
name = "simple farm"
Expand Down Expand Up @@ -108,9 +96,10 @@
/obj/structure/simple_farm/examine(mob/user)
. = ..()
. += span_notice("<br>[src] will be ready for harvest in [DisplayTimeText(COOLDOWN_TIMELEFT(src, harvest_timer))]")
. += span_notice("<br>You can use sinew to lower the time between each harvest!")
. += span_notice("You can use goliath hides to increase the amount dropped per harvest!")
. += span_notice("You can use a regenerative core or worm fertilizer to force the plant to drop a harvest!")
if(max_harvest < 6)
. += span_notice("<br>You can use sinew or worm fertilizer to lower the time between each harvest!")
if(harvest_cooldown > 30 SECONDS)
. += span_notice("You can use goliath hides or worm fertilizer to increase the amount dropped per harvest!")

/obj/structure/simple_farm/process(seconds_per_tick)
update_appearance()
Expand Down Expand Up @@ -156,42 +145,71 @@

//if its sinew, lower the cooldown
else if(istype(attacking_item, /obj/item/stack/sheet/sinew))
if(harvest_cooldown <= 30 SECONDS)
balloon_alert(user, "the plant already grows fast!")
return

var/obj/item/stack/sheet/sinew/use_item = attacking_item

if(!use_item.use(1))
return

harvest_cooldown -= 15 SECONDS
balloon_alert_to_viewers("the plant grows faster!")
decrease_cooldown(user)
return

//if its goliath hide, increase the amount dropped
else if(istype(attacking_item, /obj/item/stack/sheet/animalhide/goliath_hide))
if(max_harvest >= 6)
balloon_alert(user, "the plant already drops a lot!")
return

var/obj/item/stack/sheet/animalhide/goliath_hide/use_item = attacking_item

if(!use_item.use(1))
return

max_harvest++
balloon_alert_to_viewers("the plant drops more!")
increase_yield(user)
return

//if its a regen core or worm fertilizer, then create four harvests
else if(istype(attacking_item, /obj/item/organ/internal/monster_core/regenerative_core) || istype(attacking_item, /obj/item/worm_fertilizer))
else if(istype(attacking_item, /obj/item/worm_fertilizer))
qdel(attacking_item)
create_harvest()

if(!decrease_cooldown(user, silent = TRUE) && !increase_yield(user, silent = TRUE))
balloon_alert(user, "plant is already fully upgraded")

else
balloon_alert(user, "plant was upgraded")

return

return ..()

/**
* a proc that will increase the amount of items the crop could produce (at a maximum of 6, from base of 3)
*/
/obj/structure/simple_farm/proc/increase_yield(mob/user, var/silent = FALSE)
if(max_harvest >= 6)
if(!silent)
balloon_alert(user, "plant is at maximum yield")

return FALSE

max_harvest++

if(!silent)
balloon_alert_to_viewers("plant will have increased yield")

return TRUE

/**
* a proc that will decrease the amount of time it takes to be ready for harvest (at a maximum of 30 seconds, from a base of 1 minute)
*/
/obj/structure/simple_farm/proc/decrease_cooldown(mob/user, var/silent = FALSE)
if(harvest_cooldown <= 30 SECONDS)
if(!silent)
balloon_alert(user, "already at maximum growth speed!")

return FALSE

harvest_cooldown -= 10 SECONDS

if(!silent)
balloon_alert_to_viewers("plant will grow faster")

return TRUE

/**
* used during the component so that it can move when its attached atom moves
*/
Expand Down
17 changes: 10 additions & 7 deletions modular_skyrat/modules/ashwalkers/code/buildings/wormfarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
var/max_worm = 10
/// How many worms the barrel is currently holding
var/current_worm = 0
/// How much food was inserted into the barrel that needs to be composted
var/current_food = 0
/// If the barrel is currently being used by someone
var/in_use = FALSE
// The cooldown between each worm "breeding"
Expand All @@ -30,10 +32,12 @@

COOLDOWN_START(src, worm_timer, 1 MINUTES)

if(current_worm < 2 || current_worm >= max_worm)
return
if(current_worm > 2 && current_worm < max_worm)
current_worm++

current_worm++
if(current_food > 0 && current_worm > 1)
current_food--
new /obj/item/worm_fertilizer(get_turf(src))

/obj/structure/wormfarm/examine(mob/user)
. = ..()
Expand All @@ -49,7 +53,7 @@
return ..()

balloon_alert(user, "digging up worms")
if(!do_after(user, 5 SECONDS, src))
if(!do_after(user, 2 SECONDS, src))
balloon_alert(user, "stopped digging")
in_use = FALSE
return ..()
Expand Down Expand Up @@ -96,10 +100,9 @@
return

qdel(attacking_item)
balloon_alert(user, "feeding complete")
balloon_alert(user, "feeding complete, check back later")

if(current_worm > 0)
new /obj/item/worm_fertilizer(get_turf(src))
current_food++

in_use = FALSE
return
Expand Down

0 comments on commit 04a1b2a

Please sign in to comment.