Skip to content

Commit

Permalink
Sideport of Pyrelight modpack.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Jun 18, 2024
1 parent 0d077a7 commit b3491f3
Show file tree
Hide file tree
Showing 20 changed files with 392 additions and 0 deletions.
1 change: 1 addition & 0 deletions maps/modpack_testing/modpack_testing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "../../mods/content/pheromones/_pheromones.dme"
#include "../../mods/species/drakes/_drakes.dme" // include before _fantasy.dme so overrides work
#include "../../mods/content/fantasy/_fantasy.dme"
#include "../../mods/pyrelight/_pyrelight.dme" // include after _fantasy.dme so overrides work

#include "../../mods/mobs/dionaea/_dionaea.dme"
#include "../../mods/mobs/borers/_borers.dme"
Expand Down
1 change: 1 addition & 0 deletions maps/shaded_hills/shaded_hills.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "../../mods/content/scaling_descriptors.dm"
#include "../../mods/species/drakes/_drakes.dme" // include before _fantasy.dme so overrides work
#include "../../mods/content/fantasy/_fantasy.dme"
#include "../../mods/pyrelight/_pyrelight.dme" // include after _fantasy.dme so overrides work

#include "_shaded_hills_defines.dm"

Expand Down
2 changes: 2 additions & 0 deletions mods/pyrelight/_pyrelight.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/decl/modpack/pyrelight
name = "Pyrelight Keep Content"
9 changes: 9 additions & 0 deletions mods/pyrelight/_pyrelight.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef MODPACK_PYRELIGHT
#define MODPACK_PYRELIGHT
#include "_pyrelight.dm"
#include "datum/culture.dm"
#include "datum/factions.dm"
#include "datum/locations.dm"
#include "datum/religions.dm"
#include "plants/_plants.dme"
#endif
Empty file added mods/pyrelight/datum/culture.dm
Empty file.
Empty file.
Empty file.
Empty file.
Binary file added mods/pyrelight/icons/fruit/debug.dmi
Binary file not shown.
Binary file added mods/pyrelight/icons/fruit/nightweave.dmi
Binary file not shown.
Binary file added mods/pyrelight/icons/plants/debug.dmi
Binary file not shown.
111 changes: 111 additions & 0 deletions mods/pyrelight/plants/_plants.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/obj/structure/flora/growing
name = "plant"
desc = "A plant of some kind."
icon = 'mods/pyrelight/icons/plants/debug.dmi'
icon_state = "1"
is_spawnable_type = FALSE
material = /decl/material/solid/organic/plantmatter

// State tracking vars.
var/dead = FALSE
var/frozen = FALSE
var/last_tick
var/amount_grown = 0
var/harvest_timer = 0
var/growth_stage = 1
var/list/fruits
var/max_fruits = 3

// Customization vars for use on subtypes.
var/time_per_growth_stage = 5 SECONDS
var/max_growth_stage = 5
var/harvest_time = 5 SECONDS
var/harvest_tool

/obj/structure/flora/growing/Initialize(ml, _mat, _reinf_mat)
. = ..()
START_PROCESSING(SSpyrelight_plants, src)

/obj/structure/flora/growing/Destroy()
STOP_PROCESSING(SSpyrelight_plants, src)
return ..()

/obj/structure/flora/growing/init_appearance()
update_icon()

/obj/structure/flora/growing/Process()

..()
if(frozen || dead || last_tick == null)
last_tick = world.time
return

var/time_elapsed = world.time - last_tick
last_tick = world.time
if(growth_stage < max_growth_stage)
amount_grown += time_elapsed
while(amount_grown >= time_per_growth_stage && growth_stage < max_growth_stage)
advance_growth()
amount_grown -= time_per_growth_stage
else if(length(fruits) < max_fruits)
harvest_timer += time_elapsed
while(harvest_timer >= harvest_time && length(fruits) < max_fruits)
add_fruit()
harvest_timer -= harvest_time

/obj/structure/flora/growing/attackby(obj/item/O, mob/user)
if(user.a_intent == I_HELP)
if(!harvest_tool)
to_chat(user, "You must use your hands to harvest from \the [src].")
return TRUE
if(!O.get_tool_quality(harvest_tool))
var/decl/tool_archetype/tool = GET_DECL(harvest_tool)
to_chat(user, SPAN_WARNING("You must use \a [tool] to harvest from \the [src]."))
return TRUE
harvest(user)
return TRUE
return ..()

/obj/structure/flora/growing/attack_hand(mob/user)
if(user.a_intent == I_HELP)
if(harvest_tool)
var/decl/tool_archetype/tool = GET_DECL(harvest_tool)
to_chat(user, SPAN_WARNING("You must use \a [tool] to harvest from \the [src]."))
else
harvest(user)
return TRUE
return ..()

