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

[MIRROR] Implements species exertion (Bay port). #302

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
40 changes: 40 additions & 0 deletions code/modules/emotes/definitions/exertion.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/decl/emote/exertion/biological
key = "esweat"
emote_range = 4
emote_message_1p = "You are sweating heavily."
emote_message_3p = "USER is sweating heavily."

/decl/emote/exertion/biological/check_user(mob/living/user)
if(istype(user) && !user.isSynthetic())
return ..()
return FALSE

/decl/emote/exertion/biological/breath
key = "ebreath"
emote_message_1p = "You feel out of breath."
emote_message_3p = "USER looks out of breath."

/decl/emote/exertion/biological/pant
key = "epant"
emote_range = 3
message_type = AUDIBLE_MESSAGE
emote_message_1p = "You pant to catch your breath."
emote_message_3p = "USER pants for air."
emote_message_impaired = "You can see USER breathing heavily."

/decl/emote/exertion/synthetic
key = "ewhine"
emote_range = 3
message_type = AUDIBLE_MESSAGE
emote_message_1p = "You overstress your actuators."
emote_message_3p = "USER's actuators whine with strain."

/decl/emote/exertion/synthetic/check_user(mob/living/user)
if(istype(user) && user.isSynthetic())
return ..()
return FALSE

/decl/emote/exertion/synthetic/creak
key = "ecreak"
emote_message_1p = "Your chassis stress indicators spike."
emote_message_3p = "USER's joints creak with stress."
10 changes: 7 additions & 3 deletions code/modules/emotes/emote_define.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
var/check_restraints // Can this emote be used while restrained?
var/check_range // falsy, or a range outside which the emote will not work
var/conscious = TRUE // Do we need to be awake to emote this?
var/emote_range // falsy, or a range outside which the emote is not shown
var/emote_range = 0 // If >0, restricts emote visibility to viewers within range.

/decl/emote/proc/get_emote_message_1p(var/atom/user, var/atom/target, var/extra_params)
if(target)
Expand Down Expand Up @@ -100,6 +100,10 @@
use_radio_message = replacetext(use_radio_message, "USER_SELF", user_gender.self)
use_radio_message = replacetext(use_radio_message, "USER", "<b>\the [user]</b>")

var/use_range = emote_range
if (!use_range)
use_range = world.view

if(ismob(user))
var/mob/M = user
if(message_type == AUDIBLE_MESSAGE)
Expand All @@ -109,9 +113,9 @@
M.visible_message(message = "[user] opens their mouth silently!", self_message = "You cannot say anything!", blind_message = emote_message_impaired, checkghosts = /datum/client_preference/ghost_sight)
return
else
M.audible_message(message = use_3p, self_message = use_1p, deaf_message = emote_message_impaired, checkghosts = /datum/client_preference/ghost_sight, radio_message = use_radio_message)
M.audible_message(message = use_3p, self_message = use_1p, deaf_message = emote_message_impaired, hearing_distance = use_range, checkghosts = /datum/client_preference/ghost_sight, radio_message = use_radio_message)
else
M.visible_message(message = use_3p, self_message = use_1p, blind_message = emote_message_impaired, checkghosts = /datum/client_preference/ghost_sight)
M.visible_message(message = use_3p, self_message = use_1p, blind_message = emote_message_impaired, range = use_range, checkghosts = /datum/client_preference/ghost_sight)

do_extra(user, target)
do_sound(user)
Expand Down
15 changes: 1 addition & 14 deletions code/modules/mob/living/carbon/human/human_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,26 +133,13 @@
/mob/living/carbon/human/Move()
. = ..()
if(.) //We moved
handle_exertion()
species.handle_exertion(src)
handle_leg_damage()

if(client)
var/turf/B = GetAbove(src)
up_hint.icon_state = "uphint[(B ? B.is_open() : 0)]"

/mob/living/carbon/human/proc/handle_exertion()
if(isSynthetic())
return
var/lac_chance = 10 * encumbrance()
if(lac_chance && prob(skill_fail_chance(SKILL_HAULING, lac_chance)))
make_reagent(1, /decl/material/liquid/lactate)
adjust_hydration(-DEFAULT_THIRST_FACTOR)
switch(rand(1,20))
if(1)
visible_message("<span class='notice'>\The [src] is sweating heavily!</span>", "<span class='notice'>You are sweating heavily!</span>")
if(2)
visible_message("<span class='notice'>\The [src] looks out of breath!</span>", "<span class='notice'>You are out of breath!</span>")

/mob/living/carbon/human/proc/handle_leg_damage()
if(!can_feel_pain())
return
Expand Down
14 changes: 14 additions & 0 deletions code/modules/species/outsider/random.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,21 @@
TAG_CULTURE = CULTURE_ALIUM
)

<<<<<<< HEAD
/datum/species/alium/New()
=======
exertion_effect_chance = 10
exertion_hydration_scale = 1
exertion_reagent_scale = 5
exertion_reagent_path = /decl/material/liquid/lactate
exertion_emotes_biological = list(
/decl/emote/exertion/biological,
/decl/emote/exertion/biological/breath,
/decl/emote/exertion/biological/pant
)

