Implements all-species positive and negative traits

This commit is contained in:
Casey
2022-06-29 02:00:04 -04:00
committed by CHOMPStation2
parent e2227297a5
commit 6ab64ba666
21 changed files with 198 additions and 21 deletions

View File

@@ -5,8 +5,10 @@
var/global/list/hair_accesories_list= list()// Stores /datum/sprite_accessory/hair_accessory indexed by type
var/global/list/negative_traits = list() // Negative custom species traits, indexed by path
var/global/list/neutral_traits = list() // Neutral custom species traits, indexed by path
var/global/list/everyone_traits = list() // Neutral traits available to all species, indexed by path
var/global/list/positive_traits = list() // Positive custom species traits, indexed by path
var/global/list/everyone_traits_positive = list() // Neutral traits available to all species, indexed by path
var/global/list/everyone_traits_neutral = list() // Neutral traits available to all species, indexed by path
var/global/list/everyone_traits_negative = list() // Neutral traits available to all species, indexed by path
var/global/list/traits_costs = list() // Just path = cost list, saves time in char setup
var/global/list/all_traits = list() // All of 'em at once (same instances)
var/global/list/active_ghost_pods = list()
@@ -563,12 +565,16 @@ var/global/list/remainless_species = list(SPECIES_PROMETHEAN,
switch(category)
if(-INFINITY to -0.1)
negative_traits[traitpath] = T
if(!(T.custom_only))
everyone_traits_negative[traitpath] = T
if(0)
neutral_traits[traitpath] = T
if(!(T.custom_only))
everyone_traits[traitpath] = T
everyone_traits_neutral[traitpath] = T
if(0.1 to INFINITY)
positive_traits[traitpath] = T
if(!(T.custom_only))
everyone_traits_positive[traitpath] = T
// Weaver recipe stuff

View File

@@ -95,3 +95,12 @@
P.accuracy += M.accuracy
if(!isnull(M.accuracy_dispersion))
P.dispersion = max(P.dispersion + M.accuracy_dispersion, 0)
<<<<<<< HEAD
=======
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.species)
P.accuracy += H.species.gun_accuracy_mod
P.dispersion = max(P.dispersion + H.species.gun_accuracy_dispersion_mod, 0)
>>>>>>> 4b43b02c06... Merge pull request #13193 from Heroman3003/traitening

View File

