[MIRROR] Kudzu Fixes v4, hopefully the last one: Fix kudzu possibly obtaining duplicate mutations when being planted from a seed that already has mutations [MDB IGNORE] (#15671)

* Kudzu Fixes v4, hopefully the last one: Fix kudzu possibly obtaining duplicate mutations when being planted from a seed that already has mutations

* Fixes conflict

* Updates the modular spacevines as well to inherit a bit of the improvements (should be brought up to speed later)

Co-authored-by: RandomGamer123 <31096837+RandomGamer123@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
This commit is contained in:
SkyratBot
2022-08-18 15:05:02 +01:00
committed by GitHub
co-authored by RandomGamer123 GoldenAlpharex GoldenAlpharex
parent 49c6b11900
commit 435a459b4d
2 changed files with 20 additions and 8 deletions
+11 -5
View File
@@ -43,6 +43,10 @@
/// Kudzu spread multiplier is a reciporal function of production speed, such that the better the production speed, ie. the lower the speed value is, the faster it spreads
#define SPREAD_MULTIPLIER_MAX 50
/// Kudzu's maximum possible maximum mutation severity (assuming ideal potency), used to balance mutation appearance chance
#define IDEAL_MAX_SEVERITY 20
/datum/round_event_control/spacevine
name = "Space Vines"
typepath = /datum/round_event/spacevine
@@ -525,7 +529,7 @@
var/spread_multiplier = 5 // corresponds to artifical kudzu with production speed of 1, approaches 10% of total vines will spread per second
///Maximum spreading limit (ie. how many kudzu can there be) for this controller
var/spread_cap = 30 // corresponds to artifical kudzu with production speed of 3.5
var/list/vine_mutations_list
var/static/list/vine_mutations_list
var/mutativeness = 1
///Maximum sum of mutation severities
var/max_mutation_severity = 20
@@ -540,10 +544,11 @@
if(event)
event.announce_to_ghosts(vine)
START_PROCESSING(SSobj, src)
vine_mutations_list = list()
init_subtypes(/datum/spacevine_mutation/, vine_mutations_list)
for(var/datum/spacevine_mutation/mutation as anything in vine_mutations_list)
vine_mutations_list[mutation] = max_mutation_severity - mutation.severity // this is intended to be before the potency check as the ideal maximum potency is used for weighting
if(!vine_mutations_list)
vine_mutations_list = list()
init_subtypes(/datum/spacevine_mutation/, vine_mutations_list)
for(var/datum/spacevine_mutation/mutation as anything in vine_mutations_list)
vine_mutations_list[mutation] = IDEAL_MAX_SEVERITY - mutation.severity // the ideal maximum potency is used for weighting
if(potency != null)
mutativeness = potency * MUTATIVENESS_SCALE_FACTOR // If potency is 100, 20 mutativeness; if 1: 0.2 mutativeness
max_mutation_severity = round(potency * MAX_SEVERITY_LINEAR_COEFF + MAX_SEVERITY_CONSTANT_TERM) // If potency is 100, 25 max mutation severity; if 1, 10 max mutation severity
@@ -760,4 +765,5 @@
#undef SPREAD_CAP_LINEAR_COEFF
#undef SPREAD_CAP_CONSTANT_TERM
#undef SPREAD_MULTIPLIER_MAX
#undef IDEAL_MAX_SEVERITY
*/
@@ -36,6 +36,10 @@
/// Kudzu spread multiplier is a reciporal function of production speed, such that the better the production speed, ie. the lower the speed value is, the faster it spreads
#define SPREAD_MULTIPLIER_MAX 50
/// Kudzu's maximum possible maximum mutation severity (assuming ideal potency), used to balance mutation appearance chance
#define IDEAL_MAX_SEVERITY 20
/datum/round_event_control/spacevine
name = "Space Vines"
typepath = /datum/round_event/spacevine
@@ -767,7 +771,7 @@
/// The actual cap to how quickly it spreads.
var/spread_cap = 30
/// A referenced list to all of the current mutations the vine has!
var/list/vine_mutations_list
var/list/static/vine_mutations_list
/// How likely it is to mutate!
var/mutativeness = 1
@@ -779,8 +783,9 @@
if (event)
event.announce_to_ghosts(spawned_vine)
START_PROCESSING(SSobj, src)
vine_mutations_list = list()
init_subtypes(/datum/spacevine_mutation/, vine_mutations_list)
if(!vine_mutations_list)
vine_mutations_list = list()
init_subtypes(/datum/spacevine_mutation/, vine_mutations_list)
if(potency != null)
mutativeness = potency / 10
if(production != null && production <= 10) // Prevents runtime in case production is set to 11.
@@ -986,3 +991,4 @@
#undef SEVERITY_AVERAGE
#undef SEVERITY_ABOVE_AVERAGE
#undef SEVERITY_MAJOR
#undef IDEAL_MAX_SEVERITY