Skip to content

Commit

Permalink
Better logic + "unvomitable nutriment".
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeberdir committed Oct 8, 2024
1 parent a76d76c commit 11dc47e
Show file tree
Hide file tree
Showing 21 changed files with 67 additions and 65 deletions.
15 changes: 7 additions & 8 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,13 @@
#define SHOCK_KNOCKDOWN (1<<7)

/// Vomit defines
#define VOMIT_NUTRITION_LOSS 10
#define VOMIT_STUN_TIME (8 SECONDS)
#define VOMIT_DISTANCE 0
#define VOMIT_NUTRITION_LOSS 10
#define VOMIT_STUN_TIME (8 SECONDS)
#define VOMIT_DISTANCE 0
#define VOMIT_SAFE_NUTRITION 90
/// Vomit modes
#define VOMIT_TOXIN (1<<0)
#define VOMIT_BLOOD (1<<1)
#define VOMIT_BOTH (VOMIT_TOXIN|VOMIT_BLOOD)
#define VOMIT_BLOOD (1<<0)

/// When reached - we'll apply status effect which will force carbon to vomit
#define TOX_VOMIT_THRESHOLD_REACHED(mob, toxloss) (mob.getToxLoss() >= toxloss)
#define TOX_VOMIT_REQUIRED_TOXLOSS 45
#define TOX_VOMIT_THRESHOLD_REACHED(mob, toxloss) (mob.getToxLoss() >= toxloss)
#define TOX_VOMIT_REQUIRED_TOXLOSS 45
14 changes: 7 additions & 7 deletions code/datums/components/eatable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/// integrity spend after bite
var/integrity_bite // integrity spend after bite
/// How much nutrition add
var/nutritional_value
var/nutritional_value
/// Grab if help_intent was used
var/is_only_grab_intent
/// If true - your item can be eaten without special diet check.
Expand All @@ -29,7 +29,7 @@
)
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE

src.current_bites = current_bites
src.material_type = material_type
src.max_bites = max_bites
Expand All @@ -38,7 +38,7 @@
src.is_only_grab_intent = is_only_grab_intent
src.is_always_eatable = is_always_eatable
src.stack_use = stack_use

/datum/component/eatable/RegisterWithParent()
RegisterSignal(parent, COMSIG_ITEM_PRE_ATTACKBY, PROC_REF(pre_try_eat_item))
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(on_examine))
Expand All @@ -53,7 +53,7 @@

if(!istype(human))
return

if(material_type & human.dna.species.special_diet)
examine_list += "Вкуснятина! [is_only_grab_intent ? "\nНужно аккуратно есть." : ""]"

Expand Down Expand Up @@ -125,7 +125,7 @@
if (target != user)
chat_message_to_target = "В ваш рот насильно запихивают [item.name]!"
if(target.nutrition >= NUTRITION_LEVEL_FULL)
target.vomit(VOMIT_TOXIN, nutritional_value + 20)
target.vomit(nutritional_value + 20)
target.adjustStaminaLoss(15)

if(target != user)
Expand All @@ -134,7 +134,7 @@

to_chat(target, span_notice("[chat_message_to_target]"))
add_attack_logs(user, item, "Force Fed [target], item [item]")

if(!isstack(item))
to_chat(user, span_notice("[chat_message_to_user]"))

Expand Down Expand Up @@ -170,7 +170,7 @@
item.visible_message(span_warning("[user] пытается накормить [target], запихивая в рот [item.name]."))
if(!do_after(user, target, 2 SECONDS, NONE))
return FALSE

return TRUE

/datum/component/eatable/proc/get_colour()
Expand Down
6 changes: 3 additions & 3 deletions code/datums/diseases/viruses/advance/symptoms/vomit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Bonus
return

/datum/symptom/vomit/proc/Vomit(mob/living/carbon/M)
M.vomit(VOMIT_TOXIN, 20)
M.vomit(20)

