Skip to content

Commit

Permalink
Gluttony rework (#15919)
Browse files Browse the repository at this point in the history
  • Loading branch information
TobleroneSwordfish committed Sep 22, 2023
1 parent f2a0c07 commit 03a2ca1
Show file tree
Hide file tree
Showing 21 changed files with 294 additions and 199 deletions.
6 changes: 0 additions & 6 deletions code/mob/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

var/datum/organHolder/organHolder = null //Not all living mobs will use organholder. Instantiate on New() if you want one.

var/list/stomach_process = list() //digesting foods
var/list/skin_process = list() //digesting patches

var/sound_burp = 'sound/voice/burp.ogg'
Expand Down Expand Up @@ -116,8 +115,6 @@
var/list/stamina_mods_regen = list()
var/list/stamina_mods_max = list()

var/list/stomach_contents = list()

var/last_sleep = 0 //used for sleep_bubble

can_lie = TRUE
Expand Down Expand Up @@ -176,11 +173,8 @@
thishud.remove_object(stamina_bar)
stamina_bar = null

for (var/atom/A as anything in stomach_process)
qdel(A)
for (var/atom/A as anything in skin_process)
qdel(A)
stomach_process = null
skin_process = null

for(var/mob/living/intangible/aieye/E in src.contents)
Expand Down
33 changes: 7 additions & 26 deletions code/mob/living/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

/mob/living/carbon/disposing()
STOP_TRACKING
stomach_contents = null
..()

/mob/living/carbon/Move(NewLoc, direct)
Expand Down Expand Up @@ -65,35 +64,17 @@
if(src.getStatusDuration("slowed")< 10 SECONDS)
src.changeStatus("slowed", 2 SECONDS)

/mob/living/carbon/relaymove(var/mob/user, direction)
if(user in src.stomach_contents)
if(prob(40))
for(var/mob/M in hearers(4, src))
if(M.client)
M.show_message(text("<span class='alert'>You hear something rumbling inside [src]'s stomach...</span>"), 2)
var/obj/item/I = user.equipped()
if(I?.force)
var/d = rand(round(I.force / 4), I.force)
src.TakeDamage("chest", d, 0)
for(var/mob/M in viewers(user, null))
if(M.client)
M.show_message(text("<span class='alert'><B>[user] attacks [src]'s stomach wall with the [I.name]!</span>"), 2)
playsound(user.loc, 'sound/impact_sounds/Slimy_Hit_3.ogg', 50, 1)

if(prob(get_brute_damage() - 50))
logTheThing(LOG_COMBAT, user, "gibs [constructTarget(src,"combat")] breaking out of their stomach at [log_loc(src)].")
src.gib()
/mob/living/carbon/relaymove(mob/user, direction, delay, running)
src.organHolder?.stomach?.relaymove(user, direction, delay, running)

/mob/living/carbon/gib(give_medal, include_ejectables)
for(var/mob/M in src)
if(M in src.stomach_contents)
src.stomach_contents.Remove(M)
if (!isobserver(M) && !isintangible(M))
src.visible_message("<span class='alert'><B>[M] bursts out of [src]!</B></span>")
else if (istype(M, /mob/dead/target_observer))
M.cancel_camera()
for (var/mob/dead/target_observer/obs in src)
obs.cancel_camera()

for(var/mob/M in src.organHolder?.stomach?.contents)
src.visible_message("<span class='alert'><B>[M] bursts out of [src]!</B></span>")
M.set_loc(src.loc)

. = ..(give_medal, include_ejectables)

/mob/living/carbon/proc/urinate()
Expand Down
23 changes: 1 addition & 22 deletions code/mob/living/life/organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,11 @@
process(var/datum/gas_mixture/environment)
if(!isdead(owner))
owner.handle_organs(get_multiplier())

//the master vore loop
if (owner.stomach_contents && length(owner.stomach_contents))
SPAWN(0)
for (var/mob/M in owner.stomach_contents)
if (M.loc != owner)
owner.stomach_contents.Remove(M)
continue
if (iscarbon(M) && !isdead(owner))
if (isdead(M))
M.death(TRUE)
owner.stomach_contents.Remove(M)
M.ghostize()
qdel(M)
owner.emote("burp")
playsound(owner.loc, 'sound/voice/burp.ogg', 50, 1)
continue
if (air_master.current_cycle%3==1)
if (!M.nodamage)
M.TakeDamage("chest", 5, 0)
owner.nutrition += 10
..()


/mob/living/proc/handle_organs(var/mult = 1)//for things that arent humans, and dont override to use actual organs - they might use digestion ok
src.handle_digestion(mult)
src.organHolder?.stomach?.handle_digestion(mult)

/mob/living/carbon/human/handle_organs(var/mult = 1)
if (src.ignore_organs)
Expand Down
65 changes: 39 additions & 26 deletions code/modules/chemistry/tools/food_and_drink.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food)
/obj/item/reagent_containers/food
inhand_image_icon = 'icons/mob/inhand/hand_food.dmi'
var/heal_amt = 0 //! Amount this food heals for when eaten
var/fill_amt = 1 //! Amount of space this takes up in a stomach
var/required_utensil = null //! Which utensil we need to use to eat this
var/food_color = null //! Color for various food items
var/custom_food = TRUE //! Can it be used to make custom food like for pizzas
Expand All @@ -20,8 +21,25 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food)
var/slice_amount = 1 //! How many slices to spawn after slicing
var/slice_inert = FALSE //! If the food is inert while slicing (ie chemical reactions won't occur)
var/slice_suffix = "slice" //! When we want to name them slices or wedges or what-have-you
var/did_stomach_react = 0 //! Has this already reacted when being digested
var/digest_count = 0 //! How digested is this while in stomach
var/dissolve_threshold = 20 //! How digested something needs to be before it dissolves
rc_flags = 0

