mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-28 10:01:58 +00:00
This reverts commit e6bb4098c4.
# Conflicts:
# _maps/RandomRuins/LavaRuins/skyrat/lavaland_surface_syndicate_base1_skyrat.dmm
# _maps/RandomRuins/SpaceRuins/bus.dmm
# _maps/RandomZLevels/blackmesa.dmm
# _maps/map_files/generic/CentCom_skyrat_z2.dmm
# _maps/shuttles/skyrat/goldeneye_cruiser.dmm
# _maps/templates/lazy_templates/wizard_den.dmm
# code/__DEFINES/callbacks.dm
# code/datums/components/transforming.dm
# code/datums/elements/bane.dm
# code/datums/votes/map_vote.dm
# code/game/objects/items/AI_modules/hacked.dm
# code/game/objects/items/food/egg.dm
# code/game/objects/items/stacks/sheets/glass.dm
# code/modules/antagonists/fugitive/hunters/hunter.dm
# code/modules/antagonists/traitor/objectives/final_objective/final_objective.dm
# code/modules/antagonists/traitor/objectives/kidnapping.dm
# code/modules/art/statues.dm
# code/modules/events/ghost_role/changeling_event.dm
# code/modules/events/spacevine.dm
# code/modules/mining/machine_redemption.dm
# code/modules/mob/living/simple_animal/friendly/farm_animals.dm
# code/modules/mob_spawn/mob_spawn.dm
# code/modules/projectiles/guns/ballistic/pistol.dm
# code/modules/projectiles/guns/ballistic/rifle.dm
# code/modules/uplink/uplink_items.dm
# code/modules/vending/autodrobe.dm
# html/changelogs/archive/2023-03.yml
# icons/mob/clothing/feet.dmi
# icons/mob/clothing/under/costume.dmi
# icons/mob/inhands/clothing/shoes_lefthand.dmi
# icons/mob/inhands/clothing/shoes_righthand.dmi
# icons/mob/inhands/clothing/suits_lefthand.dmi
# icons/mob/inhands/clothing/suits_righthand.dmi
# icons/mob/species/human/human_face.dmi
# icons/obj/clothing/shoes.dmi
# icons/obj/clothing/under/costume.dmi
# modular_skyrat/master_files/code/datums/components/fullauto.dm
# modular_skyrat/master_files/code/modules/clothing/under/jobs/security.dm
# modular_skyrat/master_files/code/modules/projectiles/guns/gun.dm
# modular_skyrat/master_files/icons/mob/clothing/under/civilian.dmi
# modular_skyrat/master_files/icons/mob/clothing/under/civilian_digi.dmi
# modular_skyrat/modules/aesthetics/guns/code/guns.dm
# modular_skyrat/modules/aesthetics/guns/icons/guns.dmi
# modular_skyrat/modules/blueshield/code/blueshield.dm
# modular_skyrat/modules/customization/modules/clothing/under/misc.dm
# modular_skyrat/modules/ghostcafe/code/ghost_role_spawners.dm
# modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_guns40x32.dmi
# modular_skyrat/modules/manufacturer_examine/code/gun_company_additions.dm
# modular_skyrat/modules/manufacturer_examine/code/manufacturer_component.dm
# modular_skyrat/modules/mapping/code/mob_spawns.dm
# modular_skyrat/modules/modular_weapons/code/rifle.dm
# modular_skyrat/modules/novaya_ert/code/automatic.dm
# modular_skyrat/modules/sec_haul/code/guns/guns.dm
# modular_skyrat/modules/tribal_extended/code/weapons/bow.dm
# tgstation.dme
# tgui/packages/tgui/interfaces/OreRedemptionMachine.js
# tgui/packages/tgui/interfaces/VotePanel.tsx
66 lines
2.2 KiB
Plaintext
66 lines
2.2 KiB
Plaintext
/**
|
|
* ### A fertile egg component!
|
|
*
|
|
* This component tracks over time if the atom is in ideal conditions,
|
|
* and eventually hatches into the embryonic type.
|
|
*
|
|
* The initial design of this component was to make more generic the code for
|
|
* chickens laying eggs.
|
|
*/
|
|
/datum/component/fertile_egg
|
|
/// What will come out of the egg when it's done.
|
|
var/embryo_type
|
|
|
|
/// Minimum growth rate per tick
|
|
var/minimum_growth_rate
|
|
|
|
/// Maximum growth rate per tick
|
|
var/maximum_growth_rate
|
|
|
|
/// Total growth required before hatching.
|
|
var/total_growth_required
|
|
|
|
/// The current amount of growth.
|
|
var/current_growth
|
|
|
|
/// List of locations which, if set, the egg will only develop if in those locations.
|
|
var/list/location_allowlist
|
|
|
|
/// If true, being in an unsuitable location spoils the egg (ie. kills the component). If false, it just pauses the egg's development.
|
|
var/spoilable
|
|
|
|
/datum/component/fertile_egg/Initialize(embryo_type, minimum_growth_rate, maximum_growth_rate, total_growth_required, current_growth, location_allowlist, spoilable, examine_message)
|
|
// Quite how an _area_ can be a fertile egg is an open question, but it still has a location. Technically.
|
|
if(!isatom(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
src.embryo_type = embryo_type
|
|
src.minimum_growth_rate = minimum_growth_rate
|
|
src.maximum_growth_rate = maximum_growth_rate
|
|
src.total_growth_required = total_growth_required
|
|
src.current_growth = current_growth
|
|
src.location_allowlist = location_allowlist
|
|
src.spoilable = spoilable
|
|
|
|
START_PROCESSING(SSobj, src)
|
|
|
|
/datum/component/fertile_egg/Destroy()
|
|
STOP_PROCESSING(SSobj, src)
|
|
. = ..()
|
|
|
|
/datum/component/fertile_egg/process(delta_time)
|
|
var/atom/parent_atom = parent
|
|
|
|
if(location_allowlist && !is_type_in_typecache(parent_atom.loc, location_allowlist))
|
|
// In a zone that is not allowed, do nothing, and possibly self destruct
|
|
if(spoilable)
|
|
qdel(src)
|
|
return
|
|
|
|
current_growth += rand(minimum_growth_rate, maximum_growth_rate) * delta_time
|
|
if(current_growth >= total_growth_required)
|
|
parent_atom.visible_message(span_notice("[parent] hatches with a quiet cracking sound."))
|
|
new embryo_type(get_turf(parent_atom))
|
|
// We destroy the parent on hatch, which will destroy the component as well, which will stop us processing.
|
|
qdel(parent_atom)
|