Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting some Neb/Bay gluttony changes. #9183

Merged
merged 1 commit into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions code/__defines/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,21 @@
#define MOB_TINY 5
#define MOB_MINISCULE 1

// Gluttony levels. Used for eating items and mobs.
#define GLUT_NONE 0 // Cannot eat any mob or item.
#define GLUT_TINY 1 // Eat anything tiny and smaller
#define GLUT_SMALLER 2 // Eat anything smaller than we are
#define GLUT_ANYTHING 4 // Eat anything, ever

#define GLUT_ITEM_TINY 8 // Eat items with a w_class of small or smaller
#define GLUT_ITEM_NORMAL 16 // Eat items with a w_class of normal or smaller
#define GLUT_ITEM_ANYTHING 32 // Eat any item
#define GLUT_PROJECTILE_VOMIT 64 // When vomitting, does it fly out?

// Devour speeds, returned by can_devour()
#define DEVOUR_SLOW 1
#define DEVOUR_FAST 2

#define TINT_NONE 0
#define TINT_MODERATE 1
#define TINT_HEAVY 2
Expand Down
80 changes: 80 additions & 0 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -561,3 +561,83 @@
return ingest(holder, ingested, amount, multiplier, copy)
if(chem_type == CHEM_TOUCH)
return holder.trans_to_holder(touching, amount, multiplier, copy)


/mob/living/carbon/devour(atom/movable/victim)
var/can_eat = can_devour(victim)
if(!can_eat)
return FALSE
var/eat_speed = 100
if(can_eat == DEVOUR_FAST)
eat_speed = 30
visible_message(SPAN_DANGER("\The [src] is attempting to devour \the [victim] whole!"))
var/action_target = victim
if(isobj(victim))
action_target = src
if(!do_mob(src, action_target, eat_speed))
return FALSE
visible_message(SPAN_DANGER("\The [src] devours \the [victim] whole!"))
if(ismob(victim))
add_attack_logs(src, victim, "devoured")
else
drop_from_inventory(victim)
move_to_stomach(victim)
return TRUE

/mob/living/carbon/proc/can_devour(atom/movable/victim, var/silent = FALSE)

if(!should_have_organ(O_STOMACH))
return FALSE

var/obj/item/organ/internal/stomach/stomach = get_internal_organ(O_STOMACH)
if(!istype(stomach) || stomach.is_broken())
if(!silent)
to_chat(src, SPAN_WARNING("Your stomach is not functional!"))
return FALSE

if(!stomach.can_eat_atom(victim))
if(!silent)
to_chat(src, SPAN_WARNING("You are not capable of devouring \the [victim] whole!"))
return FALSE

if(stomach.is_full(victim))
if(!silent)
to_chat(src, SPAN_WARNING("Your [stomach.name] is full!"))
return FALSE

return stomach.get_devour_time(victim)

/mob/living/carbon/proc/move_to_stomach(atom/movable/victim)
SHOULD_CALL_PARENT(FALSE)
var/mob/mob_victim = victim
if(istype(mob_victim, /obj/item/holder))
mob_victim = locate(/mob) in mob_victim
if(mob_victim && mob_victim != victim)
stomach_contents.Add(mob_victim)
qdel(victim)
else
stomach_contents.Add(victim)

/mob/living/carbon/empty_stomach(var/blood_vomit)

for(var/atom/movable/thing in stomach_contents)
thing.dropInto(get_turf(src))
if(species.gluttonous & GLUT_PROJECTILE_VOMIT)
thing.throw_at(get_edge_target_turf(src,dir),7,7,src)

visible_message(SPAN_DANGER("\The [src] throws up!"),SPAN_DANGER("You throw up!"))
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
Stun(5)

var/turf/simulated/T = get_turf(src) //TODO: Make add_blood_floor remove blood from human mobs
if(istype(T))
if(blood_vomit)
T.add_blood_floor(src)
else
T.add_vomit_floor(src, 1)
if(blood_vomit)
if(getBruteLoss() < 50)
adjustBruteLoss(3)
else
adjust_nutrition(-40)
adjustToxLoss(-3)
39 changes: 38 additions & 1 deletion code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@
if(species.icon_scale_x != 1 || species.icon_scale_y != 1)
update_transform()

if(!default_colour || !species.apply_default_colours(src))
if(!default_colour)
r_skin = 0
g_skin = 0
b_skin = 0
Expand All @@ -1126,6 +1126,8 @@

species.create_organs(src)

species.apply_default_colours(src)

species.handle_post_spawn(src)

maxHealth = species.total_health
Expand Down Expand Up @@ -1687,3 +1689,38 @@
for(var/obj/item/accessory in uniform.accessories)
if(accessory.is_mob_movement_sensitive())
LAZYADD(., accessory)

