Adds minor roundstart traits! (ala CDDA, etc.)

This commit is contained in:
Ashe Higgs
2018-03-01 19:39:44 -05:00
committed by CitadelStationBot
parent 3690cf3309
commit 0a449af83e
36 changed files with 825 additions and 52 deletions
+2
View File
@@ -46,6 +46,8 @@
return
var/damage = rand(min_damage, max_damage)
if(H.has_trait(TRAIT_LIGHT_STEP))
damage *= 0.75
H.apply_damage(damage, BRUTE, picked_def_zone)
if(cooldown < world.time - 10) //cooldown to avoid message spam.
+108
View File
@@ -0,0 +1,108 @@
//every trait in this folder should be coded around being applied on spawn
//these are NOT "mob traits" like GOTTAGOFAST, but exist as a medium to apply them and other different effects
/datum/trait
var/name = "Test Trait"
var/desc = "This is a test trait."
var/value = 0
var/human_only = TRUE
var/gain_text
var/lose_text
var/medical_record_text //This text will appear on medical records for the trait. Not yet implemented
var/mob_trait //if applicable, apply and remove this mob trait
var/mob/living/trait_holder
/datum/trait/New(mob/living/trait_mob)
..()
if(!trait_mob || (human_only && !ishuman(trait_mob)) || trait_mob.has_trait_datum(type))
qdel(src)
trait_holder = trait_mob
SStraits.trait_objects += src
to_chat(trait_holder, gain_text)
trait_holder.roundstart_traits += src
if(mob_trait)
trait_holder.add_trait(mob_trait, ROUNDSTART_TRAIT)
START_PROCESSING(SStraits, src)
add()
if(!SSticker.HasRoundStarted()) //on roundstart or on latejoin; latejoin code is in new_player.dm
on_spawn()
addtimer(CALLBACK(src, .proc/post_add), 30)
/datum/trait/Destroy()
STOP_PROCESSING(SStraits, src)
remove()
if(trait_holder)
to_chat(trait_holder, lose_text)
trait_holder.roundstart_traits -= src
if(mob_trait)
trait_holder.remove_trait(mob_trait, ROUNDSTART_TRAIT, TRUE)
SStraits.trait_objects -= src
return ..()
/datum/trait/proc/add() //special "on add" effects
/datum/trait/proc/on_spawn() //these should only trigger when the character is being created for the first time, i.e. roundstart/latejoin
/datum/trait/proc/remove() //special "on remove" effects
/datum/trait/proc/on_process() //process() has some special checks, so this is the actual process
/datum/trait/proc/post_add() //for text, disclaimers etc. given after you spawn in with the trait
/datum/trait/process()
if(QDELETED(trait_holder))
qdel(src)
return
on_process()
/mob/living/proc/get_trait_string(medical) //helper string. gets a string of all the traits the mob has
var/list/dat = list()
if(!medical)
for(var/V in roundstart_traits)
var/datum/trait/T = V
dat += T.name
if(!dat.len)
return "None"
return dat.Join(", ")
else
for(var/V in roundstart_traits)
var/datum/trait/T = V
dat += T.medical_record_text
if(!dat.len)
return "None"
return dat.Join("<br>")
/*
Commented version of Nearsighted to help you add your own traits
Use this as a guideline
/datum/trait/nearsighted
name = "Nearsighted"
///The trait's name
desc = "You are nearsighted without prescription glasses, but spawn with a pair."
///Short description, shows next to name in the trait panel
value = -1
///If this is above 0, it's a positive trait; if it's not, it's a negative one; if it's 0, it's a neutral
mob_trait = TRAIT_NEARSIGHT
///This define is in __DEFINES/traits.dm and is the actual "trait" that the game tracks
///You'll need to use "has_trait(X, sources)" checks around the code to check this; for instance, the Ageusia trait is checked in taste code
///If you need help finding where to put it, the declaration finder on GitHub is the best way to locate it
gain_text = "<span class='danger'>Things far away from you start looking blurry.</span>"
lose_text = "<span class='notice'>You start seeing faraway things normally again.</span>"
medical_record_text = "Subject has permanent nearsightedness."
///These three are self-explanatory
/datum/trait/nearsighted/on_spawn()
var/mob/living/carbon/human/H = trait_holder
var/obj/item/clothing/glasses/regular/glasses = new(get_turf(H))
H.put_in_hands(glasses)
H.equip_to_slot(glasses, slot_glasses)
H.regenerate_icons()
//This whole proc is called automatically
//It spawns a set of prescription glasses on the user, then attempts to put it into their hands, then attempts to make them equip it.
//This means that if they fail to equip it, they glasses spawn in their hands, and if they fail to be put into the hands, they spawn on the ground
//Hooray for fallbacks!
//If you don't need any special effects like spawning glasses, then you don't need an add()
*/
+83
View File
@@ -0,0 +1,83 @@
//predominantly positive traits
//this file is named weirdly so that positive traits are listed above negative ones
/datum/trait/alcohol_tolerance
name = "Alcohol Tolerance"
desc = "You become drunk more slowly and suffer fewer drawbacks from alcohol."
value = 1
mob_trait = TRAIT_ALCOHOL_TOLERANCE
gain_text = "<span class='notice'>You feel like you could drink a whole keg!</span>"
lose_text = "<span class='danger'>You don't feel as resistant to alcohol anymore. Somehow.</span>"
/datum/trait/freerunning
name = "Freerunning"
desc = "You're great at quick moves! You can climb tables more quickly."
value = 2
mob_trait = TRAIT_FREERUNNING
gain_text = "<span class='notice'>You feel lithe on your feet!</span>"
lose_text = "<span class='danger'>You feel clumsy again.</span>"
/datum/trait/light_step
name = "Light Step"
desc = "You walk with a gentle step, making stepping on sharp objects quieter and less painful."
value = 1
mob_trait = TRAIT_LIGHT_STEP
gain_text = "<span class='notice'>You walk with a little more lithenessk.</span>"
lose_text = "<span class='danger'>You start tromping around like a barbarian.</span>"
/datum/trait/night_vision
name = "Night Vision"
desc = "You can see slightly more clearly in full darkness than most people."
value = 1
mob_trait = TRAIT_NIGHT_VISION
gain_text = "<span class='notice'>The shadows seem a little less dark.</span>"
lose_text = "<span class='danger'>Everything seems a little darker.</span>"
/datum/trait/night_vision/on_spawn()
var/mob/living/carbon/human/H = trait_holder
var/obj/item/organ/eyes/eyes = H.getorgan(/obj/item/organ/eyes)
if(!eyes || eyes.lighting_alpha)
return
eyes.Insert(H) //refresh their eyesight and vision
/datum/trait/selfaware
name = "Self-Aware"
desc = "You know your body well, and can accurately assess the extent of your wounds."
value = 2
mob_trait = TRAIT_SELF_AWARE
/datum/trait/skittish
name = "Skittish"
desc = "You can conceal yourself in danger. Ctrl-shift-click a closed locker to jump into it, as long as you have access."
value = 2
mob_trait = TRAIT_SKITTISH
/datum/trait/spiritual
name = "Spiritual"
desc = "You're in tune with the gods, and your prayers may be more likely to be heard. Or not."
value = 1
mob_trait = TRAIT_SPIRITUAL
gain_text = "<span class='notice'>You feel a little more faithful to the gods today.</span>"
lose_text = "<span class='danger'>You feel less faithful in the gods.</span>"
/datum/trait/voracious
name = "Voracious"
desc = "Nothing gets between you and your food. You eat twice as fast as everyone else!"
value = 1
mob_trait = TRAIT_VORACIOUS
gain_text = "<span class='notice'>You feel HONGRY.</span>"
lose_text = "<span class='danger'>You no longer feel HONGRY.</span>"
+156
View File
@@ -0,0 +1,156 @@
//predominantly negative traits
/datum/trait/heavy_sleeper
name = "Heavy Sleeper"
desc = "You sleep like a rock! Whenever you're put to sleep, you sleep for a little bit longer."
value = -1
mob_trait = TRAIT_HEAVY_SLEEPER
gain_text = "<span class='danger'>You feel sleepy.</span>"
lose_text = "<span class='notice'>You feel awake again.</span>"
medical_record_text = "Patient has abnormal sleep study results and is difficult to wake up."
/datum/trait/nearsighted //t. errorage
name = "Nearsighted"
desc = "You are nearsighted without prescription glasses, but spawn with a pair."
value = -1
gain_text = "<span class='danger'>Things far away from you start looking blurry.</span>"
lose_text = "<span class='notice'>You start seeing faraway things normally again.</span>"
medical_record_text = "Patient requires prescription glasses in order to counteract nearsightedness."
/datum/trait/nearsighted/add()
trait_holder.become_nearsighted(ROUNDSTART_TRAIT)
/datum/trait/nearsighted/on_spawn()
var/mob/living/carbon/human/H = trait_holder
var/obj/item/clothing/glasses/regular/glasses = new(get_turf(H))
H.put_in_hands(glasses)
H.equip_to_slot(glasses, slot_glasses)
H.regenerate_icons() //this is to remove the inhand icon, which persists even if it's not in their hands
/datum/trait/nonviolent
name = "Pacifist"
desc = "The thought of violence makes you sick. So much so, in fact, that you can't hurt anyone."
value = -2
mob_trait = TRAIT_PACIFISM
gain_text = "<span class='danger'>You feel repulsed by the thought of violence!</span>"
lose_text = "<span class='notice'>You think you can defend yourself again.</span>"
medical_record_text = "Patient is unusually pacifistic and cannot bring themselves to cause physical harm."
/datum/trait/nonviolent/on_process()
if(trait_holder.mind && trait_holder.mind.antag_datums.len)
to_chat(trait_holder, "<span class='boldannounce'>Your antagonistic nature has caused you to renounce your pacifism.</span>")
qdel(src)
/datum/trait/poor_aim
name = "Poor Aim"
desc = "You're terrible with guns and can't line up a straight shot to save your life. Dual-wielding is right out."
value = -1
mob_trait = TRAIT_POOR_AIM
medical_record_text = "Patient possesses a strong tremor in both hands."
/datum/trait/prosopagnosia
name = "Prosopagnosia"
desc = "You have a mental disorder that prevents you from being able to recognize faces at all."
value = -1
mob_trait = TRAIT_PROSOPAGNOSIA
medical_record_text = "Patient suffers from prosopagnosia and cannot recognize faces."
/datum/trait/prosthetic_limb
name = "Prosthetic Limb"
desc = "An accident caused you to lose one of your limbs. Because of this, you now have a random prosthetic!"
value = -1
var/slot_string = "limb"
/datum/trait/prosthetic_limb/on_spawn()
var/limb_slot = pick("l_arm", "r_arm", "l_leg", "r_leg")
var/mob/living/carbon/human/H = trait_holder
var/obj/item/bodypart/old_part = H.get_bodypart(limb_slot)
var/obj/item/bodypart/prosthetic
switch(limb_slot)
if("l_arm")
prosthetic = new/obj/item/bodypart/l_arm/robot/surplus(trait_holder)
slot_string = "left arm"
if("r_arm")
prosthetic = new/obj/item/bodypart/r_arm/robot/surplus(trait_holder)
slot_string = "right arm"
if("l_leg")
prosthetic = new/obj/item/bodypart/l_leg/robot/surplus(trait_holder)
slot_string = "left leg"
if("r_leg")
prosthetic = new/obj/item/bodypart/r_leg/robot/surplus(trait_holder)
slot_string = "right leg"
prosthetic.replace_limb(H)
qdel(old_part)
H.regenerate_icons()
/datum/trait/prosthetic_limb/post_add()
to_chat(trait_holder, "<span class='boldannounce'>Your [slot_string] has been replaced with a surplus prosthetic. It is fragile and will easily come apart under duress. Additionally, \
you need to use a welding tool and cables to repair it, instead of bruise packs and ointment.</span>")
/datum/trait/insanity
name = "Reality Dissociation Syndrome"
desc = "You suffer from a severe disorder that causes very vivid hallucinations. Mindbreaker toxin can suppress its effects, and you are immune to mindbreaker's hallucinogenic properties. <b>This is not a license to grief.</b>"
value = -2
//no mob trait because it's handled uniquely
gain_text = "<span class='userdanger'>...</span>"
lose_text = "<span class='notice'>You feel in tune with the world again.</span>"
medical_record_text = "Patient suffers from acute Reality Dissociation Syndrome and experiences vivid hallucinations."
/datum/trait/insanity/on_process()
if(trait_holder.reagents.has_reagent("mindbreaker"))
trait_holder.hallucination = 0
return
if(prob(1)) //we'll all be mad soon enough
madness()
/datum/trait/insanity/proc/madness(mad_fools)
set waitfor = FALSE
if(!mad_fools)
mad_fools = prob(20)
if(mad_fools)
var/hallucination_type = pick(subtypesof(/datum/hallucination/rds))
new hallucination_type (trait_holder, FALSE)
else
trait_holder.hallucination += rand(10, 50)
/datum/trait/insanity/post_add() //I don't /think/ we'll need this but for newbies who think "roleplay as insane" = "license to kill" it's probably a good thing to have
if(!trait_holder.mind || trait_holder.mind.special_role)
return
to_chat(trait_holder, "<span class='big bold info'>Please note that your dissociation syndrome does NOT give you the right to attack people or otherwise cause any interference to \
the round. You are not an antagonist, and the rules will treat you the same as other crewmembers.</span>")
/datum/trait/social_anxiety
name = "Social Anxiety"
desc = "Talking to people is very difficult for you, and you often stutter or even lock up."
value = -1
gain_text = "<span class='danger'>You start worrying about what you're saying.</span>"
lose_text = "<span class='notice'>You feel easier about talking again.</span>" //if only it were that easy!
medical_record_text = "Patient is usually anxious in social encounters and prefers to avoid them."
var/dumb_thing = TRUE
/datum/trait/social_anxiety/on_process()
var/mob/living/carbon/human/H = trait_holder
if(prob(5))
H.stuttering = max(3, H.stuttering)
else if(prob(1) && !H.silent)
to_chat(H, "<span class='danger'>You retreat into yourself. You <i>really</i> don't feel up to talking.</span>")
H.silent = max(10, H.silent)
else if(prob(0.5) && dumb_thing)
to_chat(H, "<span class='danger'>You think of a dumb thing you said a long time ago and scream internally.</span>")
dumb_thing = FALSE //only once per life
+33
View File
@@ -0,0 +1,33 @@
//traits with no real impact that can be taken freely
//MAKE SURE THESE DO NOT MAJORLY IMPACT GAMEPLAY. those should be positive or negative traits.
/datum/trait/no_taste
name = "Ageusia"
desc = "You can't taste anything! Toxic food will still poison you."
value = 0
mob_trait = TRAIT_AGEUSIA
gain_text = "<span class='notice'>You can't taste anything!</span>"
lose_text = "<span class='notice'>You can taste again!</span>"
medical_record_text = "Patient suffers from ageusia and is incapable of tasting food or reagents."
/datum/trait/deviant_tastes
name = "Deviant Tastes"
desc = "You dislike food that most people enjoy, and find delicious what they don't."
value = 0
gain_text = "<span class='notice'>You start craving something that tastes strange.</span>"
lose_text = "<span class='notice'>You feel like eating normal food again.</span>"
/datum/trait/deviant_tastes/add()
var/mob/living/carbon/human/H = trait_holder
var/datum/species/species = H.dna.species
var/liked = species.liked_food
species.liked_food = species.disliked_food
species.disliked_food = liked
/datum/trait/deviant_tastes/remove()
var/mob/living/carbon/human/H = trait_holder
var/datum/species/species = H.dna.species
species.liked_food = initial(species.liked_food)
species.disliked_food = initial(species.disliked_food)