From 6c2dd46b078269d3ee5458af7e6c758e7bf67862 Mon Sep 17 00:00:00 2001 From: duncathan Date: Thu, 3 Sep 2015 00:10:29 -0600 Subject: [PATCH] fixes my mistakes haha woops --- code/game/objects/structures/kitchen_spike.dm | 51 +++++++++++------- icons/obj/kitchen.dmi | Bin 20934 -> 20942 bytes 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/code/game/objects/structures/kitchen_spike.dm b/code/game/objects/structures/kitchen_spike.dm index 1acee34f3a0..2587f2db3f1 100644 --- a/code/game/objects/structures/kitchen_spike.dm +++ b/code/game/objects/structures/kitchen_spike.dm @@ -1,4 +1,3 @@ - #define SKINTYPE_MONKEY /obj/item/stack/sheet/animalhide/monkey #define SKINTYPE_ALIEN /obj/item/stack/sheet/animalhide/xeno #define SKINTYPE_BEAR /obj/item/clothing/head/bearpelt @@ -45,6 +44,13 @@ var/skin = 0 var/skintype = null + var/global/list/allowed_types = list( //ugh I know it's a whitelist but it's not as god-awful and hacky as before. at least this way it's sustainable. i don't think there's even a better way than this. + /mob/living/carbon/monkey, + /mob/living/carbon/alien, + /mob/living/simple_animal/hostile/bear, + /mob/living/simple_animal/pet/dog/corgi, + ) + var/global/list/meatlist = list( "monkey" = MEATTYPE_MONKEY, "alien" = MEATTYPE_ALIEN, @@ -61,6 +67,12 @@ /obj/structure/kitchenspike/attack_paw(mob/user) return src.attack_hand(usr) +/obj/structure/kitchenspike/proc/is_mob_allowed(var/obj/item/weapon/grab/G) + for(var/I in allowed_types) + if(istype(G.affecting, I)) + return I + return 0 + /obj/structure/kitchenspike/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/weapon/crowbar)) if(!src.occupied) @@ -73,16 +85,19 @@ qdel(src) else user << "You can't do that while something's on the spike!" - else if(istype(I, /obj/item/weapon/grab)) + return + if(istype(I, /obj/item/weapon/grab)) var/obj/item/weapon/grab/G = I - if(istype(G.affecting, /mob/living/carbon/monkey) || istype (G.affecting, /mob/living/carbon/alien) || istype (G.affecting, /mob/living/simple_animal/hostile/bear) || istype (G.affecting, /mob/living/simple_animal/pet/dog/corgi)) - if(!src.occupied) - src.occupied = 1 - src.meat = 5 - src.skin = 1 + var/allowed_type = is_mob_allowed(G) + if(allowed_type) + if(!occupied) + occupied = 1 + meat = 5 + skin = 1 - var/list/affecting_path = text2list(path2text(G.affecting.type), "/") //we want affecting_type to be the last part of affecting's type path - var/affecting_type = affecting_path[affecting_path.len] //ex. if affecting.type is /mob/living/carbon/monkey, this will set affecting_type to "monkey" + var/list/affecting_path = text2list("[allowed_type]", "/") //we want a specific part of the type path for this: the last part of the path in allowed_types + var/affecting_type = affecting_path[affecting_path.len] //ex. 1 if affecting.type is /mob/living/carbon/monkey, this will set affecting_type to "monkey" + //ex. 2 if affecting.type is /mob/living/carbon/alien/humanoid/queen, this will set affecting_type to "alien" //set these vars to the appropriate values based on type icon_state = "spikebloody[affecting_type]" @@ -90,22 +105,22 @@ skintype = skinlist["[affecting_type]"] var/mob/living/O = G.affecting - O.show_message(text("[user] has forced [G.affecting] onto the spike, killing them instantly!")) + O.visible_message(text("[user] has forced [G.affecting] onto the spike, killing them instantly!")) qdel(G.affecting) qdel(G) else - user << "The spike already has something on it, finish collecting its meat first!" - else if(istype(G.affecting, /mob/living/carbon/human)) + user << "The spike already has something on it; finish collecting its meat first!" + return + if(istype(G.affecting, /mob/living/carbon/human)) user.changeNext_move(CLICK_CD_MELEE) playsound(src.loc, "sound/effects/splat.ogg", 25, 1) var/mob/living/carbon/human/H = G.affecting H.visible_message("[user] slams [G.affecting] into the meat spike!", "[user] slams you into the meat spike!", "You hear a squishy wet noise.") H.adjustBruteLoss(20) - else - user << "You can't use that on the spike!" return - else - ..() + user << "You can't use that on the spike!" + return + ..() ///obj/structure/kitchenspike/MouseDrop_T(var/atom/movable/C, mob/user) // if(istype(C, /obj/mob/carbon/monkey) @@ -126,8 +141,8 @@ new skintype(src.loc) skin-- usr << "You remove the hide from [src]." - src.icon_state = "spike" - src.occupied = 0 + icon_state = "spike" + occupied = 0 #undef SKINTYPE_MONKEY diff --git a/icons/obj/kitchen.dmi b/icons/obj/kitchen.dmi index 329ca9de64838e09d93e92118aac814295bb8eb9..6e03c9f6f144174567e761ff882e2c0c53e3085e 100644 GIT binary patch delta 464 zcmV;>0Wbc>qXEvN0gxnrwt7@pbVOxyV{&P5bZKvH004NLotCj~+%OD=XZtCHWNnKi z*VRjLL2*O!3I;7vvV5|5pye~}?K>C=azj9>n+1G7#b2Z-Kbk+Ue^2k`_;zZq$V;Sb zI`jM2Q`>COmC#zkICXP(=C#xu;gf8SF>B62rK z5p#`TrhLYms9;Jd=FnfFCOVN!dE&DOopbcEf141l$Ramy3WOBQvx0e2FoT9kL{2Wy z2dGJZCp9K^QnnH}W~Zn?V5ObF6U+)~UF7x%99@zz&(Q@fMi<33+tHxpU&=(_(1}|N3A01)^`v~ZALO)#3VKwNzA6KK+-VIJvB$oE z+&rH-SJBfND&tRU_>Vn&&lNo~R?&5_cgGsVv_^|853`+<$K$XTtLTxn*l|cia)QyK zWrVrELeayPGWHvIub6T7B0G|$1f@cEg&b1?y{l8tJp+-*)WYs(;Tfr#E$cJ+&906mU_U zdb+!Bn=RNps!kmq+h&B|$Gjg>))`c%ZqgdgaMLz6P*Rg z)EKZVVT@t%{Td{G5qZiXomuF-1jj2k5%dL!<>pO*pn!Q0F!usxkT9|WeSwnjcTyr^ zCwVEJ!eRv#@FbMuY0|TRDv56oPr*hWa}=zXVz>$(*p7N3$7gRPG>{TjkiQi9v283w z{jNH7_;a{^lo7Rm1Z#24Vl y@6!O9KBP;s7wwL;hBFu>A7rQ_J^z}4TlM^QRL9p-`w0S-8FzbrKi;$B0qaja%h-Yd