@@ -20,7 +20,7 @@
var/list/neg_traits = list()
var/traits_cheating = 0 //Varedit by admins allows saving new maximums on people who apply/etc
var/starting_trait_points = STARTING_SPECIES_POINTS
var/starting_trait_points = 0
var/max_traits = MAX_SPECIES_TRAITS
var/dirty_synth = 0 //Are you a synth
var/gross_meatbag = 0 //Where'd I leave my Voight-Kampff test kit?
@@ -72,7 +72,11 @@
pref.blood_color = sanitize_hexcolor(pref.blood_color, default="#A10808")
if(!pref.traits_cheating)
pref.starting_trait_points = STARTING_SPECIES_POINTS
var/datum/species/S = GLOB.all_species[pref.species]
if(S)
pref.starting_trait_points = S.trait_points
else
pref.starting_trait_points = 0
pref.max_traits = MAX_SPECIES_TRAITS
if(pref.organ_data[O_BRAIN]) //Checking if we have a synth on our hands, boys.
@@ -90,6 +94,9 @@
if(!(path in positive_traits))
pref.pos_traits -= path
continue
if(!(pref.species == SPECIES_CUSTOM) && !(path in everyone_traits_positive))
pref.pos_traits -= path
continue
var/take_flags = initial(path.can_take)
if((pref.dirty_synth && !(take_flags & SYNTHETICS)) || (pref.gross_meatbag && !(take_flags & ORGANICS)))
pref.pos_traits -= path
@@ -98,7 +105,7 @@
if(!(path in neutral_traits))
pref.neu_traits -= path
continue
if(!(pref.species == SPECIES_CUSTOM) && !(path in everyone_traits))
if(!(pref.species == SPECIES_CUSTOM) && !(path in everyone_traits_neutral))
pref.neu_traits -= path
continue
var/take_flags = initial(path.can_take)
@@ -109,6 +116,9 @@
if(!(path in negative_traits))
pref.neg_traits -= path
continue
if(!(pref.species == SPECIES_CUSTOM) && !(path in everyone_traits_negative))
pref.neg_traits -= path
continue
var/take_flags = initial(path.can_take)
if((pref.dirty_synth && !(take_flags & SYNTHETICS)) || (pref.gross_meatbag && !(take_flags & ORGANICS)))
pref.neg_traits -= path
@@ -164,6 +174,7 @@
. += "<a href='?src=\ref[src];custom_base=1'>[pref.custom_base ? pref.custom_base : "Human"]</a><br>"
var/traits_left = pref.max_traits
<<<<<<< HEAD
if(pref.species == SPECIES_CUSTOM)
var/points_left = pref.starting_trait_points
@@ -191,11 +202,41 @@
. += "<li>- <a href='?src=\ref[src];clicked_neg_trait=[T]'>[trait.name] ([trait.cost])</a></li>"
. += "</ul>"
. += "<a href='?src=\ref[src];add_trait=[NEUTRAL_MODE]'>Neutral Trait(s) (No Limit) +</a><br>" // CHOMPEdit: More obvious/clear to players.
=======
var/points_left = pref.starting_trait_points
for(var/T in pref.pos_traits + pref.neg_traits)
points_left -= traits_costs[T]
traits_left--
. += "<b>Traits Left:</b> [traits_left]<br>"
. += "<b>Points Left:</b> [points_left]<br>"
if(points_left < 0 || traits_left < 0 || (!pref.custom_species && pref.species == SPECIES_CUSTOM))
. += "<span style='color:red;'><b>^ Fix things! ^</b></span><br>"
. += "<a href='?src=\ref[src];add_trait=[POSITIVE_MODE]'>Positive Trait +</a><br>"
. += "<ul>"
for(var/T in pref.pos_traits)
var/datum/trait/trait = positive_traits[T]
. += "<li>- <a href='?src=\ref[src];clicked_pos_trait=[T]'>[trait.name] ([trait.cost])</a></li>"
. += "</ul>"
. += "<a href='?src=\ref[src];add_trait=[NEUTRAL_MODE]'>Neutral Trait +</a><br>"
>>>>>>> 4b43b02c06... Merge pull request #13193 from Heroman3003/traitening
. += "<ul>"
for(var/T in pref.neu_traits)
var/datum/trait/trait = neutral_traits[T]
. += "<li>- <a href='?src=\ref[src];clicked_neu_trait=[T]'>[trait.name] ([trait.cost])</a></li>"
. += "</ul>"
. += "<a href='?src=\ref[src];add_trait=[NEGATIVE_MODE]'>Negative Trait +</a><br>"
. += "<ul>"
for(var/T in pref.neg_traits)
var/datum/trait/trait = negative_traits[T]
. += "<li>- <a href='?src=\ref[src];clicked_neg_trait=[T]'>[trait.name] ([trait.cost])</a></li>"
. += "</ul>"
. += "<b>Blood Color: </b>" //People that want to use a certain species to have that species traits (xenochimera/promethean/spider) should be able to set their own blood color.
. += "<a href='?src=\ref[src];blood_color=1'>Set Color</a>"
. += "<a href='?src=\ref[src];blood_reset=1'>R</a><br>"
@@ -328,18 +369,26 @@
var/list/mylist
switch(mode)
if(POSITIVE_MODE)
picklist = positive_traits.Copy() - pref.pos_traits
mylist = pref.pos_traits
if(pref.species == SPECIES_CUSTOM)
picklist = positive_traits.Copy() - pref.pos_traits
mylist = pref.pos_traits
else
picklist = everyone_traits_positive.Copy() - pref.pos_traits
mylist = pref.pos_traits
if(NEUTRAL_MODE)
if(pref.species == SPECIES_CUSTOM)
picklist = neutral_traits.Copy() - pref.neu_traits
mylist = pref.neu_traits
else
picklist = everyone_traits.Copy() - pref.neu_traits
picklist = everyone_traits_neutral.Copy() - pref.neu_traits
mylist = pref.neu_traits
if(NEGATIVE_MODE)
picklist = negative_traits.Copy() - pref.neg_traits
mylist = pref.neg_traits
if(pref.species == SPECIES_CUSTOM)
picklist = negative_traits.Copy() - pref.neg_traits
mylist = pref.neg_traits
else
picklist = everyone_traits_negative.Copy() - pref.neg_traits
mylist = pref.neg_traits
else
if(isnull(picklist))

