From 367cc3a82775c72cade56cafc746d689d43dee76 Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Sat, 30 Nov 2013 00:02:05 +1030 Subject: [PATCH] Added skeleton code for mob abilities. --- baystation12.dme | 1 + code/modules/mob/abilities.dm | 81 +++++++++++++++++++++++ code/modules/mob/living/carbon/species.dm | 16 +++++ code/modules/mob/login.dm | 10 +++ code/modules/mob/mob_defines.dm | 7 +- 5 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 code/modules/mob/abilities.dm diff --git a/baystation12.dme b/baystation12.dme index 0695839aea3..170b53098f6 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -834,6 +834,7 @@ #include "code\modules\mining\money_bag.dm" #include "code\modules\mining\ores_coins.dm" #include "code\modules\mining\satchel_ore_boxdm.dm" +#include "code\modules\mob\abilities.dm" #include "code\modules\mob\death.dm" #include "code\modules\mob\emote.dm" #include "code\modules\mob\inventory.dm" diff --git a/code/modules/mob/abilities.dm b/code/modules/mob/abilities.dm new file mode 100644 index 00000000000..5ce440a48ca --- /dev/null +++ b/code/modules/mob/abilities.dm @@ -0,0 +1,81 @@ +/* +Creature-level abilities. +*/ + +/var/global/list/ability_verbs = list( + /client/proc/test_ability, + /client/proc/tajaran_ability, + /client/proc/unathi_ability + ) + +/client/proc/test_ability() + + set category = "Ability" + set name = "Test ability" + set desc = "An ability for testing." + + // Check if the client has a mob and if the mob is valid and alive. + if(!mob || !istype(mob,/mob/living) || mob.stat) + src << "\red You must be corporeal and alive to do that." + return 0 + + //Handcuff check. + if(mob.restrained()) + src << "\red You cannot do this while restrained." + return 0 + + if(istype(mob,/mob/living/carbon)) + var/mob/living/carbon/M = mob + if(M.handcuffed) + src << "\red You cannot do this while cuffed." + return 0 + + src << "\blue You perform an ability." + +/client/proc/tajaran_ability() + + set category = "Ability" + set name = "Tajaran ability" + set desc = "An ability for Tajara." + + // Check if the client has a mob and if the mob is valid and alive. + if(!mob || !istype(mob,/mob/living) || mob.stat) + src << "\red You must be corporeal and alive to do that." + return 0 + + //Handcuff check. + if(mob.restrained()) + src << "\red You cannot do this while restrained." + return 0 + + if(istype(mob,/mob/living/carbon)) + var/mob/living/carbon/M = mob + if(M.handcuffed) + src << "\red You cannot do this while cuffed." + return 0 + + src << "\blue You perform an ability." + +/client/proc/unathi_ability() + + set category = "Ability" + set name = "Unathi ability" + set desc = "An ability for Unathi." + + // Check if the client has a mob and if the mob is valid and alive. + if(!mob || !istype(mob,/mob/living) || mob.stat) + src << "\red You must be corporeal and alive to do that." + return 0 + + //Handcuff check. + if(mob.restrained()) + src << "\red You cannot do this while restrained." + return 0 + + if(istype(mob,/mob/living/carbon)) + var/mob/living/carbon/M = mob + if(M.handcuffed) + src << "\red You cannot do this while cuffed." + return 0 + + src << "\blue You perform an ability." \ No newline at end of file diff --git a/code/modules/mob/living/carbon/species.dm b/code/modules/mob/living/carbon/species.dm index 76ab17fbd47..de4119f254c 100644 --- a/code/modules/mob/living/carbon/species.dm +++ b/code/modules/mob/living/carbon/species.dm @@ -37,6 +37,8 @@ var/flags = 0 // Various specific features. + var/list/abilities = list() // For species-derived or admin-given powers + /datum/species/human name = "Human" language = "Sol Common" @@ -44,6 +46,10 @@ flags = HAS_SKIN_TONE | HAS_LIPS | HAS_UNDERWEAR + abilities = list( + /client/proc/test_ability, + ) + /datum/species/unathi name = "Unathi" icobase = 'icons/mob/human_races/r_lizard.dmi' @@ -65,6 +71,11 @@ flags = WHITELISTED | HAS_LIPS | HAS_UNDERWEAR | HAS_TAIL + abilities = list( + /client/proc/test_ability, + /client/proc/unathi_ability + ) + /datum/species/tajaran name = "Tajaran" icobase = 'icons/mob/human_races/r_tajaran.dmi' @@ -87,6 +98,11 @@ flags = WHITELISTED | HAS_LIPS | HAS_UNDERWEAR | HAS_TAIL + abilities = list( + /client/proc/test_ability, + /client/proc/tajaran_ability + ) + /datum/species/skrell name = "Skrell" icobase = 'icons/mob/human_races/r_skrell.dmi' diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 1c3498802d1..b6b7edb7298 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -24,6 +24,7 @@ log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)] (no longer logged in).") /mob/Login() + player_list |= src update_Login_details() world.update_status() @@ -44,4 +45,13 @@ client.eye = src client.perspective = MOB_PERSPECTIVE + //Clear ability list and update from mob. + client.verbs -= ability_verbs + if(abilities) + client.verbs |= abilities + + if(istype(src,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = src + if(H.species && H.species.abilities) + client.verbs |= H.species.abilities \ No newline at end of file diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index dc984663dd2..85992e55fa7 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -84,10 +84,11 @@ var/lastpuke = 0 var/unacidable = 0 var/small = 0 - var/list/pinned = list() //List of things pinning this creature to walls (see living_defense.dm) - var/list/embedded = list() //Embedded items, since simple mobs don't have organs. + var/list/pinned = list() // List of things pinning this creature to walls (see living_defense.dm) + var/list/embedded = list() // Embedded items, since simple mobs don't have organs. var/list/languages = list() // For speaking/listening. - var/list/speak_emote = list("says") //Verbs used when speaking. Defaults to 'say' if speak_emote is null. + var/list/abilities = list() // For species-derived or admin-given powers. + var/list/speak_emote = list("says") // Verbs used when speaking. Defaults to 'say' if speak_emote is null. var/name_archive //For admin things like possession