/obj/structure/flora/growing/proc/harvest(var/mob/user)
if(length(fruits))
var/obj/item/harvest = fruits[1]
harvest.dropInto(get_turf(src))
to_chat(user, SPAN_NOTICE("You harvest \a [harvest] from \the [src]."))
user.put_in_hands(harvest)
fruits -= harvest
update_icon()
else
to_chat(user, SPAN_WARNING("There is nothing to harvest on \the [src]."))

/obj/structure/flora/growing/proc/get_possible_fruits()
return

/obj/structure/flora/growing/proc/add_fruit()
var/list/possible_fruits = get_possible_fruits()
if(length(possible_fruits))
LAZYADD(fruits, pick(possible_fruits))
update_icon()

/obj/structure/flora/growing/proc/advance_growth()
growth_stage++
update_icon()

/obj/structure/flora/growing/on_update_icon()
. = ..()
cut_overlays()
if(dead)
icon_state = "dead"
else
icon_state = num2text(growth_stage)
for(var/i in 1 to length(fruits))
add_overlay("fruit[i]")
8 changes: 8 additions & 0 deletions mods/pyrelight/plants/_plants.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "_plants.dm"
#include "_plot.dm"
#include "_subsystem.dm"
#include "fruit_subtypes/nightweave.dm"
#include "plants_fruit_segment.dm"
#include "plants_fruit_template.dm"
#include "plants_fruit.dm"
#include "plant_subtypes/nightweave.dm"
Empty file added mods/pyrelight/plants/_plot.dm
Empty file.
4 changes: 4 additions & 0 deletions mods/pyrelight/plants/_subsystem.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PROCESSING_SUBSYSTEM_DEF(pyrelight_plants)
name = "Pyrelight Plants"
priority = SS_PRIORITY_PLANTS
wait = 5 SECONDS
39 changes: 39 additions & 0 deletions mods/pyrelight/plants/fruit_subtypes/nightweave.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/obj/item/chems/food/fruit/flower_nightweave
name = "nightweave flower"
desc = "A night-blooming flower found in damp places, such as cavern entrances or along the shoreline."
examine_info = "The bioluminescent petals are extremely poisonous, and the stamen and stigma can be used to brew potent sedatives."
icon = 'mods/pyrelight/icons/fruit/nightweave.dmi'
is_spawnable_type = TRUE

/obj/item/chems/food/fruit/flower_nightweave/get_composition()
var/static/list/composition = list(
new /datum/fruit_segment/petal(
"nightweave petal",
"A faintly glowing petal from a nightweave flower.",
3,
list(
/decl/material/liquid/cyanide = 1
),
"Nightweave petals are exceptionally poisonous, attacking the heart and killing in minutes."
),
new /datum/fruit_segment/stamen(
"nightweave stamen",
"A pollen-laden stamen from a nightweave flower.",
2,
list(
/decl/material/liquid/sedatives = 2
),
"Nightweave pollen is known for its sedative effects, which can be delivered via a pill, in tea, or as snuff."
),
new /datum/fruit_segment/stigma(
"nightweave stigma",
"A tiny, delicate stigma harvested from a nightweave flower.",
1,
list(
/decl/material/liquid/paralytics = 3
),
"The stigma of the nightweave flower is exceptionally difficult to remove intact, but can be refined into a potent paralytic.",
SKILL_EXPERT
)
)
return composition
7 changes: 7 additions & 0 deletions mods/pyrelight/plants/plant_subtypes/nightweave.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/obj/structure/flora/growing/nightweave
name = "nightweave"
is_spawnable_type = TRUE

/obj/structure/flora/growing/nightweave/get_possible_fruits()
var/static/list/possible_fruits = list(/obj/item/chems/food/fruit/flower_nightweave)
return possible_fruits
110 changes: 110 additions & 0 deletions mods/pyrelight/plants/plants_fruit.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/obj/item/chems/food/fruit
name = "abstract fruit"
desc = "A mysterious fruit of some kind."
icon = 'mods/pyrelight/icons/fruit/debug.dmi'
icon_state = "base"
material = /decl/material/solid/organic/plantmatter
is_spawnable_type = FALSE
var/examine_info
var/examine_info_skill = SKILL_BOTANY
var/examine_info_rank = SKILL_BASIC
var/list/removed_segments

/obj/item/chems/food/fruit/initialize_reagents(populate)
var/segment_amount = 0
for(var/datum/fruit_segment/comp as anything in get_composition())
if(comp.contributes_to_fruit_reagents)
segment_amount += comp.reagent_total
create_reagents(segment_amount)
return ..()

/obj/item/chems/food/fruit/populate_reagents()
for(var/datum/fruit_segment/comp as anything in get_composition())
if(!comp.contributes_to_fruit_reagents)
continue
for(var/rid in comp.reagents)
reagents.add_reagent(rid, comp.reagents[rid])
return ..()

/obj/item/chems/food/fruit/Destroy()
removed_segments = null
return ..()

/obj/item/chems/food/fruit/on_update_icon()
. = ..()
var/list/comp_count = list()
for(var/datum/fruit_segment/comp as anything in get_composition())
if(!comp.contributes_to_fruit_icon)
continue
var/remaining = comp.dissect_amount - LAZYACCESS(removed_segments, comp)
if(remaining > 0)
for(var/i = 1 to remaining)
add_overlay(image(icon, "[comp.icon_state][++comp_count[comp.name]]"))