View File

@@ -6,8 +6,12 @@
default_language = LANGUAGE_VOX
language = LANGUAGE_GALCOM
species_language = LANGUAGE_VOX
<<<<<<< HEAD
num_alternate_languages = 1
color_mult = 1 //CHOMP Edit
=======
num_alternate_languages = 3
>>>>>>> 4b43b02c06... Merge pull request #13193 from Heroman3003/traitening
assisted_langs = list(LANGUAGE_ROOTGLOBAL)
unarmed_types = list(/datum/unarmed_attack/stomp, /datum/unarmed_attack/kick, /datum/unarmed_attack/claws/strong, /datum/unarmed_attack/bite/strong)
rarity_value = 4

View File

@@ -281,6 +281,8 @@
var/wikilink = null //link to wiki page for species
var/icon_height = 32
var/agility = 20 //prob() to do agile things
var/gun_accuracy_mod = 0 // More is better
var/gun_accuracy_dispersion_mod = 0 // More is worse
var/sort_hint = SPECIES_SORT_NORMAL

View File

@@ -25,6 +25,8 @@
var/list/traits = list()
//Vars that need to be copied when producing a copy of species.
var/list/copy_vars = list("base_species", "icobase", "deform", "tail", "tail_animation", "icobase_tail", "color_mult", "primitive_form", "appearance_flags", "flesh_color", "base_color", "blood_mask", "damage_mask", "damage_overlays", "move_trail", "has_floating_eyes")
var/trait_points = 0
/datum/species/proc/give_numbing_bite() //Holy SHIT this is hacky, but it works. Updating a mob's attacks mid game is insane.
unarmed_attacks = list()

View File

@@ -46,6 +46,8 @@
BP_R_FOOT = list("path" = /obj/item/organ/external/foot/right, "descriptor" = "right foot")
)
trait_points = 2
/datum/species/custom/update_sort_hint()
sort_hint = SPECIES_SORT_CUSTOM

View File

@@ -522,7 +522,7 @@
health_hud_intensity = 2.5
item_slowdown_mod = 0.1
num_alternate_languages = 2
num_alternate_languages = 3
name_language = LANGUAGE_ROOTLOCAL
species_language = LANGUAGE_ROOTLOCAL
secondary_langs = list(LANGUAGE_ROOTGLOBAL)

View File

@@ -17,7 +17,7 @@
base_species = "Xenochimera"
selects_bodytype = TRUE
num_alternate_languages = 2
num_alternate_languages = 3
secondary_langs = list("Sol Common")
//color_mult = 1 //It seemed to work fine in testing, but I've been informed it's unneeded.
tail = "tail" //Scree's tail. Can be disabled in the vore tab by choosing "hide species specific tail sprite"
@@ -339,7 +339,7 @@
brute_mod = 0.8 //20% brute damage reduction
burn_mod = 1.15 //15% burn damage increase. They're spiders. Aerosol can+lighter = dead spiders.
num_alternate_languages = 2
num_alternate_languages = 3
secondary_langs = list(LANGUAGE_VESPINAE)
color_mult = 1
tail = "tail" //Spider tail.

View File

@@ -587,7 +587,7 @@
unarmed_types = list(/datum/unarmed_attack/stomp, /datum/unarmed_attack/kick, /datum/unarmed_attack/claws, /datum/unarmed_attack/bite/sharp)
darksight = 4 //Better hunters in the dark.
hunger_factor = 0.1 //In exchange, they get hungry a tad faster.
num_alternate_languages = 2
num_alternate_languages = 3
min_age = 18
max_age = 80

View File

@@ -0,0 +1,7 @@
#define TRAIT_TYPE_NEGATIVE -1
#define TRAIT_TYPE_NEUTRAL 0
#define TRAIT_TYPE_POSITIVE 1
#define TRAIT_VARCHANGE_LESS_BETTER -1
#define TRAIT_VARCHANGE_ALWAYS_OVERRIDE 0
#define TRAIT_VARCHANGE_MORE_BETTER 1

