Floral Somatoray Gene Targeting (#15111)

This commit is contained in:
RustingWithYou
2022-11-24 10:32:09 +13:00
committed by GitHub
parent 4186833649
commit c7deeb930e
8 changed files with 231 additions and 8 deletions
+136
View File
@@ -0,0 +1,136 @@
/datum/seed/proc/diverge_mutate_gene(var/decl/plantgene/G, var/turf/T)
if(!istype(G))
log_debug("Attempted to mutate [src] with a non-plantgene var.")
return src
var/datum/seed/S = diverge() //Let's not modify all of the seeds.
T.visible_message("<span class='notice'>\The [S.display_name] quivers!</span>") //Mimicks the normal mutation.
G.mutate(S, T)
return S
/decl/plantgene
var/gene_tag
/decl/plantgene/biochem
gene_tag = GENE_BIOCHEMISTRY
/decl/plantgene/hardiness
gene_tag = GENE_HARDINESS
/decl/plantgene/environment
gene_tag = GENE_ENVIRONMENT
/decl/plantgene/metabolism
gene_tag = GENE_METABOLISM
/decl/plantgene/structure
gene_tag = GENE_STRUCTURE
/decl/plantgene/diet
gene_tag = GENE_DIET
/decl/plantgene/pigment
gene_tag = GENE_PIGMENT
/decl/plantgene/output
gene_tag = GENE_OUTPUT
/decl/plantgene/atmosphere
gene_tag = GENE_ATMOSPHERE
/decl/plantgene/vigour
gene_tag = GENE_VIGOUR
/decl/plantgene/fruit
gene_tag = GENE_FRUIT
/decl/plantgene/special
gene_tag = GENE_SPECIAL
/decl/plantgene/proc/mutate(var/datum/seed/S)
return
/decl/plantgene/biochem/mutate(var/datum/seed/S)
S.set_trait(TRAIT_POTENCY, S.get_trait(TRAIT_POTENCY)+rand(-20,20),200, 0)
/decl/plantgene/hardiness/mutate(var/datum/seed/S)
if(prob(60))
S.set_trait(TRAIT_TOXINS_TOLERANCE, S.get_trait(TRAIT_TOXINS_TOLERANCE)+rand(-2,2),10,0)
if(prob(60))
S.set_trait(TRAIT_PEST_TOLERANCE, S.get_trait(TRAIT_PEST_TOLERANCE)+rand(-2,2),10,0)
if(prob(60))
S.set_trait(TRAIT_WEED_TOLERANCE, S.get_trait(TRAIT_WEED_TOLERANCE)+rand(-2,2),10,0)
if(prob(60))
S.set_trait(TRAIT_ENDURANCE, S.get_trait(TRAIT_ENDURANCE)+rand(-5,5),100,0)
/decl/plantgene/environment/mutate(var/datum/seed/S)
if(prob(60))
S.set_trait(TRAIT_IDEAL_HEAT, S.get_trait(TRAIT_IDEAL_HEAT)+rand(-2,2),10,0)
if(prob(60))
S.set_trait(TRAIT_IDEAL_LIGHT, S.get_trait(TRAIT_IDEAL_LIGHT)+rand(-2,2),10,0)
if(prob(60))
S.set_trait(TRAIT_LIGHT_TOLERANCE, S.get_trait(TRAIT_LIGHT_TOLERANCE)+rand(-5,5),100,0)
/decl/plantgene/metabolism/mutate(var/datum/seed/S)
if(prob(65))
S.set_trait(TRAIT_REQUIRES_NUTRIENTS, S.get_trait(TRAIT_REQUIRES_NUTRIENTS)+rand(-2,2),10,0)
if(prob(65))
S.set_trait(TRAIT_REQUIRES_WATER, S.get_trait(TRAIT_REQUIRES_WATER)+rand(-2,2),10,0)
if(prob(40))
S.set_trait(TRAIT_ALTER_TEMP, S.get_trait(TRAIT_ALTER_TEMP)+rand(-5,5),100,0)
/decl/plantgene/diet/mutate(var/datum/seed/S)
if(prob(60))
S.set_trait(TRAIT_CARNIVOROUS, S.get_trait(TRAIT_CARNIVOROUS)+rand(-1,1),2,0)
if(prob(60))
S.set_trait(TRAIT_PARASITE, !S.get_trait(TRAIT_PARASITE))
if(prob(65))
S.set_trait(TRAIT_NUTRIENT_CONSUMPTION, S.get_trait(TRAIT_NUTRIENT_CONSUMPTION)+rand(-0.1,0.1),5,0)
if(prob(65))
S.set_trait(TRAIT_WATER_CONSUMPTION, S.get_trait(TRAIT_WATER_CONSUMPTION)+rand(-1,1),50,0)
/decl/plantgene/output/mutate(var/datum/seed/S, var/turf/T)
if(prob(50))
S.set_trait(TRAIT_BIOLUM, !S.get_trait(TRAIT_BIOLUM))
if(S.get_trait(TRAIT_BIOLUM))
T.visible_message("<span class='notice'>\The [S.display_name] begins to glow!</span>")
if(prob(50))
S.set_trait(TRAIT_BIOLUM_COLOUR,get_random_colour(0,75,190))
T.visible_message("<span class='notice'>\The [S.display_name]'s glow </span><font color='[S.get_trait(TRAIT_BIOLUM_COLOUR)]'>changes colour</font>!")
else
T.visible_message("<span class='notice'>\The [S.display_name]'s glow dims...</span>")
if(prob(60))
S.set_trait(TRAIT_PRODUCES_POWER, !S.get_trait(TRAIT_PRODUCES_POWER))
/decl/plantgene/atmosphere/mutate(var/datum/seed/S)
if(prob(60))
S.set_trait(TRAIT_TOXINS_TOLERANCE, S.get_trait(TRAIT_TOXINS_TOLERANCE)+rand(-2,2),10,0)
if(prob(60))
S.set_trait(TRAIT_PEST_TOLERANCE, S.get_trait(TRAIT_PEST_TOLERANCE)+rand(-2,2),10,0)
if(prob(60))
S.set_trait(TRAIT_WEED_TOLERANCE, S.get_trait(TRAIT_WEED_TOLERANCE)+rand(-2,2),10,0)
if(prob(60))
S.set_trait(TRAIT_ENDURANCE, S.get_trait(TRAIT_ENDURANCE)+rand(-5,5),100,0)
/decl/plantgene/vigour/mutate(var/datum/seed/S, var/turf/T)
if(prob(65))
S.set_trait(TRAIT_PRODUCTION, S.get_trait(TRAIT_PRODUCTION)+rand(-1,1),10,0)
if(prob(65))
S.set_trait(TRAIT_MATURATION, S.get_trait(TRAIT_MATURATION)+rand(-1,1),30,0)
if(prob(55))
S.set_trait(TRAIT_SPREAD, S.get_trait(TRAIT_SPREAD)+rand(-1,1),2,0)
T.visible_message("<span class='notice'>\The [S.display_name] spasms visibly, shifting in the tray.</span>")
/decl/plantgene/fruit/mutate(var/datum/seed/S)
if(prob(65))
S.set_trait(TRAIT_STINGS, !S.get_trait(TRAIT_STINGS))
if(prob(65))
S.set_trait(TRAIT_EXPLOSIVE, !S.get_trait(TRAIT_EXPLOSIVE))
if(prob(65))
S.set_trait(TRAIT_JUICY, !S.get_trait(TRAIT_JUICY))
/decl/plantgene/special/mutate(var/datum/seed/S)
if(prob(65))
S.set_trait(TRAIT_TELEPORTING, !S.get_trait(TRAIT_TELEPORTING))
+1 -3
View File
@@ -142,9 +142,7 @@
var/list/data = list()
var/list/geneMasks[0]
for(var/gene_tag in SSplants.gene_tag_masks)
geneMasks.Add(list(list("tag" = gene_tag, "mask" = SSplants.gene_tag_masks[gene_tag])))
var/list/geneMasks = SSplants.gene_masked_list
data["geneMasks"] = geneMasks
data["activity"] = active
+8 -3
View File
@@ -211,9 +211,14 @@
return
//Override for somatoray projectiles.
if(istype(Proj ,/obj/item/projectile/energy/floramut) && prob(20))
mutate(1)
return
if(istype(Proj ,/obj/item/projectile/energy/floramut)&& prob(20))
if(istype(Proj, /obj/item/projectile/energy/floramut/gene))
var/obj/item/projectile/energy/floramut/gene/G = Proj
if(seed)
seed = seed.diverge_mutate_gene(G.gene, get_turf(loc)) //get_turf just in case it's not in a turf.
else
mutate(1)
return
else if(istype(Proj ,/obj/item/projectile/energy/florayield) && prob(20))
yield_mod = min(10,yield_mod+rand(1,2))
return
@@ -24,10 +24,12 @@
origin_tech = list(TECH_MATERIAL = 2, TECH_BIO = 3, TECH_POWER = 3)
modifystate = "floramut"
self_recharge = 1
var/decl/plantgene/gene = null
firemodes = list(
list(mode_name="induce mutations", projectile_type=/obj/item/projectile/energy/floramut, modifystate="floramut"),
list(mode_name="increase yield", projectile_type=/obj/item/projectile/energy/florayield, modifystate="florayield")
list(mode_name="increase yield", projectile_type=/obj/item/projectile/energy/florayield, modifystate="florayield"),
list(mode_name="induce specific mutations", projectile_type=/obj/item/projectile/energy/floramut/gene, modifystate="floramut"),
)
needspin = FALSE
@@ -40,6 +42,22 @@
return
..()
/obj/item/gun/energy/floragun/verb/select_gene()
set name = "Select Gene"
set category = "Object"
set src in view(1)
var/genemask = input("Choose a gene to modify.") as null|anything in SSplants.plant_gene_datums
if(!genemask)
return
gene = SSplants.plant_gene_datums[genemask]
to_chat(usr, SPAN_INFO("You set \the [src]\s targeted genetic area to [genemask]."))
return
/obj/item/gun/energy/meteorgun
name = "meteor gun"
desc = "For the love of god, make sure you're aiming this the right way!"
@@ -140,6 +140,14 @@
nodamage = 1
check_armor = "energy"
/obj/item/projectile/energy/floramut/gene
name = "gamma somatoray"
icon_state = "energy2"
damage = 0
damage_type = TOX
nodamage = TRUE
var/decl/plantgene/gene = null
/obj/item/projectile/energy/floramut/on_hit(var/atom/target, var/blocked = 0)
var/mob/living/M = target
if(ishuman(target))