/mob/living/carbon/human/empty_stomach(var/blood_vomit)
if(should_have_organ(O_STOMACH))
var/turf/dumping_loc = get_turf(src)
for(var/atom/movable/thing as anything in stomach_contents)
thing.dropInto(dumping_loc)
if(species.gluttonous & GLUT_PROJECTILE_VOMIT)
thing.throw_at(get_edge_target_turf(src,dir),7,7,src)
if(!blood_vomit && should_have_organ(O_LIVER))
var/obj/item/organ/internal/L = get_internal_organ(O_LIVER)
blood_vomit = !istype(L) || L.is_broken()
..(blood_vomit)

/mob/living/carbon/human/move_to_stomach(atom/movable/victim)
var/obj/item/organ/internal/stomach = get_internal_organ(O_STOMACH)
if(istype(stomach))
var/mob/mob_victim = victim
if(istype(mob_victim, /obj/item/holder))
mob_victim = locate(/mob) in mob_victim
if(mob_victim && victim != mob_victim)
mob_victim.forceMove(stomach)
qdel(victim)
else
victim.forceMove(stomach)

/mob/living/carbon/human/attackby(obj/item/I, mob/user)
var/user_zone_sel = user.zone_sel?.selecting
if(user == src && user_zone_sel == O_MOUTH && can_devour(I, silent = TRUE))
var/obj/item/blocked = check_mouth_coverage()
if(blocked)
to_chat(user, SPAN_WARNING("\The [blocked] is in the way!"))
return TRUE
if(devour(I))
return TRUE
return ..()
14 changes: 8 additions & 6 deletions code/modules/mob/living/carbon/human/species/outsider/vox.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
cold_level_2 = 150 //Default 200
cold_level_3 = 90 //Default 120

gluttonous = 1
gluttonous = GLUT_TINY|GLUT_ITEM_NORMAL

breath_type = "nitrogen"
poison_type = "oxygen"
Expand Down Expand Up @@ -93,6 +93,7 @@
O_KIDNEYS = /obj/item/organ/internal/kidneys/vox,
O_BRAIN = /obj/item/organ/internal/brain/vox,
O_EYES = /obj/item/organ/internal/eyes,
O_STOMACH = /obj/item/organ/internal/stomach/vox
)