///Slowly dissolve in stomach, releasing reagents
proc/process_stomach(mob/living/owner, var/process_rate = 5)
src.digest_count += process_rate
if (owner && src.reagents?.total_volume > 0)
if (!src.did_stomach_react)
src.reagents.reaction(owner, INGEST, src.reagents.total_volume)
src.did_stomach_react = 1

src.reagents.trans_to(owner, process_rate, HAS_ATOM_PROPERTY(owner, PROP_MOB_DIGESTION_EFFICIENCY) ? GET_ATOM_PROPERTY(owner, PROP_MOB_DIGESTION_EFFICIENCY) : 1)

if ((!src.reagents || src.reagents.total_volume <= 0) && src.digest_count > src.dissolve_threshold)
owner.organHolder.stomach.eject(src)
qdel(src)

proc/on_table()
if (!isturf(src.loc))
return FALSE
Expand Down Expand Up @@ -78,6 +96,12 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food)
//slicing food can be done here using sliceable == TRUE, slice_amount, and slice_product
attackby(obj/item/W, mob/user)
if (src.sliceable && istool(W, TOOL_CUTTING | TOOL_SAWING))
if(user.bioHolder.HasEffect("clumsy") && prob(50))
user.visible_message("<span class='alert'><b>[user]</b> fumbles and jabs [himself_or_herself(user)] in the eye with [W].</span>")
user.change_eye_blurry(5)
user.changeStatus("weakened", 3 SECONDS)
JOB_XP(user, "Clown", 2)
return
var/turf/T = get_turf(src)
user.visible_message("[user] cuts [src] into [src.slice_amount] [src.slice_suffix][s_es(src.slice_amount)].", "You cut [src] into [src.slice_amount] [src.slice_suffix][s_es(src.slice_amount)].")
var/amount_to_transfer = round(src.reagents.total_volume / src.slice_amount)
Expand All @@ -93,6 +117,7 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food)

//This proc handles all the actions being done to the produce. use this proc to work with your slices after they were created (looking at all these slice code at plant produce...)
proc/process_sliced_products(var/obj/item/reagent_containers/food/slice, var/amount_to_transfer)
slice.fill_amt = src.fill_amt / src.slice_amount
slice.transform = src.transform // for botany crops
slice.reagents.clear_reagents() // dont need initial_reagents when you're inheriting reagents of another obj (no cheese duping >:[ )
slice.reagents.maximum_volume = amount_to_transfer
Expand Down Expand Up @@ -245,6 +270,9 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food/snacks)
M.visible_message("<span class='notice'>[M] tries to take a bite of [src], but can't swallow!</span>",\
"<span class='notice'>You try to take a bite of [src], but can't swallow!</span>")
return 0
if (tummy.calculate_fullness() > tummy.capacity)
M.show_message("<span class='alert'>You're just too full to take another bite!</span>")
return 0
if (!H.organHolder.head)
M.visible_message("<span class='notice'>[M] tries to take a bite of [src], but they have no head!</span>",\
"<span class='notice'>You try to take a bite of [src], but you have no head to chew with!</span>")
Expand Down Expand Up @@ -439,19 +467,17 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food/snacks)
proc/on_bite(mob/eater, mob/feeder, ethereal_eater)

