mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-28 14:37:04 +01:00
* Initial Commit - Trying to add DC to Travis * Forgot to chmod * This took too long * Farie Fixes * Fixes new code * Job factions are fucking smelly * Loadouts work again * Runtime fixes
130 lines
2.8 KiB
Plaintext
130 lines
2.8 KiB
Plaintext
/**
|
|
* Gene Datum
|
|
*
|
|
* domutcheck was getting pretty hairy. This is the solution.
|
|
*
|
|
* All genes are stored in a global variable to cut down on memory
|
|
* usage.
|
|
*
|
|
* @author N3X15 <nexisentertainment@gmail.com>
|
|
*/
|
|
|
|
/datum/dna/gene
|
|
// Display name
|
|
var/name="BASE GENE"
|
|
|
|
// Probably won't get used but why the fuck not
|
|
var/desc="Oh god who knows what this does."
|
|
|
|
// Set in initialize()!
|
|
// What gene activates this?
|
|
var/block=0
|
|
|
|
// Any of a number of GENE_ flags.
|
|
var/flags=0
|
|
|
|
// Chance of the gene to cause adverse effects when active
|
|
var/instability=0
|
|
|
|
/*
|
|
* Is the gene active in this mob's DNA?
|
|
*/
|
|
/datum/dna/gene/proc/is_active(var/mob/M)
|
|
return M.active_genes && (type in M.active_genes)
|
|
|
|
// Return 1 if we can activate.
|
|
// HANDLE MUTCHK_FORCED HERE!
|
|
/datum/dna/gene/proc/can_activate(var/mob/M, var/flags)
|
|
return 0
|
|
|
|
// Called when the gene activates. Do your magic here.
|
|
/datum/dna/gene/proc/activate(var/mob/living/M, var/connected, var/flags)
|
|
M.gene_stability -= instability
|
|
return
|
|
|
|
/**
|
|
* Called when the gene deactivates. Undo your magic here.
|
|
* Only called when the block is deactivated.
|
|
*/
|
|
/datum/dna/gene/proc/deactivate(var/mob/living/M, var/connected, var/flags)
|
|
M.gene_stability += instability
|
|
return
|
|
|
|
// This section inspired by goone's bioEffects.
|
|
|
|
/**
|
|
* Called in each life() tick.
|
|
*/
|
|
/datum/dna/gene/proc/OnMobLife(var/mob/M)
|
|
return
|
|
|
|
/**
|
|
* Called when the mob dies
|
|
*/
|
|
/datum/dna/gene/proc/OnMobDeath(var/mob/M)
|
|
return
|
|
|
|
/**
|
|
* Called when the mob says shit
|
|
*/
|
|
/datum/dna/gene/proc/OnSay(var/mob/M, var/message)
|
|
return message
|
|
|
|
/**
|
|
* Called after the mob runs update_icons.
|
|
*
|
|
* @params M The subject.
|
|
* @params g Gender (m or f)
|
|
* @params fat Fat? (0 or 1)
|
|
*/
|
|
/datum/dna/gene/proc/OnDrawUnderlays(var/mob/M, var/g, var/fat)
|
|
return 0
|
|
|
|
|
|
/////////////////////
|
|
// BASIC GENES
|
|
//
|
|
// These just chuck in a mutation and display a message.
|
|
//
|
|
// Gene is activated:
|
|
// 1. If mutation already exists in mob
|
|
// 2. If the probability roll succeeds
|
|
// 3. Activation is forced (done in domutcheck)
|
|
/////////////////////
|
|
|
|
|
|
/datum/dna/gene/basic
|
|
name="BASIC GENE"
|
|
|
|
// Mutation to give
|
|
var/mutation=0
|
|
|
|
// Activation probability
|
|
var/activation_prob=100
|
|
|
|
// Possible activation messages
|
|
var/list/activation_messages=list()
|
|
|
|
// Possible deactivation messages
|
|
var/list/deactivation_messages=list()
|
|
|
|
/datum/dna/gene/basic/can_activate(var/mob/M,var/flags)
|
|
if(flags & MUTCHK_FORCED)
|
|
return 1
|
|
// Probability check
|
|
return prob(activation_prob)
|
|
|
|
/datum/dna/gene/basic/activate(var/mob/M)
|
|
..()
|
|
M.mutations.Add(mutation)
|
|
if(activation_messages.len)
|
|
var/msg = pick(activation_messages)
|
|
to_chat(M, "<span class='notice'>[msg]</span>")
|
|
|
|
/datum/dna/gene/basic/deactivate(var/mob/M)
|
|
..()
|
|
M.mutations.Remove(mutation)
|
|
if(deactivation_messages.len)
|
|
var/msg = pick(deactivation_messages)
|
|
to_chat(M, "<span class='warning'>[msg]</span>")
|