Simple animal code has been added in. This means that simple animal mobs that basically ignore what is going on can be added into the game rather quickly.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2165 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2011-09-10 01:26:27 +00:00
parent 2f7c287383
commit de7e4f0de0
5 changed files with 6332 additions and 6061 deletions
+258
View File
@@ -0,0 +1,258 @@
/mob/living/simple_animal
var/icon_living = ""
var/icon_dead = ""
var/max_health = 20
var/alive = 1
var/list/speak = list()
var/list/speak_emote = list() //Emotes while speaking IE: Ian [emote], [text] -- Ian barks, "WOOF!". Spoken text is generated from the speak variable.
var/speak_chance = 0
var/list/emote_hear = list() //EHearable emotes
var/list/emote_see = list() //Unlike speak_emote, the list of things in this variable only show by themselves with no spoken text. IE: Ian barks, Ian yaps
health = 20
var/turns_per_move = 1
var/turns_since_move = 0
universal_speak = 1
var/meat_amount = 0
var/meat_type
//Interaction
var/response_help = "You try to help"
var/response_disarm = "You try to disarm"
var/response_harm = "You try to hurt"
var/harm_intent_damage = 3
//Temperature effects
var/minbodytemp = 270
var/maxbodytemp = 370
var/heat_damage_per_tick = 3 //amount of damage applied if animal's body temperature is higher than maxbodytemp
var/cold_damage_per_tick = 2 //same as heat_damage_per_tick, only if the bodytemperature it's lower than minbodytemp
//Atmos effects - Yes, you can make creatures that require plasma or co2 to survive. N2O is a trace gas and handled separately, hence why it isn't here. It'd be hard to add it. Hard and me don't mix (Yes, yes make all the dick jokes you want with that.) - Errorage
var/min_oxy = 5
var/max_oxy = 0 //Leaving something at 0 means it's off - has no maximum
var/min_tox = 0
var/max_tox = 1
var/min_co2 = 0
var/max_co2 = 5
var/min_n2 = 0
var/max_n2 = 0
var/unsuitable_atoms_damage = 2 //This damage is taken when atmos doesn't fit all the requirements above.
//Corgi
/mob/living/simple_animal/corgi
name = "Corgi"
desc = "Puppy!!"
icon = 'mob.dmi'
icon_state = "corgi"
icon_living = "corgi"
icon_dead = "corgi_dead"
//speak = list("YAP","Woof!","Hoot!","AUUUUUU")
//speak_emote = list("barks", "woofs")
emote_hear = list("barks","woofs","yaps")
emote_see = list("shakes it's head", "shivers")
speak_chance = 1
turns_per_move = 5
meat_type = /obj/item/weapon/reagent_containers/food/snacks/meat/corgi
meat_amount = 3
response_help = "pats the"
response_disarm = "getnly pushes aside the"
response_harm = "kicks the"
/mob/living/simple_animal/corgi/Ian
name = "Ian"
desc = "It's Ian, what else do you need to know?"
response_help = "pats"
response_disarm = "getnly pushes aside"
response_harm = "kicks"
/mob/living/simple_animal/New()
..()
verbs -= /mob/verb/observe
/mob/living/simple_animal/Life()
//Health
if(!alive)
if(health > 0)
icon_state = icon_living
alive = 1
return
if(health < 1)
alive = 0
icon_state = icon_dead
return
if(health > max_health)
health = max_health
//Movement
if(!ckey)
turns_since_move++
if(turns_since_move >= turns_per_move)
Move(get_step(src,pick(cardinal)))
turns_since_move = 0
//Speaking
if(speak_chance)
if(prob(speak_chance))
if(speak && (emote_hear || emote_see) )
var/length = speak.len
if(emote_hear)
length += emote_hear.len
if(emote_see)
length += emote_see.len
var/pick = rand(1,length)
if(pick <= speak.len)
say(pick(speak))
else
pick -= speak.len
if(emote_see && pick <= emote_see.len)
emote(pick(emote_see),1)
else
emote(pick(emote_hear),2)
if(!speak)
if(!emote_hear && emote_see)
emote(pick(emote_see),1)
if(emote_hear && !emote_see)
emote(pick(emote_hear),2)
if(emote_hear && emote_see)
var/length = emote_hear.len + emote_see.len
var/pick = rand(1,length)
if(pick <= emote_see.len)
emote(pick(emote_see),1)
else
emote(pick(emote_hear),2)
if(speak && !(emote_see || emote_hear))
say(pick(speak))
//Atmos
var/atmos_suitable = 1
var/atom/A = src.loc
if(isturf(A))
var/turf/T = A
var/areatemp = T.temperature
if( abs(areatemp - bodytemperature) > 50 )
var/diff = areatemp - bodytemperature
diff = diff / 5
//world << "changed from [bodytemperature] by [diff] to [bodytemperature + diff]"
bodytemperature += diff
if(istype(T,/turf/simulated))
var/turf/simulated/ST = T
if(ST.air)
var/tox = ST.air.toxins
var/oxy = ST.air.oxygen
var/n2 = ST.air.nitrogen
var/co2 = ST.air.carbon_dioxide
if(min_oxy)
if(oxy < min_oxy)
atmos_suitable = 0
if(max_oxy)
if(oxy > max_oxy)
atmos_suitable = 0
if(min_tox)
if(tox < min_tox)
atmos_suitable = 0
if(max_tox)
if(tox > max_tox)
atmos_suitable = 0
if(min_n2)
if(n2 < min_n2)
atmos_suitable = 0
if(max_n2)
if(n2 > max_n2)
atmos_suitable = 0
if(min_co2)
if(co2 < min_co2)
atmos_suitable = 0
if(max_co2)
if(co2 > max_co2)
atmos_suitable = 0
//Atmos effects
if(bodytemperature < minbodytemp)
health -= cold_damage_per_tick
else if(bodytemperature > maxbodytemp)
health -= heat_damage_per_tick
if(!atmos_suitable)
health -= unsuitable_atoms_damage
/mob/living/simple_animal/Bumped(AM as mob|obj)
if(ismob(AM))
//var/newamloc = src.loc
src.loc = AM:loc
//AM:loc = newamloc
else
..()
/mob/living/simple_animal/gib()
if(meat_amount && meat_type)
for(var/i = 0; i < meat_amount; i++)
new meat_type(src.loc)
..()
/mob/living/simple_animal/say_quote(var/text)
if(speak_emote)
var/emote = pick(speak_emote)
if(emote)
return "[emote], \"[text]\""
return "says, \"[text]\"";
/mob/living/simple_animal/emote(var/act)
if(act)
for (var/mob/O in viewers(src, null))
O.show_message("<B>[src]</B> [act].")
/mob/living/simple_animal/attack_hand(mob/living/carbon/human/M as mob)
..()
switch(M.a_intent)
if ("help")
if (health > 0)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message("\blue [M] [response_help] [src]")
if ("grab")
if (M == src)
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
else
M.r_hand = G
G.layer = 20
G.affecting = src
grabbed_by += G
G.synch()
LAssailant = M
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red [] has grabbed [] passively!", M, src), 1)
if ("hurt")
health -= harm_intent_damage
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message("\blue [M] [response_harm] [src]")
if ("disarm")
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message("\blue [M] [response_disarm] [src]")
return
//MEAT
/obj/item/weapon/reagent_containers/food/snacks/meat/corgi
name = "Corgi meat"
desc = "Tastes like... well you know..."
+9
View File
@@ -53,6 +53,14 @@
Stuff which is in development and not yet visible to players or just code related
(is. code improvements for expandability, etc.) should not be listed here. They
should be listed in the changelog upon commit tho. Thanks. -->
<b><font color='blue'>10 September 2011:</font><b>
<ul>
<li><b>Errorage updated:</b>
<ul>
<li>A new pet on the bridge.</li>
</ul>
</li>
</ul>
<b><font color='blue'>8 September 2011:</font><b>
<ul>
@@ -63,6 +71,7 @@ should be listed in the changelog upon commit tho. Thanks. -->
</ul>
</li>
</ul>
<b><font color='blue'>6 September 2011</font color><b>
<ul>
<li><b><a href='#' id='greekrioter_link' onclick="changeText('greekrioter_tag','Agouri', 'greekrioter_link')"><span id='greekrioter_tag'>Greek Rioter</span></a> updated:</b>
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 115 KiB

+6062 -6061
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -21,6 +21,7 @@
#define FILE_DIR "code/defines/mob/living"
#define FILE_DIR "code/defines/mob/living/carbon"
#define FILE_DIR "code/defines/mob/living/silicon"
#define FILE_DIR "code/defines/mob/simple_animal"
#define FILE_DIR "code/defines/obj"
#define FILE_DIR "code/defines/obj/clothing"
#define FILE_DIR "code/defines/procs"
@@ -143,6 +144,7 @@
#define FILE_DIR "icons/turf"
#define FILE_DIR "interface"
#define FILE_DIR "maps"
#define FILE_DIR "maps/backup"
#define FILE_DIR "sound"
#define FILE_DIR "sound/ambience"
#define FILE_DIR "sound/announcer"
@@ -259,6 +261,7 @@
#include "code\defines\mob\living\silicon\pai.dm"
#include "code\defines\mob\living\silicon\robot.dm"
#include "code\defines\mob\living\silicon\silicon.dm"
#include "code\defines\mob\simple_animal\life.dm"
#include "code\defines\obj\closet.dm"
#include "code\defines\obj\clothing.dm"
#include "code\defines\obj\computer.dm"