View File

@@ -1,5 +1,5 @@
/datum/trait/negative
category = -1
category = TRAIT_TYPE_NEGATIVE
/datum/trait/negative/speed_slow
name = "Slowdown"
@@ -92,6 +92,8 @@
desc = "Increases your susceptibility to electric shocks by 100%"
cost = -3 //CHOMPEdit
var_changes = list("siemens_coefficient" = 2.0) //This makes you extremely weak to tasers.
custom_only = FALSE
varchange_type = TRAIT_VARCHANGE_LESS_BETTER
/datum/trait/negative/haemophilia
name = "Haemophilia" // CHOMPEdit: Trait List Organization
@@ -99,6 +101,8 @@
cost = -2
var_changes = list("bloodloss_rate" = 2)
can_take = ORGANICS
custom_only = FALSE
varchange_type = TRAIT_VARCHANGE_LESS_BETTER
/datum/trait/negative/hollow
name = "Hollow Bones/Aluminum Alloy"
@@ -116,6 +120,7 @@
desc = "Your light weight and poor balance make you very susceptible to unhelpful bumping. Think of it like a bowling ball versus a pin. (STOP TAKING THIS AS SECURITY! We're MRP, so expect to lose your junk immediately, especially in events. - Love, Admins)" //CHOMP Edit btw
cost = -2
var_changes = list("lightweight" = 1)
custom_only = FALSE
/datum/trait/negative/neural_hypersensitivity
name = "Neural Hypersensitivity"
@@ -137,3 +142,36 @@
name = "Nitrogen Breather"
desc = "You breathe nitrogen instead of oxygen (which is poisonous to you). Incidentally, phoron isn't poisonous to breathe to you."
var_changes = list("breath_type" = "nitrogen", "poison_type" = "oxygen")
/datum/trait/negative/monolingual
name = "Monolingual"
desc = "You are not good at learning languages."
cost = -3
var_changes = list("num_alternate_languages" = 0)
varchange_type = TRAIT_VARCHANGE_MORE_BETTER
/datum/trait/negative/monolingual
name = "Monolingual"
desc = "You are not good at learning languages."
cost = -1
var_changes = list("num_alternate_languages" = 0)
var_changes_pref = list("extra_languages" = -3)
custom_only = FALSE
varchange_type = TRAIT_VARCHANGE_MORE_BETTER
/datum/trait/negative/dark_blind
name = "Nyctalopia"
desc = "You cannot see in dark at all."
cost = -1
var_changes = list("darksight" = 0)
custom_only = FALSE
varchange_type = TRAIT_VARCHANGE_MORE_BETTER
/datum/trait/negative/bad_shooter
name = "Bad Shot"
desc = "You are terrible at aiming."
cost = -1
var_changes = list("gun_accuracy_mod" = -35)
custom_only = FALSE
varchange_type = TRAIT_VARCHANGE_MORE_BETTER

View File

@@ -1,4 +1,5 @@
/datum/trait/neutral
category = TRAIT_TYPE_NEUTRAL
/datum/trait/neutral/metabolism_up
name = "Metabolism, Fast"

View File

@@ -1,5 +1,5 @@
/datum/trait/positive
category = 1
category = TRAIT_TYPE_POSITIVE
/datum/trait/positive/speed_fast
name = "Haste"
@@ -127,6 +127,7 @@
desc = "You can fall from certain heights without suffering any injuries, be it via wings, lightness of frame or general dexterity."
cost = 1
var_changes = list("soft_landing" = TRUE)
custom_only = FALSE
/datum/trait/positive/hardfeet
name = "Hard Feet"
@@ -150,6 +151,8 @@
desc = "You're capable of parkour and can *flip over low objects (most of the time)."
cost = 1 //CHOMPEdit this is not worth 2 points
var_changes = list("agility" = 90)
custom_only = FALSE
varchange_type = TRAIT_VARCHANGE_MORE_BETTER
/datum/trait/positive/snowwalker
name = "Snow Walker"
@@ -182,8 +185,28 @@
name = "Cocoon Spinner"
desc = "Allows you to build a cocoon around yourself, using it to transform your body if you desire."
cost = 1
//custom_only = FALSE
/datum/trait/positive/cocoon_tf/apply(var/datum/species/S,var/mob/living/carbon/human/H)
..(S,H)
H.verbs |= /mob/living/carbon/human/proc/enter_cocoon
<<<<<<< HEAD
H.verbs |= /mob/living/carbon/human/proc/enter_cocoon
=======
H.verbs |= /mob/living/carbon/human/proc/enter_cocoon
/datum/trait/positive/linguist
name = "Linguist"
desc = "Allows you to have more languages."
cost = 1
var_changes = list("num_alternate_languages" = 6)
var_changes_pref = list("extra_languages" = 3)
custom_only = FALSE
varchange_type = TRAIT_VARCHANGE_MORE_BETTER
/datum/trait/positive/good_shooter
name = "Eagle Eye"
desc = "You are better at aiming than most."
cost = 2
var_changes = list("gun_accuracy_mod" = 25)
custom_only = FALSE
varchange_type = TRAIT_VARCHANGE_MORE_BETTER
>>>>>>> 4b43b02c06... Merge pull request #13193 from Heroman3003/traitening

