From 2acd88e3e7d951a2ab3cb807ff537a25a379d741 Mon Sep 17 00:00:00 2001 From: "johnsonmt88@gmail.com" Date: Fri, 31 Aug 2012 05:42:43 +0000 Subject: [PATCH] Fixed a bug where throwing an emp grenade at the AI would cause the thrower to call the shuttle. - 'usr' was used in place of 'src' which caused problems since the AI's emp_act() can call ai_call_shuttle(). Added comments to mob/attackby and changed a magic number into the #define we have set for it. Simple animals must now be manually added to a proc before admins can animalize players into them. Hopefully this will encourage coders who make new simple animals to test them being player-controlled before they allow them to become admin-spawnable. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4594 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/mob/living/silicon/ai/ai.dm | 14 ++--- code/modules/mob/mob.dm | 10 +++- code/modules/mob/transform_procs.dm | 71 ++++++++++++++++-------- 3 files changed, 63 insertions(+), 32 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 5fd0ef1a35f..d5e57131578 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -206,11 +206,11 @@ /mob/living/silicon/ai/proc/ai_call_shuttle() set category = "AI Commands" set name = "Call Emergency Shuttle" - if(usr.stat == 2) - usr << "You can't call the shuttle because you are dead!" + if(src.stat == 2) + src << "You can't call the shuttle because you are dead!" return if(istype(usr,/mob/living/silicon/ai)) - var/mob/living/silicon/ai/AI = usr + var/mob/living/silicon/ai/AI = src if(AI.control_disabled) usr << "Wireless control is disabled!" return @@ -230,13 +230,13 @@ /mob/living/silicon/ai/proc/ai_cancel_call() set category = "AI Commands" - if(usr.stat == 2) - usr << "You can't send the shuttle back because you are dead!" + if(src.stat == 2) + src << "You can't send the shuttle back because you are dead!" return if(istype(usr,/mob/living/silicon/ai)) - var/mob/living/silicon/ai/AI = usr + var/mob/living/silicon/ai/AI = src if(AI.control_disabled) - usr << "Wireless control is disabled!" + src << "Wireless control is disabled!" return cancel_call_proc(src) return diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 4de346b775d..9e75c3e9d4e 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -72,13 +72,17 @@ M.show_message( message, 1, blind_message, 2) -//What the fuck is this code +//This is aweful /mob/attackby(obj/item/weapon/W as obj, mob/user as mob) + + //Holding a balloon will shield you from an item that is_sharp() ... cause that makes sense if (user.intent != "harm") if (istype(src.l_hand,/obj/item/latexballon) && src.l_hand:air_contents && is_sharp(W)) return src.l_hand.attackby(W) if (istype(src.r_hand,/obj/item/latexballon) && src.r_hand:air_contents && is_sharp(W)) return src.r_hand.attackby(W) + + //If src is grabbing someone and facing the attacker, the src will use the grabbed person as a shield var/shielded = 0 if (locate(/obj/item/weapon/grab, src)) var/mob/safe = null @@ -92,7 +96,9 @@ safe = G.affecting if (safe) return safe.attackby(W, user) - if ((!( shielded ) || !( W.flags ) & 32)) + + //If the mob is not wearing a shield or otherwise is not shielded + if ((!( shielded ) || !( W.flags ) & NOSHIELD)) spawn( 0 ) if (W) W.attack(src, user) diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 83475744bf0..e93fb2c95e9 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -276,7 +276,7 @@ var/list/mobtypes = typesof(/mob/living/simple_animal) var/mobpath = input("Which type of mob should [src] turn into?", "Choose a type") in mobtypes - if(bad_animal(mobpath)) + if(!safe_animal(mobpath)) usr << "\red Sorry but this mob type is currently unavailable." return @@ -311,7 +311,7 @@ var/list/mobtypes = typesof(/mob/living/simple_animal) var/mobpath = input("Which type of mob should [src] turn into?", "Choose a type") in mobtypes - if(bad_animal(mobpath)) + if(!safe_animal(mobpath)) usr << "\red Sorry but this mob type is currently unavailable." return @@ -324,32 +324,57 @@ del(src) -//Certain mob types either do not work, or have major problems and should now be allowed to be controlled by players. -/mob/proc/bad_animal(var/MP) +/* Certain mob types have problems and should not be allowed to be controlled by players. + * + * This proc is here to force coders to manually place their mob in this list, hopefully tested. + * This also gives a place to explain -why- players shouldnt be turn into certain mobs and hopefully someone can fix them. + */ +/mob/proc/safe_animal(var/MP) - //Sanity, this should never happen. - if(!MP || !ispath(MP, /mob/living/simple_animal)) +//Bad mobs! - Remember to add a comment explaining what's wrong with the mob + if(!MP) + return 0 //Sanity, this should never happen. + + if(ispath(MP, /mob/living/simple_animal/parrot)) + return 0 //Parrots are unfinished, they have no sprite, movement, ect...(Working on this - Nodrak) + + if(ispath(MP, /mob/living/simple_animal/space_worm)) + return 0 //Unfinished. Very buggy, they seem to just spawn additional space worms everywhere and eating your own tail results in new worms spawning. + + if(ispath(MP, /mob/living/simple_animal/constructbehemoth)) + return 0 //I think this may have been an unfinished WiP or something. These constructs should really have their own class simple_animal/construct/subtype + + if(ispath(MP, /mob/living/simple_animal/constructarmoured)) + return 0 //Verbs do not appear for players. These constructs should really have their own class simple_animal/construct/subtype + + if(ispath(MP, /mob/living/simple_animal/constructwraith)) + return 0 //Verbs do not appear for players. These constructs should really have their own class simple_animal/construct/subtype + + if(ispath(MP, /mob/living/simple_animal/constructbuilder)) + return 0 //Verbs do not appear for players. These constructs should really have their own class simple_animal/construct/subtype + +//Good mobs! + if(ispath(MP, /mob/living/simple_animal/cat)) return 1 - - //It is impossible to pull up the player panel for mice (Fixed! - Nodrak) -// if(ispath(MP, /mob/living/simple_animal/mouse)) -// return 1 - - //Bears will auto-attack mobs, even if they're player controlled (Fixed! - Nodrak) -// if(ispath(MP, /mob/living/simple_animal/bear)) -// return 1 - - //Parrots are unfinished, they have no sprite, movement, ect... - else if(ispath(MP, /mob/living/simple_animal/parrot)) + if(ispath(MP, /mob/living/simple_animal/corgi)) return 1 - - //Unfinished. Very buggy, they seem to just spawn additional space worms everywhere and eating your own tail results in new worms spawning. - else if(ispath(MP, /mob/living/simple_animal/space_worm)) + if(ispath(MP, /mob/living/simple_animal/crab)) return 1 + if(ispath(MP, /mob/living/simple_animal/carp)) + return 1 + if(ispath(MP, /mob/living/simple_animal/mushroom)) + return 1 + if(ispath(MP, /mob/living/simple_animal/shade)) + return 1 + if(ispath(MP, /mob/living/simple_animal/tomato)) + return 1 + if(ispath(MP, /mob/living/simple_animal/mouse)) + return 1 //It is impossible to pull up the player panel for mice (Fixed! - Nodrak) + if(ispath(MP, /mob/living/simple_animal/bear)) + return 1 //Bears will auto-attack mobs, even if they're player controlled (Fixed! - Nodrak) - //No problems found! - else - return 0 + //Not in here? Must be untested! + return 0