if (isliving(eater))
if (src.reagents && src.reagents.total_volume) //only create food chunks for reagents
if(ethereal_eater)//ghost critters can get a little ingest reaction and a tiny amount of reagent, but won't actually take reagents
src.reagents.reaction(eater, INGEST, 3)
if(!ON_COOLDOWN(src, "critter_reagent_copy_\ref[eater]", 15 SECONDS))
src.reagents.copy_to(eater.reagents, 3/max(src.reagents.total_volume, 3)) //copy up to 3u total, once per food per 15 seconds
else
var/obj/item/reagent_containers/food/snacks/bite/B = new /obj/item/reagent_containers/food/snacks/bite
B.set_loc(eater)
B.reagents.maximum_volume = reagents.total_volume/(src.bites_left+1 || 1) //MBC : I copied this from the Eat proc. It doesn't really handle the reagent transfer evenly??
src.reagents.trans_to(B,B.reagents.maximum_volume,1,0) //i'll leave it tho because i dont wanna mess anything up
var/mob/living/L = eater
L.stomach_process += B

if(ethereal_eater)//ghost critters can get a little ingest reaction and a tiny amount of reagent, but won't actually take reagents
src.reagents.reaction(eater, INGEST, 3)
if(!ON_COOLDOWN(src, "critter_reagent_copy_\ref[eater]", 15 SECONDS))
src.reagents.copy_to(eater.reagents, 3/max(src.reagents.total_volume, 3)) //copy up to 3u total, once per food per 15 seconds
else
var/obj/item/reagent_containers/food/snacks/bite/B = new /obj/item/reagent_containers/food/snacks/bite
B.fill_amt = src.fill_amt/initial(src.bites_left) //so all the bites add up to the full item fillness
B.reagents.maximum_volume = reagents.total_volume/((src.bites_left+1) || 1) //MBC : I copied this from the Eat proc. It doesn't really handle the reagent transfer evenly??
src.reagents.trans_to(B,B.reagents.maximum_volume,1,0) //i'll leave it tho because i dont wanna mess anything up
var/mob/living/L = eater
L.organHolder.stomach.consume(B)

if (length(src.food_effects) && isliving(eater) && eater.bioHolder)
var/mob/living/L = eater
Expand Down Expand Up @@ -504,19 +530,6 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food/snacks)
edible = 1
rand_pos = 1
bites_left = 1
var/did_react = 0

proc/process_stomach(mob/living/owner, var/process_rate = 5)
if (owner && src.reagents)
if (!src.did_react)
src.reagents.reaction(owner, INGEST, src.reagents.total_volume)
src.did_react = 1

src.reagents.trans_to(owner, process_rate, HAS_ATOM_PROPERTY(owner, PROP_MOB_DIGESTION_EFFICIENCY) ? GET_ATOM_PROPERTY(owner, PROP_MOB_DIGESTION_EFFICIENCY) : 1)

if (src.reagents.total_volume <= 0)
owner.stomach_process -= src
qdel(src)

/obj/item/reagent_containers/food/snacks/takeout
name = "Chinese takeout carton"
Expand Down
41 changes: 13 additions & 28 deletions code/modules/food_and_drink/bread.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
icon_state = "breadloaf"
bites_left = 1
heal_amt = 1
fill_amt = 6
food_color = "#FFFFCC"
real_name = "bread"
flags = FPRINT | TABLEPASS
c_flags = ONBELT
var/slicetype = /obj/item/reagent_containers/food/snacks/breadslice
sliceable = TRUE
slice_amount = 6
slice_product = /obj/item/reagent_containers/food/snacks/breadslice
initial_volume = 30
initial_reagents = "bread"
food_effects = list("food_hp_up")
Expand Down Expand Up @@ -44,82 +47,64 @@
if (prob(0.01))
src.become_mimic()

attackby(obj/item/W, mob/user)
if (iscuttingtool(W) || issawingtool(W))
if(user.bioHolder.HasEffect("clumsy") && prob(50))
user.visible_message("<span class='alert'><b>[user]</b> fumbles and jabs [himself_or_herself(user)] in the eye with [W].</span>")
user.change_eye_blurry(5)
user.changeStatus("weakened", 3 SECONDS)
JOB_XP(user, "Clown", 2)
return

var/turf/T = get_turf(src)
user.visible_message("[user] cuts [src] into slices.", "You cut [src] into slices.")
var/makeslices = 6
while (makeslices > 0)
new slicetype (T)
makeslices -= 1
qdel (src)
else ..()

/obj/item/reagent_containers/food/snacks/breadloaf/honeywheat
name = "loaf of honey-wheat bread"
desc = "A bread made with honey. Right there in the name, first thing, top billing."
icon_state = "honeyloaf"
real_name = "honey-wheat bread"
slicetype = /obj/item/reagent_containers/food/snacks/breadslice/honeywheat
slice_product = /obj/item/reagent_containers/food/snacks/breadslice/honeywheat