/decl/species/alium/New()
>>>>>>> 32507afb38... Merge pull request #1051 from MistakeNot4892/species-exertion
//Coloring
blood_color = RANDOM_RGB
flesh_color = RANDOM_RGB
Expand Down
32 changes: 32 additions & 0 deletions code/modules/species/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@

var/datum/ai/ai // Type abused. Define with path and will automagically create. Determines behaviour for clientless mobs. This will override mob AIs.

var/exertion_effect_chance = 0
var/exertion_hydration_scale = 0
var/exertion_nutrition_scale = 0
var/exertion_charge_scale = 0
var/exertion_reagent_scale = 0
var/exertion_reagent_path = null
var/list/exertion_emotes_biological = null
var/list/exertion_emotes_synthetic = null
/*
These are all the things that can be adjusted for equipping stuff and
each one can be in the NORTH, SOUTH, EAST, and WEST direction. Specify
Expand Down Expand Up @@ -844,3 +852,27 @@ The slots that you can use are found in items_clothing.dm and are the inventory
// This assumes that if a pain-level has been defined it also has a list of emotes to go with it
var/decl/emote/E = decls_repository.get_decl(pick(pain_emotes))
return E.key

/decl/species/proc/handle_exertion(mob/living/carbon/human/H)
if (!exertion_effect_chance)
return
var/chance = exertion_effect_chance * H.encumbrance()
if (chance && prob(H.skill_fail_chance(SKILL_HAULING, chance)))
var/synthetic = H.isSynthetic()
if (synthetic)
if (exertion_charge_scale)
var/obj/item/organ/internal/cell/cell = locate() in H.internal_organs
if (cell)
cell.use(cell.get_power_drain() * exertion_charge_scale)
else
if (exertion_hydration_scale)
H.adjust_hydration(-DEFAULT_THIRST_FACTOR * exertion_hydration_scale)
if (exertion_nutrition_scale)
H.adjust_nutrition(-DEFAULT_HUNGER_FACTOR * exertion_nutrition_scale)
if (exertion_reagent_scale && !isnull(exertion_reagent_path))
H.make_reagent(REM * exertion_reagent_scale, exertion_reagent_path)
if (prob(10))
var/list/active_emotes = synthetic ? exertion_emotes_synthetic : exertion_emotes_biological
if(length(active_emotes))
var/decl/emote/exertion_emote = decls_repository.get_decl(pick(active_emotes))
exertion_emote.do_emote(H)
19 changes: 19 additions & 0 deletions code/modules/species/station/station.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,26 @@
)
)

<<<<<<< HEAD
/datum/species/human/get_root_species_name(var/mob/living/carbon/human/H)
=======
exertion_effect_chance = 10
exertion_hydration_scale = 1
exertion_charge_scale = 1
exertion_reagent_scale = 5
exertion_reagent_path = /decl/material/liquid/lactate
exertion_emotes_biological = list(
/decl/emote/exertion/biological,
/decl/emote/exertion/biological/breath,
/decl/emote/exertion/biological/pant
)
exertion_emotes_synthetic = list(
/decl/emote/exertion/synthetic,
/decl/emote/exertion/synthetic/creak
)

/decl/species/human/get_root_species_name(var/mob/living/carbon/human/H)
>>>>>>> 32507afb38... Merge pull request #1051 from MistakeNot4892/species-exertion
return SPECIES_HUMAN

/datum/species/human/get_ssd(var/mob/living/carbon/human/H)
Expand Down
11 changes: 11 additions & 0 deletions code/modules/species/station/utility_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@
BP_EYES = /obj/item/organ/internal/eyes/robot
)

<<<<<<< HEAD:code/modules/species/station/utility_frame.dm
/datum/species/utility_frame/post_organ_rejuvenate(obj/item/organ/org, mob/living/carbon/human/H)
=======
exertion_effect_chance = 10
exertion_charge_scale = 1
exertion_emotes_synthetic = list(
/decl/emote/exertion/synthetic,
/decl/emote/exertion/synthetic/creak
)

/decl/species/utility_frame/post_organ_rejuvenate(obj/item/organ/org, mob/living/carbon/human/H)
>>>>>>> 32507afb38... Merge pull request #1051 from MistakeNot4892/species-exertion:mods/utility_frames/species.dm
var/obj/item/organ/external/E = org
if(istype(E) && !BP_IS_PROSTHETIC(E))
E.robotize("Utility Frame")
Expand Down
1 change: 1 addition & 0 deletions nebula.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,7 @@
#include "code\modules\emotes\definitions\_mob.dm"
#include "code\modules\emotes\definitions\_species.dm"
#include "code\modules\emotes\definitions\audible.dm"
#include "code\modules\emotes\definitions\exertion.dm"
#include "code\modules\emotes\definitions\human.dm"
#include "code\modules\emotes\definitions\slime.dm"
#include "code\modules\emotes\definitions\synthetics.dm"
Expand Down