/*
//////////////////////////////////////
Expand Down Expand Up @@ -77,7 +77,7 @@ Bonus
severity = 5

/datum/symptom/vomit/blood/Vomit(mob/living/carbon/M)
M.vomit(VOMIT_BLOOD)
M.vomit(0, VOMIT_BLOOD)


/*
Expand Down Expand Up @@ -106,4 +106,4 @@ Bonus
level = 4

/datum/symptom/vomit/projectile/Vomit(mob/living/carbon/M)
M.vomit(VOMIT_TOXIN, 6, 8 SECONDS, 5, 1)
M.vomit(6, stun = 8 SECONDS, distance = 5)
4 changes: 2 additions & 2 deletions code/datums/diseases/viruses/cadaver.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
switch(stage)
if(2)
if(prob(2))
H.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS, 0.1 SECONDS)
H.vomit(stun = 0.1 SECONDS)
if(prob(7))
H.adjust_bodytemperature(30, max_temp = H.dna.species.heat_level_1 + 10)
to_chat(H, span_warning("You feel hot!"))
if(3, 4)
if(prob(3))
H.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS, 0.1 SECONDS)
H.vomit(stun = 0.1 SECONDS)
if(prob(7))
H.adjust_bodytemperature(30, max_temp = H.dna.species.heat_level_1 + 30)
to_chat(H, span_warning("You feel very hot!"))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/diseases/viruses/nuclefication.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
stage_message++
to_chat(H, span_notice("You feel sick."))
if(prob(2))
H.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS)
H.vomit()

radiate(H)

Expand Down
2 changes: 1 addition & 1 deletion code/datums/diseases/viruses/tuberculosis.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
to_chat(H, span_userdanger("You feel your mind relax and your thoughts drift!"))
H.AdjustConfused(16 SECONDS, bound_lower = 0, bound_upper = 200 SECONDS)
if(prob(10))
H.vomit(VOMIT_TOXIN, 20)
H.vomit(20)
if(prob(3))
to_chat(H, span_warning("<i>[pick("Your stomach silently rumbles...", "Your stomach seizes up and falls limp, muscles dead and lifeless.", "You could eat a crayon")]</i>"))
H.overeatduration = max(H.overeatduration - 100, 0)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/status_effects/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@
if(prob(pukeprob))
carbon.AdjustConfused(9 SECONDS)
carbon.AdjustStuttering(3 SECONDS)
carbon.vomit(VOMIT_TOXIN, 15, 8 SECONDS, 0, FALSE)
carbon.vomit(15, stun = 8 SECONDS, message = FALSE)
carbon.Dizzy(15 SECONDS)
if(strength >= DISGUST_LEVEL_DISGUSTED)
if(prob(25))
Expand Down Expand Up @@ -1253,7 +1253,7 @@
var/mob/living/carbon/carbon = owner
puke_counter = initial(puke_counter)

if(!carbon.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS))
if(!carbon.vomit())
return

carbon.adjustToxLoss(-3)
12 changes: 6 additions & 6 deletions code/game/gamemodes/clockwork/clockwork_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
user.visible_message("<span class='warning'>As [user] picks [src] up, it flickers off their arms!</span>", "<span class='warning'>The buckler flicker off your arms, leaving only nausea!</span>")
if(iscarbon(user))
var/mob/living/carbon/C = user
C.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS)
C.vomit()
C.Knockdown(10 SECONDS)
else
to_chat(user, "<span class='clocklarge'>\"Did you like having head?\"</span>")
Expand Down Expand Up @@ -772,7 +772,7 @@
user.visible_message("<span class='warning'>As [user] picks [src] up, it flickers off their arms!</span>", "<span class='warning'>The robe flicker off your arms, leaving only nausea!</span>")
if(iscarbon(user))
var/mob/living/carbon/C = user
C.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS)
C.vomit()
C.Knockdown(10 SECONDS)
else
to_chat(user, "<span class='clocklarge'>\"I think this armor is too hot for you to handle.\"</span>")
Expand Down Expand Up @@ -899,7 +899,7 @@
user.visible_message("<span class='warning'>As [user] puts [src] on, it flickers off their body!</span>", "<span class='warning'>The curiass flickers off your body, leaving only nausea!</span>")
if(iscarbon(user))
var/mob/living/carbon/C = user
C.vomit(VOMIT_TOXIN, 20)
C.vomit(20)
C.Knockdown(10 SECONDS)
else
to_chat(user, "<span class='clocklarge'>\"I think this armor is too hot for you to handle.\"</span>")
Expand Down Expand Up @@ -1026,7 +1026,7 @@
user.visible_message("<span class='warning'>As [user] puts [src] on, it flickers off their arms!</span>", "<span class='warning'>The gauntlets flicker off your arms, leaving only nausea!</span>")
if(iscarbon(user))
var/mob/living/carbon/C = user
C.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS)
C.vomit()
C.Knockdown(10 SECONDS)
else
to_chat(user, "<span class='clocklarge'>\"Did you like having arms?\"</span>")
Expand Down Expand Up @@ -1066,7 +1066,7 @@
user.visible_message("<span class='warning'>As [user] puts [src] on, it flickers off their feet!</span>", "<span class='warning'>The treads flicker off your feet, leaving only nausea!</span>")
if(iscarbon(user))
var/mob/living/carbon/C = user
C.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS)
C.vomit()
C.Knockdown(10 SECONDS)
else
to_chat(user, "<span class='clocklarge'>\"Let's see if you can dance with these.\"</span>")
Expand Down Expand Up @@ -1113,7 +1113,7 @@
user.visible_message("<span class='warning'>As [user] puts [src] on, it flickers off their head!</span>", "<span class='warning'>The helmet flickers off your head, leaving only nausea!</span>")
if(iscarbon(user))
var/mob/living/carbon/C = user
C.vomit(VOMIT_TOXIN, 20)
C.vomit(20)
C.Knockdown(10 SECONDS)
else
to_chat(user, "<span class='heavy_brass'>\"Do you have a hole in your head? You're about to.\"</span>")
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/miniantags/abduction/gland.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@

/obj/item/organ/internal/heart/gland/slime/activate()
to_chat(owner, "<span class='warning'>You feel nauseous!</span>")
owner.vomit(VOMIT_TOXIN, 20)
owner.vomit(20)

var/mob/living/simple_animal/slime/Slime = new(get_turf(owner), "grey")
Slime.Friends = list(owner)
Expand Down Expand Up @@ -348,4 +348,4 @@
var/turf/simulated/T = get_turf(owner)
if(istype(T))
T.atmos_spawn_air(LINDA_SPAWN_TOXINS|LINDA_SPAWN_20C,50)
owner.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS)
owner.vomit()
2 changes: 1 addition & 1 deletion code/game/gamemodes/shadowling/shadowling_abilities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@

var/mob/living/carbon/human/target = targets[1]

target.vomit(VOMIT_BLOOD, stun = 8 SECONDS, distance = 1, message = FALSE)
target.vomit(0, VOMIT_BLOOD, distance = 2, message = FALSE)
playsound(user.loc, 'sound/hallucinations/veryfar_noise.ogg', 50, TRUE)
to_chat(user, "<span class='shadowling'>You instantly rearrange <b>[target]</b>'s memories, hyptonitizing [target.p_them()] into a thrall.</span>")
to_chat(target, "<span class='userdanger'><font size=3>An agonizing spike of pain drives into your mind, and--</font></span>")
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/decorations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@
if(!.)
return .
victim.drop_from_active_hand()
victim.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS)
victim.vomit()
INVOKE_ASYNC(victim, TYPE_PROC_REF(/mob, emote), "cough")


Expand Down
3 changes: 2 additions & 1 deletion code/modules/antagonists/changeling/powers/panacea.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
borer.leave_host()
if(iscarbon(user))
var/mob/living/carbon/c_user = user
c_user.vomit()
c_user.fakevomit()
c_user.Stun(VOMIT_STUN_TIME)

if(iscarbon(user))
var/mob/living/carbon/c_user = user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@

var/obj/item/thing = organ_to_dissect.remove(target)
qdel(thing)
target.vomit(VOMIT_BLOOD|VOMIT_TOXIN, 50, 0 SECONDS)
target.vomit(50, VOMIT_BLOOD, 0 SECONDS)
if(target.has_pain())
target.emote("scream")

Expand Down Expand Up @@ -688,7 +688,7 @@

if(iscarbon(victim))
var/mob/living/carbon/c_victim = victim
c_victim.vomit(VOMIT_BLOOD|VOMIT_TOXIN, 50, 0 SECONDS)
c_victim.vomit(50, VOMIT_BLOOD, 0 SECONDS)

if(prob(10 + vampire.get_trophies(INTERNAL_ORGAN_LIVER) * 3))
new /obj/effect/temp_visual/cult/sparks(get_turf(victim))
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mining/equipment/regenerative_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@
if(prob(1))
SEND_SOUND(owner, sound(pick(spooky_sounds)))
if(prob(2))
owner.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS)
owner.vomit()
if(4, 5)
if(prob(2))
to_chat(owner, span_danger("Something flexes under your skin."))
if(prob(2))
SEND_SOUND(owner, sound(pick(spooky_sounds)))
if(prob(3))
owner.vomit(VOMIT_BLOOD)
owner.vomit(0, VOMIT_BLOOD)
if(prob(50))
var/mob/living/simple_animal/hostile/asteroid/hivelordbrood/legion/child = new(owner.loc)
child.faction = owner.faction.Copy()
Expand Down
34 changes: 18 additions & 16 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@


/mob/living/carbon/proc/vomit(
mode = VOMIT_TOXIN,
lost_nutrition = 0,
stun = VOMIT_STUN_TIME,
distance = 0,
lost_nutrition = VOMIT_NUTRITION_LOSS,
mode = NONE,
stun = VOMIT_STUN_TIME,
distance = 1,
message = TRUE
)
if(ismachineperson(src)) //IPCs do not vomit particulates
)
if(ismachineperson(src)) // IPCs do not vomit particulates.
return FALSE

if(is_muzzled())
Expand All @@ -93,12 +93,9 @@
if(stun)
Stun(stun)

if(!nutrition)
return FALSE

if((nutrition < 100 || nutrition < lost_nutrition) && (!(mode & VOMIT_BLOOD)))
if((nutrition - VOMIT_SAFE_NUTRITION) < lost_nutrition && (!(mode & VOMIT_BLOOD)))
if(message)
visible_message(span_warning("[src.name] сухо кашля[pluralize_ru(src.gender,"ет","ют")]!"), \
visible_message(span_warning("[name] сухо кашля[pluralize_ru(gender,"ет","ют")]!"), \
span_userdanger("Вы пытаетесь проблеваться, но в вашем желудке пусто!"))

if(stun)
Expand All @@ -107,23 +104,27 @@
return FALSE

if(message)
visible_message(span_danger("[src.name] блю[pluralize_ru(src.gender,"ет","ют")]!"), \
visible_message(span_danger("[name] блю[pluralize_ru(gender,"ет","ют")]!"), \
span_userdanger("Вас вырвало!"))

playsound(get_turf(src), 'sound/effects/splat.ogg', 50, 1)
playsound(get_turf(src), 'sound/effects/splat.ogg', 50, TRUE)
var/turf/turf = get_turf(src)

if(!turf)
return FALSE

for(var/i = 0 to distance)
if(mode & VOMIT_TOXIN)
var/max_nutriment_vomit_dist = 0
if(lost_nutrition)
max_nutriment_vomit_dist = floor((nutrition - VOMIT_SAFE_NUTRITION) / lost_nutrition)

for(var/i = 1 to distance)
if(max_nutriment_vomit_dist >= distance)
turf.add_vomit_floor()
adjust_nutrition(-lost_nutrition)

if(stun)
adjustToxLoss(-3)

if(mode & VOMIT_BLOOD)
add_splatter_floor(turf)

Expand All @@ -137,6 +138,7 @@

return FALSE


/mob/living/carbon/gib()
. = death(TRUE)
if(!.)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/reagents/drugs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@
M.emote(pick("laugh"))
if(60 to 69)
M.adjust_bodytemperature(rand(1, 5))
M.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS)
M.vomit()
update_flags |= M.adjustBrainLoss(rand(1, 5))
if(70 to 74)
to_chat(M, "<span class='warning'>You are literally bursting with laughter</span>")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/reagents/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
if(prob(3))
if(ishuman(M))
var/mob/living/carbon/human/H = M
H.vomit(VOMIT_TOXIN, VOMIT_NUTRITION_LOSS)
H.vomit()
return ..() | update_flags


Expand Down
Loading

0 comments on commit 11dc47e

Please sign in to comment.