Files
Bubberstation/code/game/objects/items/kirbyplants.dm
DragonTrance 89650214fd [MDB Ignore] Refactoring Flora code (#66978)
* organizing flora file and icon states, & flags

Changes the typepath for a lot of flora, and adds new paths depending on the amount of icon states the flora had, for better modularization on mappers. Also adds flags to the flora depending on what type it was, instead of 3 bools

* Getting ready to attempt to modularize flora

Moving most vars and procs from ash flora into the normal flora type path, as a general preparation to add more here

* Weighted products & Region Messages

Rewrites flora code so a flora's produced items can be initialized with a weighted list. Also has some improvements, relating to item stacks.

Adds an option via variables to separate 3 messages into 3 possible regions, or the old method where the message changes when the value is exactly the same as the low or high harvest value

* organizing + documentation on procs

* Documentation, Organization & Modularization

(DOMing) yeah, I dom
Gives variables for tools that can harvest flora, a blacklist of them, and modularizes variables a bit.

Retypes the stump to be a subtype of a tree, which just deletes after being harvested

* Adds the ability to uproot flora with a shovel

* added eswords to the list of things that can cut

* ausbush junk

* code review appreciation + changing drag_slowdown

* more code review appreciation

* kirbyplants ComponentInitialize() -> Initialize()

* forgot glob.
2022-05-16 00:00:54 -07:00

104 lines
3.1 KiB
Plaintext

/obj/item/kirbyplants
name = "potted plant"
icon = 'icons/obj/flora/plants.dmi'
icon_state = "plant-01"
desc = "A little bit of nature contained in a pot."
layer = ABOVE_MOB_LAYER
plane = GAME_PLANE_UPPER
w_class = WEIGHT_CLASS_HUGE
force = 10
throwforce = 13
throw_speed = 2
throw_range = 4
item_flags = NO_PIXEL_RANDOM_DROP
/// Can this plant be trimmed by someone with TRAIT_BONSAI
var/trimmable = TRUE
var/list/static/random_plant_states
/obj/item/kirbyplants/Initialize(mapload)
. = ..()
AddComponent(/datum/component/tactical)
AddComponent(/datum/component/two_handed, require_twohands=TRUE, force_unwielded=10, force_wielded=10)
AddElement(/datum/element/beauty, 500)
/obj/item/kirbyplants/attackby(obj/item/I, mob/living/user, params)
. = ..()
if(trimmable && HAS_TRAIT(user,TRAIT_BONSAI) && isturf(loc) && I.get_sharpness())
to_chat(user,span_notice("You start trimming [src]."))
if(do_after(user,3 SECONDS,target=src))
to_chat(user,span_notice("You finish trimming [src]."))
change_visual()
/// Cycle basic plant visuals
/obj/item/kirbyplants/proc/change_visual()
if(!random_plant_states)
generate_states()
var/current = random_plant_states.Find(icon_state)
var/next = WRAP(current+1,1,length(random_plant_states))
icon_state = random_plant_states[next]
/obj/item/kirbyplants/random
icon = 'icons/obj/flora/_flora.dmi'
icon_state = "random_plant"
/obj/item/kirbyplants/random/Initialize(mapload)
. = ..()
icon = 'icons/obj/flora/plants.dmi'
if(!random_plant_states)
generate_states()
icon_state = pick(random_plant_states)
/obj/item/kirbyplants/proc/generate_states()
random_plant_states = list()
for(var/i in 1 to 25)
var/number
if(i < 10)
number = "0[i]"
else
number = "[i]"
random_plant_states += "plant-[number]"
random_plant_states += "applebush"
/obj/item/kirbyplants/dead
name = "RD's potted plant"
desc = "A gift from the botanical staff, presented after the RD's reassignment. There's a tag on it that says \"Y'all come back now, y'hear?\"\nIt doesn't look very healthy..."
icon_state = "plant-25"
trimmable = FALSE
/obj/item/kirbyplants/photosynthetic
name = "photosynthetic potted plant"
desc = "A bioluminescent plant."
icon_state = "plant-09"
light_color = COLOR_BRIGHT_BLUE
light_range = 3
/obj/item/kirbyplants/fullysynthetic
name = "plastic potted plant"
desc = "A fake, cheap looking, plastic tree. Perfect for people who kill every plant they touch."
icon_state = "plant-26"
custom_materials = (list(/datum/material/plastic = 8000))
trimmable = FALSE
/obj/item/kirbyplants/fullysynthetic/Initialize(mapload)
. = ..()
icon_state = "plant-[rand(26, 29)]"
/obj/item/kirbyplants/potty
name = "Potty the Potted Plant"
desc = "A secret agent staffed in the station's bar to protect the mystical cakehat."
icon_state = "potty"
trimmable = FALSE
/obj/item/kirbyplants/fern
name = "neglected fern"
desc = "An old botanical research sample collected on a long forgotten jungle planet."
icon_state = "fern"
trimmable = FALSE
/obj/item/kirbyplants/fern/Initialize(mapload)
. = ..()
AddElement(/datum/element/swabable, CELL_LINE_TABLE_ALGAE, CELL_VIRUS_TABLE_GENERIC, rand(2,4), 5)