/obj/item/reagent_containers/food/snacks/breadloaf/banana
name = "loaf of banana bread"
desc = "A bread commonly found near clowns."
icon_state = "bananabread"
real_name = "banana bread"
slicetype = /obj/item/reagent_containers/food/snacks/breadslice/banana
slice_product = /obj/item/reagent_containers/food/snacks/breadslice/banana

/obj/item/reagent_containers/food/snacks/breadloaf/brain
name = "loaf of brain bread"
desc = "A pretty smart way to eat."
icon_state = "brainbread"
real_name = "brain bread"
slicetype = /obj/item/reagent_containers/food/snacks/breadslice/brain
slice_product = /obj/item/reagent_containers/food/snacks/breadslice/brain

/obj/item/reagent_containers/food/snacks/breadloaf/pumpkin
name = "loaf of pumpkin bread"
desc = "A very seasonal quickbread! It tastes like Fall."
icon_state = "pumpkinbread"
real_name = "pumpkin bread"
slicetype = /obj/item/reagent_containers/food/snacks/breadslice/pumpkin
slice_product = /obj/item/reagent_containers/food/snacks/breadslice/pumpkin

/obj/item/reagent_containers/food/snacks/breadloaf/elvis
name = "loaf of elvis bread"
desc = "Fattening and delicious, despite the hair. It tastes like the soul of rock and roll."
icon_state = "elvisbread"
real_name ="elvis bread"
slicetype = /obj/item/reagent_containers/food/snacks/breadslice/elvis
slice_product = /obj/item/reagent_containers/food/snacks/breadslice/elvis

/obj/item/reagent_containers/food/snacks/breadloaf/spooky
name = "loaf of dread"
desc = "The bread of the damned."
icon_state = "dreadloaf"
real_name = "dread"
slicetype = /obj/item/reagent_containers/food/snacks/breadslice/spooky
slice_product = /obj/item/reagent_containers/food/snacks/breadslice/spooky

/obj/item/reagent_containers/food/snacks/breadloaf/corn
name = "southern-style cornbread"
desc = "A maize-based quickbread. This variety, popular in the Southern United States, is not particularly sweet."
icon_state= "cornbread"
real_name = "cornbread"
slicetype = /obj/item/reagent_containers/food/snacks/breadslice/corn
slice_product = /obj/item/reagent_containers/food/snacks/breadslice/corn

sweet
name = "northern-style cornbread"
desc = "A chunk of sweet maize-based quickbread."
slicetype = /obj/item/reagent_containers/food/snacks/breadslice/corn/sweet
slice_product = /obj/item/reagent_containers/food/snacks/breadslice/corn/sweet

honey
name = "honey cornbread"
desc = "A chunk of honey-sweetened maize-based quickbread."
slicetype = /obj/item/reagent_containers/food/snacks/breadslice/corn/sweet/honey
slice_product = /obj/item/reagent_containers/food/snacks/breadslice/corn/sweet/honey

/obj/item/reagent_containers/food/snacks/breadslice
name = "slice of bread"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/food_and_drink/cakes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
inhand_image_icon = 'icons/mob/inhand/hand_food.dmi'
bites_left = 0
heal_amt = 2
fill_amt = 20 //2 per slice
use_bite_mask = FALSE
flags = FPRINT | TABLEPASS | NOSPLASH
initial_volume = 100
Expand Down Expand Up @@ -216,6 +217,7 @@
schild.food_color = src.food_color
schild.sliced = TRUE
schild.bites_left = 1
schild.fill_amt = src.fill_amt / CAKE_SLICES

schild.set_loc(get_turf(src.loc))
qdel(s) //cleaning up the template slice
Expand Down
1 change: 1 addition & 0 deletions code/modules/food_and_drink/candy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food/snacks/candy)
icon = 'icons/obj/foodNdrink/food_candy.dmi'
icon_state = "candy"
heal_amt = 1
fill_amt = 0.3 //You can eat a lot of candy
real_name = "candy"
var/sugar_content = 50
var/razor_blade = 0 //Is this BOOBYTRAPPED CANDY?
Expand Down
1 change: 1 addition & 0 deletions code/modules/food_and_drink/condiments.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food/snacks/condiment)
desc = "Fluffy and fragrant."
icon_state = "butters"
heal_amt = 3
fill_amt = 2
initial_volume = 20

New()
Expand Down

0 comments on commit 03a2ca1

Please sign in to comment.