From 6809b02dfda9311da38595d81bc06faa6b8971b8 Mon Sep 17 00:00:00 2001 From: "morikou@gmail.com" Date: Sun, 17 Apr 2011 02:02:24 +0000 Subject: [PATCH] Glorious Return Update: - Adjusted OnConsume proc in food so that it occurs before the check to see if the item is finished (so that you can do triggers whenever you take a bite rather then only when it's completely eaten). Adjusted existing food items so that they still work the same. - Eating popcorn now has a random chance of having the user accidentally bite on an un-popped kernel. This doesn't do anything other then give the user a message though. - Kabobs now return the bar used to make them. - New atom flag: NOREACT. Reagents stored in objects, mobs, and turfs that have this flag do not react. Right now, only the microwave and mobs have this effect (only mobs had this effect before). It's intended to simplify devices that use reagents. ADMIN NOTE: You can remove this flag from people if you feel like being a dick. - NOREACT flag automatically gets removed on death. (Commented out for now) - Removed a flag on certain mobs that wasn't actually doing anything. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1459 316c924e-a436-60f5-8080-3fe189b3f50e --- code/WorkInProgress/Chemistry-Holder.dm | 4 +- code/WorkInProgress/Chemistry-Tools.dm | 3 +- code/defines/mob/living/carbon/alien_larva.dm | 2 +- code/defines/mob/living/carbon/monkey.dm | 2 +- code/defines/mob/mob.dm | 1 + code/defines/obj/machinery.dm | 2 +- code/modules/food/food.dm | 55 ++++++++++++++----- code/modules/food/recipes_microwave.dm | 2 +- code/modules/mob/living/carbon/human/death.dm | 3 +- code/setup.dm | 4 +- 10 files changed, 54 insertions(+), 24 deletions(-) diff --git a/code/WorkInProgress/Chemistry-Holder.dm b/code/WorkInProgress/Chemistry-Holder.dm index 3711feabe5..03895ca4c9 100644 --- a/code/WorkInProgress/Chemistry-Holder.dm +++ b/code/WorkInProgress/Chemistry-Holder.dm @@ -72,7 +72,7 @@ datum trans_data = current_reagent.data R.add_reagent(current_reagent.id, (current_reagent_transfer * multiplier), trans_data) src.remove_reagent(current_reagent.id, current_reagent_transfer) - + src.update_total() R.update_total() R.handle_reactions() @@ -129,7 +129,7 @@ datum update_total() handle_reactions() - if(ismob(my_atom)) return //No reactions inside mobs :I + if(my_atom.flags & NOREACT) return //Yup, no reactions here. No siree. for(var/A in typesof(/datum/chemical_reaction) - /datum/chemical_reaction) var/datum/chemical_reaction/C = new A() diff --git a/code/WorkInProgress/Chemistry-Tools.dm b/code/WorkInProgress/Chemistry-Tools.dm index e19cf52f48..ffe9cb8668 100644 --- a/code/WorkInProgress/Chemistry-Tools.dm +++ b/code/WorkInProgress/Chemistry-Tools.dm @@ -928,6 +928,7 @@ var/bitesize = 1 var/bitecount = 0 + //Placeholder for effects that trigger on eating that aren't tied to reagents. proc/On_Consume() return @@ -986,10 +987,10 @@ else reagents.trans_to(M, reagents.total_volume) bitecount++ + On_Consume() if(!reagents.total_volume) if(M == user) user << "\red You finish eating [src]." else user << "\red [M] finishes eating [src]." - On_Consume() del(src) playsound(M.loc,'eatfood.ogg', rand(10,50), 1) return 1 diff --git a/code/defines/mob/living/carbon/alien_larva.dm b/code/defines/mob/living/carbon/alien_larva.dm index 21b810fa98..e6f3c6e417 100644 --- a/code/defines/mob/living/carbon/alien_larva.dm +++ b/code/defines/mob/living/carbon/alien_larva.dm @@ -1,7 +1,7 @@ /mob/living/carbon/alien/larva name = "alien larva" icon_state = "larva" - flags = 258.0 + //flags = 258.0 health = 25 diff --git a/code/defines/mob/living/carbon/monkey.dm b/code/defines/mob/living/carbon/monkey.dm index fd872c24ab..6773c5657b 100644 --- a/code/defines/mob/living/carbon/monkey.dm +++ b/code/defines/mob/living/carbon/monkey.dm @@ -6,7 +6,7 @@ icon = 'monkey.dmi' icon_state = "monkey1" gender = NEUTER - flags = 258.0 + //flags = 258.0 var/obj/item/weapon/card/id/wear_id = null // Fix for station bounced radios -- Skie diff --git a/code/defines/mob/mob.dm b/code/defines/mob/mob.dm index a391c45367..5ed9b0f201 100644 --- a/code/defines/mob/mob.dm +++ b/code/defines/mob/mob.dm @@ -2,6 +2,7 @@ density = 1 layer = 4.0 animate_movement = 2 + flags = NOREACT var/datum/mind/mind var/uses_hud = 0 diff --git a/code/defines/obj/machinery.dm b/code/defines/obj/machinery.dm index 5b3cb0b4a4..e7e0a8472e 100644 --- a/code/defines/obj/machinery.dm +++ b/code/defines/obj/machinery.dm @@ -594,7 +594,7 @@ use_power = 1 idle_power_usage = 5 active_power_usage = 100 - flags = OPENCONTAINER //Temporary holder while it counts what's in it. + flags = OPENCONTAINER | NOREACT /obj/machinery/processor diff --git a/code/modules/food/food.dm b/code/modules/food/food.dm index ef78e7bae7..4baf9487fc 100644 --- a/code/modules/food/food.dm +++ b/code/modules/food/food.dm @@ -33,11 +33,12 @@ icon_state = "banana" item_state = "banana" On_Consume() - var/mob/M = usr - var/obj/item/weapon/bananapeel/W = new /obj/item/weapon/bananapeel( M ) - M << "\blue You peel the banana." - M.put_in_hand(W) - W.add_fingerprint(M) + if(!reagents.total_volume) + var/mob/M = usr + var/obj/item/weapon/bananapeel/W = new /obj/item/weapon/bananapeel( M ) + M << "\blue You peel the banana." + M.put_in_hand(W) + W.add_fingerprint(M) New() ..() reagents.add_reagent("banana", 5) @@ -469,6 +470,12 @@ ..() reagents.add_reagent("nutriment", 8) bitesize = 2 + On_Consume() + if(!reagents.total_volume) + var/mob/M = usr + var/obj/item/stack/rods/W = new /obj/item/stack/rods( M ) + M << "\blue You lick clean the rod." + M.put_in_hand(W) /obj/item/weapon/reagent_containers/food/snacks/monkeykabob name = "Meat-kabob" @@ -478,6 +485,12 @@ ..() reagents.add_reagent("nutriment", 8) bitesize = 2 + On_Consume() + if(!reagents.total_volume) + var/mob/M = usr + var/obj/item/stack/rods/W = new /obj/item/stack/rods( M ) + M << "\blue You lick clean the rod." + M.put_in_hand(W) /obj/item/weapon/reagent_containers/food/snacks/tofukabob name = "Tofu-kabob" @@ -487,6 +500,12 @@ ..() reagents.add_reagent("nutriment", 8) bitesize = 2 + On_Consume() + if(!reagents.total_volume) + var/mob/M = usr + var/obj/item/stack/rods/W = new /obj/item/stack/rods( M ) + M << "\blue You lick clean the rod." + M.put_in_hand(W) /obj/item/weapon/reagent_containers/food/snacks/cubancarp name = "Cuban Carp" @@ -503,10 +522,17 @@ name = "Popcorm" //not a typo desc = "Now let's find some cinema." icon_state = "popcorn" + var/unpopped = 0 New() ..() + unpopped = rand(1,10) reagents.add_reagent("nutriment", 2) bitesize = 0.1 //this snack is supposed to be eating during looooong time. And this it not dinner food! --rastaf0 + On_Consume() + if(prob(unpopped)) + usr << "\red You bite down on an un-popped kernel!" + unpopped = max(0, unpopped-1) + /obj/item/weapon/reagent_containers/food/snacks/sosjerky name = "Scaredy's Private Reserve Beef Jerky" @@ -598,14 +624,15 @@ reagents.add_reagent("nutriment", 3) bitesize = 2 On_Consume() - var/mob/M = usr - var/obj/item/weapon/paper/paper = locate() in src - M.visible_message( \ - "\blue [M] takes a piece of paper from the cookie!", \ - "\blue You take a piece of paper from the cookie! Read it!" \ - ) - M.put_in_hand(paper) - paper.add_fingerprint(M) + if(!reagents.total_volume) + var/mob/M = usr + var/obj/item/weapon/paper/paper = locate() in src + M.visible_message( \ + "\blue [M] takes a piece of paper from the cookie!", \ + "\blue You take a piece of paper from the cookie! Read it!" \ + ) + M.put_in_hand(paper) + paper.add_fingerprint(M) /obj/item/weapon/reagent_containers/food/snacks/badrecipe name = "Burned mess" @@ -618,7 +645,7 @@ bitesize = 1 /obj/item/weapon/reagent_containers/food/snacks/meatstake - name = "Meat stake" + name = "Meat steak" desc = "A piece of hot spicy meat." icon_state = "meatstake" New() diff --git a/code/modules/food/recipes_microwave.dm b/code/modules/food/recipes_microwave.dm index f818052808..d5fd1f7ddc 100644 --- a/code/modules/food/recipes_microwave.dm +++ b/code/modules/food/recipes_microwave.dm @@ -30,7 +30,7 @@ var/lastname_index = findtext(human_name, " ") if (lastname_index) human_name = copytext(human_name,lastname_index+1) - + var/obj/item/weapon/reagent_containers/food/snacks/human/HB = ..(container) HB.name = human_name+HB.name HB.job = human_job diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index 90811f1409..89747ea992 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -14,7 +14,8 @@ if (istype(src.wear_suit, /obj/item/clothing/suit/space/space_ninja)&&src.wear_suit:initialize) var/location = src.loc explosion(location, 1, 2, 3, 4) - + //src.flags = 0 + //reagents.handle_reactions() //No magic stomach for corpses. src.canmove = 0 if(src.client) src.blind.layer = 0 diff --git a/code/setup.dm b/code/setup.dm index 9d4f700347..45d64e3fbe 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -107,12 +107,12 @@ #define NOSLIP 1024 //prevents from slipping on wet floors, in space etc -//#define EXTRACT_CONTAINER 4095 //Container may have reagents removed from it. -//#define INSERT_CONTAINER 4096 //Container may have reagents added to it. #define OPENCONTAINER 4096 // is an open container for chemistry purposes #define ONESIZEFITSALL 8192 // can be worn by fatties (or children? ugh) +#define NOREACT 16384 //Reagents dont' react inside this container. + // bitflags for clothing parts #define HEAD 1