View File

@@ -4,19 +4,22 @@
var/cost = 0
var/sort = TRAIT_SORT_NORMAL // Sort order, 1 before 2 before 3 etc. Alphabetical is used for same-group traits.
var/category = 0 // What category this trait is. -1 is Negative, 0 is Neutral, 1 is Positive
var/category = TRAIT_TYPE_NEUTRAL // What category this trait is. -1 is Negative, 0 is Neutral, 1 is Positive
var/list/var_changes // A list to apply to the custom species vars.
var/list/excludes // Store a list of paths of traits to exclude, but done automatically if they change the same vars.
var/can_take = ORGANICS|SYNTHETICS // Can freaking synths use those.
var/list/banned_species // A list of species that can't take this trait
var/list/allowed_species // VORESTATION EDIT:chomp port. A list of species that CAN take this trait, use this if only a few species can use it. -shark
var/custom_only = TRUE // Trait only available for custom species
var/varchange_type = TRAIT_VARCHANGE_ALWAYS_OVERRIDE //Mostly used for non-custom species.
//Proc can be overridden lower to include special changes, make sure to call up though for the vars changes
/datum/trait/proc/apply(var/datum/species/S,var/mob/living/carbon/human/H)
ASSERT(S)
if(var_changes)
for(var/V in var_changes)
if((category == TRAIT_TYPE_POSITIVE && ((varchange_type == TRAIT_VARCHANGE_LESS_BETTER && var_changes[V] > S.vars[V]) || (varchange_type == TRAIT_VARCHANGE_MORE_BETTER && var_changes[V] < S.vars[V]))) || (category == TRAIT_TYPE_NEGATIVE && ((varchange_type == TRAIT_VARCHANGE_LESS_BETTER && var_changes[V] < S.vars[V]) || (varchange_type == TRAIT_VARCHANGE_MORE_BETTER && var_changes[V] > S.vars[V]))))
continue
S.vars[V] = var_changes[V]
return

View File

@@ -132,7 +132,7 @@
// Emulates targetting a specific body part, and miss chances
// May return null if missed
// miss_chance_mod may be negative.
/proc/get_zone_with_miss_chance(zone, var/mob/target, var/miss_chance_mod = 0, var/ranged_attack=0)
/proc/get_zone_with_miss_chance(zone, var/mob/target, var/miss_chance_mod = 0, var/ranged_attack=0, var/force_hit = FALSE)
zone = check_zone(zone)
if(!ranged_attack)
@@ -144,6 +144,9 @@
if(G.state >= GRAB_AGGRESSIVE)
return zone
if(force_hit)
return zone
var/miss_chance = 10
if (zone in base_miss_chance)
miss_chance = base_miss_chance[zone]

View File