genders = list(NEUTER)
Expand Down Expand Up @@ -184,12 +185,13 @@
H.b_skin = hex2num(copytext(skin_color,6,8))
var/scutes_color = "#BC7D3E"
var/obj/item/organ/external/head = H.get_organ(BP_HEAD)
head.markings = list(
"Vox Beak" = list(
"color" = scutes_color,
"datum" = body_marking_styles_list["Vox Beak"]
if(head)
head.markings = list(
"Vox Beak" = list(
"color" = scutes_color,
"datum" = body_marking_styles_list["Vox Beak"]
)
)
)
for(var/bp in list(BP_L_ARM, BP_L_HAND, BP_R_ARM, BP_R_HAND, BP_L_LEG, BP_R_LEG, BP_L_FOOT, BP_R_FOOT))
var/obj/item/organ/external/limb = H.get_organ(bp)
if(limb)
Expand Down
3 changes: 2 additions & 1 deletion code/modules/mob/living/carbon/human/species/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
var/primitive_form // Lesser form, if any (ie. monkey for humans)
var/greater_form // Greater form, if any, ie. human for monkeys.
var/holder_type
var/gluttonous // Can eat some mobs. 1 for mice, 2 for monkeys, 3 for people.
var/gluttonous = GLUT_NONE // Can eat some mobs. Values can be GLUT_TINY, GLUT_SMALLER, GLUT_ANYTHING, GLUT_ITEM_TINY, GLUT_ITEM_NORMAL, GLUT_ITEM_ANYTHING, GLUT_PROJECTILE_VOMIT
var/stomach_capacity = 5 // How much stuff they can stick in their stomach

var/rarity_value = 1 // Relative rarity/collector value for this species.
var/economic_modifier = 2 // How much money this species makes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
primitive_form = SPECIES_MONKEY_UNATHI
darksight = 3
ambiguous_genders = TRUE
gluttonous = 1
gluttonous = GLUT_TINY
slowdown = 0.5
total_health = 125
brute_mod = 0.85
Expand Down Expand Up @@ -190,7 +190,7 @@
burn_mod = 1.15
flash_mod = 1.1
metabolic_rate = 1.1
gluttonous = 1
gluttonous = GLUT_TINY
num_alternate_languages = 3
secondary_langs = list(LANGUAGE_SIIK, LANGUAGE_AKHANI, LANGUAGE_ALAI)
name_language = LANGUAGE_SIIK
Expand Down Expand Up @@ -389,7 +389,7 @@
flash_mod = 2
flash_burn = 15 //flashing a zaddat probably counts as police brutality
metabolic_rate = 0.7 //did u know if your ancestors starved ur body will actually start in starvation mode?
gluttonous = 1
gluttonous = GLUT_TINY
taste_sensitivity = TASTE_SENSITIVE
num_alternate_languages = 3
secondary_langs = list(LANGUAGE_ZADDAT, LANGUAGE_UNATHI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
pass_flags = PASSTABLE
holder_type = /obj/item/holder/human
// short_sighted = 1
gluttonous = 1
gluttonous = GLUT_TINY
blood_volume = 400
hunger_factor = 0.2
hearboost = 1 //Big heckin chonker ultragigamega-ears.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

has_fine_manipulation = 0
siemens_coefficient = 0
gluttonous = 2
gluttonous = GLUT_SMALLER

brute_mod = 0.5 // Hardened carapace.
burn_mod = 2 // Weak to fire.
Expand Down
31 changes: 4 additions & 27 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -760,33 +760,7 @@
sleep(150) //15 seconds until second warning
to_chat(src, "<span class='warning'>You feel like you are about to throw up!</span>")
sleep(100) //and you have 10 more for mad dash to the bucket

//Damaged livers cause you to vomit blood.
if(!blood_vomit)
if(ishuman(src))
var/mob/living/carbon/human/H = src
if(!H.isSynthetic())
var/obj/item/organ/internal/liver/L = H.internal_organs_by_name["liver"]
if(!L || L.is_broken())
blood_vomit = 1

Stun(5)
src.visible_message("<span class='warning'>[src] throws up!</span>","<span class='warning'>You throw up!</span>")
playsound(src, 'sound/effects/splat.ogg', 50, 1)

var/turf/simulated/T = get_turf(src) //TODO: Make add_blood_floor remove blood from human mobs
if(istype(T))
if(blood_vomit)
T.add_blood_floor(src)
else
T.add_vomit_floor(src, 1)

if(blood_vomit)
if(getBruteLoss() < 50)
adjustBruteLoss(3)
else
adjust_nutrition(-40)
adjustToxLoss(-3)
empty_stomach(blood_vomit)

spawn(350)
lastpuke = 0
Expand Down Expand Up @@ -1173,3 +1147,6 @@

/mob/living/proc/IWasAttackedBy(var/mob/living/attacker)
return

/mob/living/proc/empty_stomach()
return
3 changes: 3 additions & 0 deletions code/modules/mob/living/organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
zone = BP_HEAD
return organs_by_name[zone]

/mob/living/proc/get_internal_organ(var/zone)
return zone && internal_organs_by_name[zone]

/mob/living/gib()
for(var/path in internal_organs)
if(ispath(path))
Expand Down
5 changes: 4 additions & 1 deletion code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1265,4 +1265,7 @@
return TRUE

/mob/proc/hearing_boost_range()
return hearing_boost_range
return hearing_boost_range

/mob/proc/devour(atom/movable/victim)
return
4 changes: 2 additions & 2 deletions code/modules/mob/mob_grab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@
pin_down(affecting, assailant)

//clicking on yourself while grabbing them
if(M == assailant && state >= GRAB_AGGRESSIVE)
devour(affecting, assailant)
if(M == assailant && state >= GRAB_AGGRESSIVE && assailant.devour(affecting))
qdel(src)

/obj/item/grab/dropped()
loc = null
Expand Down
24 changes: 0 additions & 24 deletions code/modules/mob/mob_grab_specials.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,3 @@
step_to(attacker, target)
attacker.set_dir(EAST) //face the victim
target.set_dir(SOUTH) //face up

/obj/item/grab/proc/devour(mob/target, mob/user)
var/can_eat
if((FAT in user.mutations) && ismini(target))
can_eat = 1
else
var/mob/living/carbon/human/H = user
if(istype(H) && H.species.gluttonous)
if(H.species.gluttonous == 2)
can_eat = 2
else if((H.mob_size > target.mob_size) && !ishuman(target) && ismini(target))
can_eat = 1

if(can_eat)
var/mob/living/carbon/attacker = user
user.visible_message("<span class='danger'>[user] is attempting to devour [target]!</span>")
if(can_eat == 2)
if(!do_mob(user, target)||!do_after(user, 30)) return
else
if(!do_mob(user, target)||!do_after(user, 70)) return
user.visible_message("<span class='danger'>[user] devours [target]!</span>")
target.loc = user
attacker.stomach_contents.Add(target)
qdel(src)
9 changes: 1 addition & 8 deletions code/modules/mob/mob_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@
return L.mob_size <= MOB_TINY
return 0


/proc/ismini(A)
if(A && istype(A, /mob/living))
var/mob/living/L = A
return L.mob_size <= MOB_MINISCULE
return 0

/mob/living/silicon/isSynthetic()
return 1

Expand Down Expand Up @@ -683,4 +676,4 @@ var/global/image/backplane
item.screen_loc = screen_place

/mob/proc/can_feed()
return TRUE
return TRUE
5 changes: 1 addition & 4 deletions code/modules/organs/internal/heart.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@
organ_tag = O_PUMP
dead_icon = "pump-off"
robotic = ORGAN_ROBOT

standard_pulse_level = PULSE_NONE

/obj/item/organ/internal/stomach/machine/handle_organ_proc_special()
/obj/item/organ/internal/heart/machine/handle_organ_proc_special()
..()
if(owner && owner.stat != DEAD)
owner.bodytemperature += round(owner.robobody_count * 0.25, 0.1)

return
Loading