/obj/item/chems/food/fruit/examine(mob/user, distance)
. = ..()
if(distance > 1)
return

if(examine_info && (!examine_info_skill || !examine_info_rank || user.skill_check(examine_info_skill, examine_info_rank)))
to_chat(user, examine_info)

var/list/fruit_comp_strings = list()
for(var/datum/fruit_segment/comp as anything in get_composition())
var/remaining = comp.dissect_amount - LAZYACCESS(removed_segments, comp)
if(remaining <= 0)
continue
if(!comp.dissect_skill || !comp.dissect_skill_requirement || user.skill_check(comp.dissect_skill, comp.dissect_skill_requirement))
var/decl/tool_archetype/tool = comp.dissect_tool && GET_DECL(comp.dissect_tool)
var/comp_string_index = tool?.name ? ADD_ARTICLE(tool.name) : "your hands"
LAZYINITLIST(fruit_comp_strings[comp_string_index])
fruit_comp_strings[comp_string_index][comp.name] += comp.dissect_amount

for(var/comp_ind in fruit_comp_strings)
var/list/comp_string_comps = list()
for(var/comp_string in fruit_comp_strings[comp_ind])
comp_string_comps += "[fruit_comp_strings[comp_ind][comp_string]] [comp_string]\s"
if(length(comp_string_comps))
to_chat(user, SPAN_NOTICE("With [comp_ind], you could harvest [english_list(comp_string_comps)]."))

/obj/item/chems/food/fruit/attackby(obj/item/W, mob/living/user)
if(user?.a_intent != I_HURT)
var/list/fruit_comp = get_composition()
for(var/datum/fruit_segment/comp as anything in fruit_comp)
var/remaining = comp.dissect_amount - LAZYACCESS(removed_segments, comp)
if(remaining <= 0 || !comp.dissect_tool || !W.get_tool_quality(comp.dissect_tool))
continue
comp.on_harvest(W, user, src)
return TRUE
return ..()

/obj/item/chems/food/fruit/attack_self(mob/user)
var/list/fruit_comp = get_composition()
for(var/datum/fruit_segment/comp as anything in fruit_comp)
var/remaining = comp.dissect_amount - LAZYACCESS(removed_segments, comp)
if(remaining <= 0 || comp.dissect_tool)
continue
if(!comp.dissect_skill || !comp.dissect_skill_requirement || user.skill_check(comp.dissect_skill, comp.dissect_skill_requirement))
comp.on_harvest(null, user, src)
return TRUE
return ..()

/obj/item/chems/food/fruit/proc/get_composition()
return

/obj/item/chems/food/fruit/proc/remove_segment(var/datum/fruit_segment/remove_comp)

LAZYINITLIST(removed_segments)
removed_segments[remove_comp]++
if(reagents?.total_volume && remove_comp.contributes_to_fruit_reagents)
for(var/rid in remove_comp.reagents)
reagents.remove_reagent(rid, remove_comp.reagents[rid])

var/list/fruit_comp = get_composition()
for(var/datum/fruit_segment/comp as anything in fruit_comp)
var/remaining = comp.dissect_amount - LAZYACCESS(removed_segments, comp)
if(remaining > 0)
update_icon()
return

qdel(src)
34 changes: 34 additions & 0 deletions mods/pyrelight/plants/plants_fruit_segment.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/obj/item/chems/food/fruit_segment
name = "abstract fruit segment"
is_spawnable_type = FALSE
material = /decl/material/solid/organic/plantmatter
var/datum/fruit_segment/fruit_template

/obj/item/chems/food/fruit_segment/Destroy()
. = ..()
fruit_template = null

/obj/item/chems/food/fruit_segment/Initialize(ml, material_key, datum/fruit_segment/_template, obj/item/_fruit)
if(!_template)
PRINT_STACK_TRACE("Fruit segment created with no template datum.")
return INITIALIZE_HINT_QDEL
name = _template.name
desc = _template.desc
icon = _fruit.icon
icon_state = "seg_[_template.icon_state]"
fruit_template = _template
return ..()

/obj/item/chems/food/fruit_segment/initialize_reagents(populate)
create_reagents(fruit_template.reagent_total)
return ..()

/obj/item/chems/food/fruit_segment/populate_reagents()
for(var/rid in fruit_template.reagents)
reagents.add_reagent(rid, fruit_template.reagents[rid])
return ..()

/obj/item/chems/food/fruit_segment/examine(mob/user, distance)
. = ..()
if(distance <= 1 && fruit_template.examine_info && (!fruit_template.examine_info_skill || !fruit_template.examine_info_rank || user.skill_check(fruit_template.examine_info_skill, fruit_template.examine_info_rank)))
to_chat(user, fruit_template.examine_info)
Loading

0 comments on commit b3491f3

Please sign in to comment.