From bcdf76861f3efa99d160a813398973a63faa451c Mon Sep 17 00:00:00 2001 From: Ren Erthilo Date: Mon, 26 Mar 2012 18:04:00 +0100 Subject: [PATCH] TG: Simple mobs can now attack humans (and you are able to set the attack messages and min/max damage of the attack with vars) Simple mobs who attempt to attack and have a max damage of 0 (which is the default) will emote a friendly gesture towards the target, the default being "nuzzles" though also editable via vars. Added the Shade simple mob (and some temporary sprites) which is the first simple mob capable of attacking. It was mostly for test purposes, but will probably end up becoming a feature of soul stones later on. Note: Simple animals still cannot interact with other simple animals, critters, mechs, cyborgs, aliens, monkeys etc etc, only humans at this point. r2808 --- code/defines/mob/simple_animal/crab.dm | 1 + code/defines/mob/simple_animal/life.dm | 26 ++++++++++---- code/game/atom_procs.dm | 2 -- code/modules/mob/simple_animal/shade.dm | 46 +++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 code/modules/mob/simple_animal/shade.dm diff --git a/code/defines/mob/simple_animal/crab.dm b/code/defines/mob/simple_animal/crab.dm index c75e7831566..3fec1a9e5cd 100644 --- a/code/defines/mob/simple_animal/crab.dm +++ b/code/defines/mob/simple_animal/crab.dm @@ -15,6 +15,7 @@ response_disarm = "gently pushes aside the" response_harm = "stomps the" stop_automated_movement = 1 + friendly = "pinches" /mob/living/simple_animal/crab/Life() ..() diff --git a/code/defines/mob/simple_animal/life.dm b/code/defines/mob/simple_animal/life.dm index be9a3b2c888..28479e790a6 100644 --- a/code/defines/mob/simple_animal/life.dm +++ b/code/defines/mob/simple_animal/life.dm @@ -38,7 +38,8 @@ 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. + var/unsuitable_atoms_damage = 2 //This damage is taken when atmos doesn't fit all the requirements above + //LETTING SIMPLE ANIMALS ATTACK? WHAT COULD GO WRONG. Defaults to zero so Ian can still be cuddly var/melee_damage_lower = 0 @@ -46,7 +47,6 @@ var/attacktext = "attacks" var/attack_sound = null var/friendly = "nuzzles" //If the mob does no damage with it's attack - var/wall_smash = 0 //if they can smash walls /mob/living/simple_animal/New() ..() @@ -197,14 +197,26 @@ return "[emote], \"[text]\"" return "says, \"[text]\""; -/mob/living/simple_animal/emote(var/act,var/m_type=1,var/message = null) - if(act == "me") - for (var/mob/O in viewers(src, null)) - O.show_message("[src] [message]") - else if(act) +/mob/living/simple_animal/emote(var/act) + if(act) for (var/mob/O in viewers(src, null)) O.show_message("[src] [act].") + +/mob/living/simple_animal/attack_animal(mob/living/simple_animal/M as mob) + if(M.melee_damage_upper == 0) + M.emote("[M.friendly] [src]") + else + for(var/mob/O in viewers(src, null)) + O.show_message("\red [M] [M.attacktext] [src]!", 1) + var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) + health -= damage + +/mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) + if(!Proj) return + src.health -= Proj.damage + return 0 + /mob/living/simple_animal/attack_hand(mob/living/carbon/human/M as mob) ..() diff --git a/code/game/atom_procs.dm b/code/game/atom_procs.dm index 244ff000d6f..c1f08944ae9 100644 --- a/code/game/atom_procs.dm +++ b/code/game/atom_procs.dm @@ -39,8 +39,6 @@ /atom/proc/attack_metroid(mob/user as mob) return - - /atom/proc/hand_h(mob/user as mob) //human (hand) - restrained return diff --git a/code/modules/mob/simple_animal/shade.dm b/code/modules/mob/simple_animal/shade.dm new file mode 100644 index 00000000000..8854227fb0e --- /dev/null +++ b/code/modules/mob/simple_animal/shade.dm @@ -0,0 +1,46 @@ +/mob/living/simple_animal/shade + name = "Shade" + desc = "A bound spirit" + icon = 'mob.dmi' + icon_state = "shade" + icon_living = "shade" + icon_dead = "shade_dead" + max_health = 50 + health = 50 + speak_emote = list("hisses") + emote_hear = list("wails","screeches") + response_help = "puts their hand through" + response_disarm = "flails at" + response_harm = "punches the" + melee_damage_lower = 5 + melee_damage_upper = 15 + attacktext = "drains the life from" + minbodytemp = 0 + maxbodytemp = 4000 + min_oxy = 0 + max_co2 = 0 + max_tox = 0 + +/mob/living/simple_animal/shade/Life() + ..() + if (stat == 2) + new /obj/item/weapon/ectoplasm (src.loc) + for(var/mob/M in viewers(src, null)) + if ((M.client && !( M.blinded ))) + M.show_message("\red [src] lets out a contented sigh as their form unwinds. ") + del src + +/mob/living/simple_animal/shade/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri + if(istype(O, /obj/item/device/soulstone)) + O.transfer_soul("SHADE", src, user) + else + if(O.force) + health -= O.force + for(var/mob/M in viewers(src, null)) + if ((M.client && !( M.blinded ))) + M.show_message("\red \b [src] has been attacked with the [O] by [user]. ") + else + usr << "\red This weapon is ineffective, it does no damage." + for(var/mob/M in viewers(src, null)) + if ((M.client && !( M.blinded ))) + M.show_message("\red [user] gently taps [src] with the [O]. ") \ No newline at end of file