Files
Paradise/code/modules/hydroponics/grown/replicapod.dm
Alan 6d36af8e5b Migrate seeds to the new attack chain. (#32326)
* Migrate seeds to the new attack chain.

* Apply suggestion from CRUNCH review.

Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
Signed-off-by: Alan <alfalfascout@users.noreply.github.com>

---------

Signed-off-by: Alan <alfalfascout@users.noreply.github.com>
Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
2026-07-24 19:35:48 +00:00

109 lines
3.7 KiB
Plaintext

// A very special plant, deserving it's own file.
/obj/item/seeds/replicapod
name = "pack of replica pod seeds"
desc = "These seeds grow into replica pods. They say these are used to harvest humans."
icon_state = "seed-replicapod"
species = "replicapod"
plantname = "Replica Pod"
product = /mob/living/carbon/human/diona //verrry special -- Urist
lifespan = 50
endurance = 8
maturation = 10
production = 1
yield = 1 //seeds if there isn't a dna inside
potency = 30
var/ckey = null
var/realName = null
var/datum/mind/mind = null
var/blood_gender = null
var/blood_type = null
var/factions = null
var/contains_sample = 0
/obj/item/seeds/replicapod/Destroy()
mind = null
return ..()
/obj/item/seeds/replicapod/item_interaction(mob/user, obj/item/used, list/modifiers)
if(!istype(used, /obj/item/reagent_containers/syringe))
return ..()
if(contains_sample)
to_chat(user, SPAN_WARNING("The seeds already contain a genetic sample!"))
return ITEM_INTERACT_COMPLETE
for(var/datum/reagent/blood/bloodSample in used.reagents.reagent_list)
var/datum/dna/dna = bloodSample.data["dna"]
if(!(bloodSample.data["mind"] && bloodSample.data["cloneable"] && !(NO_CLONESCAN in dna.species.species_traits)))
to_chat(user, SPAN_WARNING("The seeds reject the sample!"))
return ITEM_INTERACT_COMPLETE
mind = bloodSample.data["mind"]
ckey = bloodSample.data["ckey"]
realName = bloodSample.data["real_name"]
blood_gender = bloodSample.data["gender"]
blood_type = bloodSample.data["blood_type"]
factions = bloodSample.data["factions"]
used.reagents.clear_reagents()
to_chat(user, SPAN_NOTICE("You inject the contents of the syringe into the seeds."))
contains_sample = 1
add_fingerprint(user)
return ITEM_INTERACT_COMPLETE
/obj/item/seeds/replicapod/get_analyzer_text()
var/text = ..()
if(contains_sample)
text += "\n It contains a blood sample!"
return text
/obj/item/seeds/replicapod/harvest(mob/user, obj/item/storage/bag/plants/bag)
var/obj/machinery/hydroponics/parent = loc
var/make_podman = 0
var/ckey_holder = null
if(GLOB.configuration.general.enable_revival_pod_plants)
if(ckey)
for(var/mob/M in GLOB.player_list)
if(isobserver(M))
var/mob/dead/observer/ghost = M
if(ghost.ckey == ckey && ghost.ghost_flags & GHOST_CAN_REENTER)
make_podman = 1
break
else
if(M.ckey == ckey && M.stat == DEAD && !M.suiciding)
make_podman = 1
break
else //If the player has ghosted from his corpse before blood was drawn, his ckey is no longer attached to the mob, so we need to match up the cloned player through the mind key
for(var/mob/M in GLOB.player_list)
if(mind && M.mind && ckey(M.mind.key) == ckey(mind.key) && M.ckey && M.client && M.stat == DEAD && !M.suiciding)
if(isobserver(M))
var/mob/dead/observer/ghost = M
if(!(ghost.ghost_flags & GHOST_CAN_REENTER))
break
make_podman = 1
ckey_holder = M.ckey
break
if(make_podman) //all conditions met!
var/mob/living/carbon/human/pod_diona/podman = new /mob/living/carbon/human/pod_diona(parent.loc)
if(realName)
podman.real_name = realName
mind.transfer_to(podman)
if(ckey)
podman.ckey = ckey
else
podman.ckey = ckey_holder
podman.gender = blood_gender
podman.faction |= factions
SSblackbox.record_feedback("tally", "players_revived", 1, "replica_pod")
else //else, one packet of seeds. maybe two
var/seed_count = 1
if(prob(getYield() * 20))
seed_count++
var/output_loc = parent.Adjacent(user) ? user.loc : parent.loc //needed for TK
for(var/i=0,i<seed_count,i++)
var/obj/item/seeds/replicapod/harvestseeds = src.Copy()
harvestseeds.forceMove(output_loc)
if(bag && bag.can_be_inserted(harvestseeds))
bag.handle_item_insertion(harvestseeds, user, TRUE)
parent.update_tray(user, 1)