Files
Paradise/code/game/dna/genes/gene.dm
AnturK 568d289a67 Generic Action\Action Button System
This commit ports the GAABS from -tg-station13. The GAABS allows for
generic, movable, hud elements for spells, powers, and items.
2015-05-11 09:32:08 -07:00

125 lines
2.7 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/M, var/connected, var/flags)
return
/**
* Called when the gene deactivates. Undo your magic here.
* Only called when the block is deactivated.
*/
/datum/dna/gene/proc/deactivate(var/mob/M, var/connected, var/flags)
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=45
// 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 probinj(activation_prob,(flags&MUTCHK_FORCED))
/datum/dna/gene/basic/activate(var/mob/M)
M.mutations.Add(mutation)
if(activation_messages.len)
var/msg = pick(activation_messages)
M << "\blue [msg]"
/datum/dna/gene/basic/deactivate(var/mob/M)
M.mutations.Remove(mutation)
if(deactivation_messages.len)
var/msg = pick(deactivation_messages)
M << "\red [msg]"