mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 13:05:44 +01:00
Exoplanet Random Plants (#17967)
* icons * and now, we suffer * i keep screaming but god wont answer * adapt seed * Update code/modules/hydroponics/trays/tray_update_icons.dm Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it> * Update code/modules/hydroponics/trays/tray_update_icons.dm Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it> * Update code/modules/hydroponics/trays/tray_update_icons.dm Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it> * Update code/modules/hydroponics/trays/tray_update_icons.dm Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it> * addresses requested changes --------- Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it>
This commit is contained in:
co-authored by
Matt Atlas
parent
9a0d640f3f
commit
6f9140382f
@@ -65,6 +65,7 @@
|
||||
set_trait(TRAIT_IDEAL_HEAT, 293) // Preferred temperature in Kelvin.
|
||||
set_trait(TRAIT_NUTRIENT_CONSUMPTION, 0.25) // Plant eats this much per tick.
|
||||
set_trait(TRAIT_PLANT_COLOUR, "#46B543") // Colour of the plant icon.
|
||||
set_trait(TRAIT_LARGE, 0) //0 = normal plant, 1 = big tree
|
||||
|
||||
setup_traits()
|
||||
|
||||
@@ -369,7 +370,7 @@
|
||||
display_name = "[name] plant"
|
||||
|
||||
//Creates a random seed. MAKE SURE THE LINE HAS DIVERGED BEFORE THIS IS CALLED.
|
||||
/datum/seed/proc/randomize()
|
||||
/datum/seed/proc/randomize(var/list/native_gases = list(GAS_OXYGEN, GAS_NITROGEN, GAS_CO2, GAS_PHORON, GAS_HYDROGEN))
|
||||
roundstart = FALSE
|
||||
mysterious = TRUE
|
||||
|
||||
@@ -404,12 +405,12 @@
|
||||
|
||||
if(prob(5))
|
||||
consume_gasses = list()
|
||||
var/gas = pick(GAS_OXYGEN,GAS_NITROGEN,GAS_PHORON,GAS_CO2,GAS_HYDROGEN)
|
||||
var/gas = pick_n_take(native_gases)
|
||||
consume_gasses[gas] = rand(3,9)
|
||||
|
||||
if(prob(5))
|
||||
exude_gasses = list()
|
||||
var/gas = pick(GAS_OXYGEN,GAS_NITROGEN,GAS_PHORON,GAS_CO2,GAS_HYDROGEN)
|
||||
var/gas = pick_n_take(native_gases)
|
||||
exude_gasses[gas] = rand(3,9)
|
||||
|
||||
chems = list()
|
||||
@@ -691,9 +692,9 @@
|
||||
if(GENE_ENVIRONMENT)
|
||||
traits_to_copy = list(TRAIT_IDEAL_HEAT,TRAIT_IDEAL_LIGHT,TRAIT_LIGHT_TOLERANCE)
|
||||
if(GENE_PIGMENT)
|
||||
traits_to_copy = list(TRAIT_PLANT_COLOUR,TRAIT_PRODUCT_COLOUR,TRAIT_BIOLUM_COLOUR)
|
||||
traits_to_copy = list(TRAIT_PLANT_COLOUR,TRAIT_PRODUCT_COLOUR,TRAIT_BIOLUM_COLOUR,TRAIT_LEAVES_COLOUR)
|
||||
if(GENE_STRUCTURE)
|
||||
traits_to_copy = list(TRAIT_PLANT_ICON,TRAIT_PRODUCT_ICON,TRAIT_HARVEST_REPEAT, TRAIT_SPOROUS)
|
||||
traits_to_copy = list(TRAIT_PLANT_ICON,TRAIT_PRODUCT_ICON,TRAIT_HARVEST_REPEAT, TRAIT_SPOROUS, TRAIT_LARGE)
|
||||
if(GENE_FRUIT)
|
||||
traits_to_copy = list(TRAIT_STINGS,TRAIT_EXPLOSIVE,TRAIT_FLESH_COLOUR,TRAIT_JUICY)
|
||||
if(GENE_SPECIAL)
|
||||
@@ -807,3 +808,41 @@
|
||||
growth_stages = SSplants.plant_sprites[get_trait(TRAIT_PLANT_ICON)]
|
||||
else
|
||||
growth_stages = 0
|
||||
|
||||
/datum/seed/proc/get_growth_type()
|
||||
if(get_trait(TRAIT_SPREAD) == 2)
|
||||
switch(seed_noun)
|
||||
if(SEED_NOUN_CUTTINGS)
|
||||
return GROWTH_WORMS
|
||||
if(SEED_NOUN_NODES)
|
||||
return GROWTH_BIOMASS
|
||||
if(SEED_NOUN_SPORES)
|
||||
return GROWTH_MOLD
|
||||
else
|
||||
return GROWTH_VINES
|
||||
return 0
|
||||
|
||||
/datum/seed/proc/get_icon(growth_stage)
|
||||
var/image/res = image('icons/obj/hydroponics_growing.dmi', "[get_trait(TRAIT_PLANT_ICON)]-[growth_stage]")
|
||||
if(get_growth_type())
|
||||
res.icon_state = "[get_growth_type()]-[growth_stage]"
|
||||
else
|
||||
res.icon_state = "[get_trait(TRAIT_PLANT_ICON)]-[growth_stage]"
|
||||
|
||||
if(get_growth_type())
|
||||
res.icon = 'icons/obj/hydroponics_vines.dmi'
|
||||
|
||||
res.color = get_trait(TRAIT_PLANT_COLOUR)
|
||||
|
||||
if(get_trait(TRAIT_LARGE))
|
||||
res.icon = 'icons/obj/hydroponics_large.dmi'
|
||||
res.pixel_x = -8
|
||||
res.pixel_y = -16
|
||||
|
||||
if(get_trait(TRAIT_LEAVES_COLOUR))
|
||||
var/image/I = image(res.icon, "[get_trait(TRAIT_PLANT_ICON)]-[growth_stage]-leaves")
|
||||
I.color = get_trait(TRAIT_LEAVES_COLOUR)
|
||||
I.appearance_flags = RESET_COLOR
|
||||
res.overlays += I
|
||||
|
||||
return res
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
opacity = 0
|
||||
density = 0
|
||||
icon = 'icons/obj/hydroponics_growing.dmi'
|
||||
icon_state = "bush4-1"
|
||||
icon_state = ""
|
||||
layer = 3
|
||||
movable_flags = MOVABLE_FLAG_PROXMOVE
|
||||
pass_flags = PASSTABLE
|
||||
@@ -100,18 +100,10 @@
|
||||
|
||||
name = seed.display_name
|
||||
max_health = round(seed.get_trait(TRAIT_ENDURANCE)/2)
|
||||
if(seed.get_trait(TRAIT_SPREAD)==2)
|
||||
if(seed.get_trait(TRAIT_SPREAD)==GROWTH_VINES)
|
||||
max_growth = VINE_GROWTH_STAGES
|
||||
growth_threshold = max_health/VINE_GROWTH_STAGES
|
||||
icon = 'icons/obj/hydroponics_vines.dmi'
|
||||
growth_type = 2 // Vines by default.
|
||||
if(seed.get_trait(TRAIT_CARNIVOROUS) == 2)
|
||||
growth_type = 1 // WOOOORMS.
|
||||
else if(!(seed.seed_noun in list(SEED_NOUN_SEEDS,SEED_NOUN_PITS)))
|
||||
if(seed.seed_noun == SEED_NOUN_NODES)
|
||||
growth_type = 3 // Biomass
|
||||
else
|
||||
growth_type = 4 // Mold
|
||||
growth_type = seed.get_growth_type()
|
||||
else
|
||||
max_growth = seed.growth_stages
|
||||
growth_threshold = max_health/seed.growth_stages
|
||||
@@ -123,7 +115,7 @@
|
||||
|
||||
mature_time = world.time + seed.get_trait(TRAIT_MATURATION) + 15 //prevent vines from maturing until at least a few seconds after they've been created.
|
||||
spread_chance = seed.get_trait(TRAIT_POTENCY)
|
||||
spread_distance = ((growth_type > 0) ? round(spread_chance * 0.6) : round(spread_chance * 0.3))
|
||||
spread_distance = (growth_type ? round(spread_chance * 0.6) : round(spread_chance * 0.3))
|
||||
update_icon()
|
||||
addtimer(CALLBACK(src, PROC_REF(post_initialize)), 1)
|
||||
|
||||
@@ -140,7 +132,7 @@
|
||||
/obj/effect/plant/update_icon()
|
||||
//TODO: should really be caching this.
|
||||
refresh_icon()
|
||||
if(growth_type == 0 && !floor)
|
||||
if(!growth_type && !floor)
|
||||
src.transform = null
|
||||
var/matrix/M = matrix()
|
||||
// should make the plant flush against the wall it's meant to be growing from.
|
||||
@@ -172,6 +164,7 @@
|
||||
last_biolum = null
|
||||
|
||||
/obj/effect/plant/proc/refresh_icon()
|
||||
overlays.Cut()
|
||||
var/growth = 0
|
||||
if(growth_threshold)
|
||||
growth = min(max_growth,round(health/growth_threshold))
|
||||
@@ -181,25 +174,17 @@
|
||||
max_growth--
|
||||
if(at_fringe >= (spread_distance-2))
|
||||
max_growth--
|
||||
max_growth = max(1,max_growth)
|
||||
if(growth_type > 0)
|
||||
switch(growth_type)
|
||||
if(1)
|
||||
icon_state = "worms"
|
||||
if(2)
|
||||
icon_state = "vines-[growth]"
|
||||
if(3)
|
||||
icon_state = "mass-[growth]"
|
||||
if(4)
|
||||
icon_state = "mold-[growth]"
|
||||
else
|
||||
icon_state = "[seed.get_trait(TRAIT_PLANT_ICON)]-[growth]"
|
||||
|
||||
if(growth>2 && growth == max_growth)
|
||||
layer = (seed && seed.force_layer) ? seed.force_layer : 5
|
||||
opacity = 1
|
||||
if(growth_type in list(GROWTH_VINES,GROWTH_BIOMASS))
|
||||
opacity = 1
|
||||
if(islist(seed.chems) && !isnull(seed.chems[/singleton/reagent/woodpulp]))
|
||||
opacity = 1
|
||||
density = 1
|
||||
if(seed.get_trait(TRAIT_LARGE))
|
||||
density = 1
|
||||
opacity = 1
|
||||
else
|
||||
layer = (seed && seed.force_layer) ? seed.force_layer : 5
|
||||
density = 0
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
if(istype(mover) && mover.checkpass(PASSTABLE))
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
return !density
|
||||
|
||||
/obj/machinery/portable_atmospherics/hydroponics/proc/check_health()
|
||||
if(seed && !dead && health <= 0)
|
||||
|
||||
@@ -40,9 +40,6 @@
|
||||
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/close_lid_verb
|
||||
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/setlight
|
||||
|
||||
/obj/machinery/portable_atmospherics/hydroponics/soil/CanPass()
|
||||
return 1
|
||||
|
||||
// Holder for vine plants.
|
||||
// Icons for plants are generated as overlays, so setting it to invisible wouldn't work.
|
||||
// Hence using a blank icon.
|
||||
@@ -52,14 +49,16 @@
|
||||
icon = 'icons/obj/seeds.dmi'
|
||||
icon_state = "blank"
|
||||
|
||||
/obj/machinery/portable_atmospherics/hydroponics/soil/invisible/New(var/newloc,var/datum/seed/newseed)
|
||||
/obj/machinery/portable_atmospherics/hydroponics/soil/invisible/Initialize(var/newloc,var/datum/seed/newseed,var/start_mature)
|
||||
..()
|
||||
seed = newseed
|
||||
dead = 0
|
||||
age = 1
|
||||
age = start_mature ? seed.get_trait(TRAIT_MATURATION) : 1
|
||||
health = seed.get_trait(TRAIT_ENDURANCE)
|
||||
lastcycle = world.time
|
||||
pixel_y = rand(-5,5)
|
||||
waterlevel = 100
|
||||
nutrilevel = 100
|
||||
check_health()
|
||||
|
||||
/obj/machinery/portable_atmospherics/hydroponics/soil/invisible/remove_dead()
|
||||
|
||||
@@ -40,17 +40,11 @@
|
||||
if(maturation < 1)
|
||||
maturation = 1
|
||||
overlay_stage = maturation ? max(1,round(age/maturation)) : 1
|
||||
var/ikey = "[seed.get_trait(TRAIT_PLANT_ICON)]-[overlay_stage]"
|
||||
var/image/plant_overlay = SSplants.plant_icon_cache["[ikey]-[seed.get_trait(TRAIT_PLANT_COLOUR)]"]
|
||||
if(!plant_overlay)
|
||||
plant_overlay = image('icons/obj/hydroponics_growing.dmi', "[ikey]")
|
||||
plant_overlay.color = seed.get_trait(TRAIT_PLANT_COLOUR)
|
||||
SSplants.plant_icon_cache["[ikey]-[seed.get_trait(TRAIT_PLANT_COLOUR)]"] = plant_overlay
|
||||
|
||||
var/image/plant_overlay = seed.get_icon(overlay_stage)
|
||||
add_overlay(plant_overlay)
|
||||
|
||||
if(harvest && overlay_stage == seed.growth_stages)
|
||||
ikey = "[seed.get_trait(TRAIT_PRODUCT_ICON)]"
|
||||
var/ikey = "[seed.get_trait(TRAIT_PRODUCT_ICON)]"
|
||||
var/image/harvest_overlay = SSplants.plant_icon_cache["product-[ikey]-[seed.get_trait(TRAIT_PLANT_COLOUR)]"]
|
||||
if(!harvest_overlay)
|
||||
harvest_overlay = image('icons/obj/hydroponics_products.dmi', "[ikey]")
|
||||
@@ -73,6 +67,13 @@
|
||||
if(harvest)
|
||||
add_overlay("over_harvest3")
|
||||
|
||||
if(seed && seed.get_trait(TRAIT_LARGE))
|
||||
density = TRUE
|
||||
opacity = TRUE
|
||||
else
|
||||
density = FALSE
|
||||
opacity = FALSE
|
||||
|
||||
// Update bioluminescence.
|
||||
if(seed && seed.get_trait(TRAIT_BIOLUM))
|
||||
var/pwr
|
||||
|
||||
Reference in New Issue
Block a user