mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
[MIRROR] Fixes some edible material things being inedible/too edible (#1705)
* Fixes some edible material things being inedible/too edible (#54941) * *clap * Defeats the ghosts of pizzas vored * linter called me cringe * vvvvvvv * Fixes some edible material things being inedible/too edible Co-authored-by: ArcaneDefence <51932756+ArcaneDefence@users.noreply.github.com>
This commit is contained in:
co-authored by
ArcaneDefence
parent
64fff5530d
commit
a90b8558c5
@@ -75,8 +75,8 @@ Behavior that's still missing from this component that original food items had t
|
||||
if (!item.grind_results)
|
||||
item.grind_results = list() //If this doesn't already exist, add it as an empty list. This is needed for the grinder to accept it.
|
||||
|
||||
else if(isturf(parent))
|
||||
RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND, .proc/TryToEatTurf)
|
||||
else if(isturf(parent) || isstructure(parent))
|
||||
RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND, .proc/TryToEatIt)
|
||||
|
||||
src.bite_consumption = bite_consumption
|
||||
src.food_flags = food_flags
|
||||
@@ -149,7 +149,7 @@ Behavior that's still missing from this component that original food items had t
|
||||
|
||||
return TryToEat(M, user)
|
||||
|
||||
/datum/component/edible/proc/TryToEatTurf(datum/source, mob/user)
|
||||
/datum/component/edible/proc/TryToEatIt(datum/source, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
return TryToEat(user, user)
|
||||
@@ -250,28 +250,27 @@ Behavior that's still missing from this component that original food items had t
|
||||
else
|
||||
this_food.reagents.add_reagent(r_id, amount)
|
||||
|
||||
///Makes sure the thing hasn't been destroyed or fully eaten to prevent eating phantom edibles
|
||||
/datum/component/edible/proc/IsFoodGone(atom/owner, mob/living/feeder)
|
||||
if(QDELETED(owner)|| !(IS_EDIBLE(owner)))
|
||||
return TRUE
|
||||
if(owner.reagents.total_volume)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
///All the checks for the act of eating itself and
|
||||
/datum/component/edible/proc/TryToEat(mob/living/eater, mob/living/feeder)
|
||||
|
||||
set waitfor = FALSE
|
||||
|
||||
if(QDELETED(parent))
|
||||
return
|
||||
|
||||
var/atom/owner = parent
|
||||
|
||||
|
||||
if(feeder.a_intent == INTENT_HARM)
|
||||
return
|
||||
if(!owner.reagents.total_volume)//Shouldn't be needed but it checks to see if it has anything left in it.
|
||||
to_chat(feeder, "<span class='warning'>None of [owner] left, oh no!</span>")
|
||||
if(isturf(parent))
|
||||
var/turf/T = parent
|
||||
T.ScrapeAway(1, CHANGETURF_INHERIT_AIR)
|
||||
else
|
||||
qdel(parent)
|
||||
|
||||
if(IsFoodGone(owner, feeder))
|
||||
return
|
||||
|
||||
if(!CanConsume(eater, feeder))
|
||||
return
|
||||
var/fullness = eater.get_fullness() + 10 //The theoretical fullness of the person eating if they were to eat this
|
||||
@@ -281,6 +280,8 @@ Behavior that's still missing from this component that original food items had t
|
||||
if(eater == feeder)//If you're eating it yourself.
|
||||
if(!do_mob(feeder, eater, eat_time)) //Gotta pass the minimal eat time
|
||||
return
|
||||
if(IsFoodGone(owner, feeder))
|
||||
return
|
||||
var/eatverb = pick(eatverbs)
|
||||
if(junkiness && eater.satiety < -150 && eater.nutrition > NUTRITION_LEVEL_STARVING + 50 && !HAS_TRAIT(eater, TRAIT_VORACIOUS))
|
||||
to_chat(eater, "<span class='warning'>You don't feel like eating any more junk food at the moment!</span>")
|
||||
@@ -309,7 +310,8 @@ Behavior that's still missing from this component that original food items had t
|
||||
return
|
||||
if(!do_mob(feeder, eater)) //Wait 3 seconds before you can feed
|
||||
return
|
||||
|
||||
if(IsFoodGone(owner, feeder))
|
||||
return
|
||||
log_combat(feeder, eater, "fed", owner.reagents.log_list())
|
||||
eater.visible_message("<span class='danger'>[feeder] forces [eater] to eat [parent]!</span>", \
|
||||
"<span class='userdanger'>[feeder] forces you to eat [parent]!</span>")
|
||||
@@ -396,6 +398,7 @@ Behavior that's still missing from this component that original food items had t
|
||||
|
||||
on_consume?.Invoke(eater, feeder)
|
||||
|
||||
to_chat(feeder, "<span class='warning'>There is nothing left of [parent], oh no!</span>")
|
||||
if(isturf(parent))
|
||||
var/turf/T = parent
|
||||
T.ScrapeAway(1, CHANGETURF_INHERIT_AIR)
|
||||
|
||||
Reference in New Issue
Block a user