@@ -668,6 +668,12 @@
if(!isnull(M.accuracy_dispersion))
P.dispersion = max(P.dispersion + M.accuracy_dispersion, 0)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.species)
P.accuracy += H.species.gun_accuracy_mod
P.dispersion = max(P.dispersion + H.species.gun_accuracy_dispersion_mod, 0)
//does the actual launching of the projectile
/obj/item/weapon/gun/proc/process_projectile(obj/projectile, mob/user, atom/target, var/target_zone, var/params=null)
var/obj/item/projectile/P = projectile
@@ -804,8 +810,13 @@
user.hud_used.remove_ammo_hud(user, src)
return ..()
<<<<<<< HEAD
/obj/item/weapon/gun/dropped(mob/living/user) // Ditto as above, we remove the HUD. Pending porting TGMC code to clean up this fucking nightmare of spaghetti.
=======
/obj/item/weapon/gun/dropped(mob/living/user) // Ditto as above, we remove the HUD. Pending porting TGMC code to clean up this fucking nightmare of spaghetti.
>>>>>>> 4b43b02c06... Merge pull request #13193 from Heroman3003/traitening
user.hud_used.remove_ammo_hud(user, src)
..()

View File

@@ -17,6 +17,8 @@
combustion = FALSE
can_miss = FALSE
muzzle_type = /obj/effect/projectile/muzzle/medigun
tracer_type = /obj/effect/projectile/tracer/medigun
impact_type = /obj/effect/projectile/impact/medigun

View File

@@ -40,6 +40,7 @@
var/ricochets = 0
var/ricochets_max = 2
var/ricochet_chance = 30
var/can_miss = TRUE
//Hitscan
var/hitscan = FALSE //Whether this is hitscan. If it is, speed is basically ignored.
@@ -139,7 +140,7 @@
var/impact_effect_type = null
var/list/impacted_mobs = list()
// TGMC Ammo HUD Port
var/hud_state = "unknown" // What HUD state we use when we have ammunition.
var/hud_state_empty = "unknown" // The empty state. DON'T USE _FLASH IN THE NAME OF THE EMPTY STATE STRING, THAT IS ADDED BY THE CODE.
@@ -662,8 +663,13 @@
return
//roll to-hit
<<<<<<< HEAD
miss_modifier = max(miss_modifier + target_mob.get_evasion(), -100) //CHOMPEDIT - removing baymiss
var/hit_zone = get_zone_with_miss_chance(def_zone, target_mob, miss_modifier, ranged_attack=(distance > 1 || original != target_mob)) //if the projectile hits a target we weren't originally aiming at then retain the chance to miss
=======
miss_modifier = max(15*(distance-2) - accuracy + miss_modifier + target_mob.get_evasion(), -100)
var/hit_zone = get_zone_with_miss_chance(def_zone, target_mob, miss_modifier, ranged_attack=(distance > 1 || original != target_mob), force_hit = !can_miss) //if the projectile hits a target we weren't originally aiming at then retain the chance to miss
>>>>>>> 4b43b02c06... Merge pull request #13193 from Heroman3003/traitening
var/result = PROJECTILE_FORCE_MISS
if(hit_zone)

View File

@@ -136,6 +136,7 @@
damage = 0
check_armour = "laser"
var/set_size = 1 //Let's default to 100%
can_miss = FALSE
muzzle_type = /obj/effect/projectile/muzzle/xray
tracer_type = /obj/effect/projectile/tracer/xray

View File

@@ -3044,6 +3044,14 @@
#include "code\modules\mob\living\carbon\human\species\station\teshari_vr.dm"
#include "code\modules\mob\living\carbon\human\species\station\xenochimera_hud_vr.dm"
#include "code\modules\mob\living\carbon\human\species\station\xenochimera_trait_vr.dm"
<<<<<<< HEAD
=======
#include "code\modules\mob\living\carbon\human\species\station\protean_vr\_protean_defines.dm"
#include "code\modules\mob\living\carbon\human\species\station\protean_vr\protean_blob.dm"
#include "code\modules\mob\living\carbon\human\species\station\protean_vr\protean_powers.dm"
#include "code\modules\mob\living\carbon\human\species\station\protean_vr\protean_species.dm"
#include "code\modules\mob\living\carbon\human\species\station\traits_vr\_traits.dm"
>>>>>>> 4b43b02c06... Merge pull request #13193 from Heroman3003/traitening
#include "code\modules\mob\living\carbon\human\species\station\traits_vr\negative.dm"
#include "code\modules\mob\living\carbon\human\species\station\traits_vr\negative_ch.dm"
#include "code\modules\mob\living\carbon\human\species\station\traits_vr\neutral.dm"