Skip to content

Commit

Permalink
Brings the monkey back down (body horror edition/addition.) (tgstatio…
Browse files Browse the repository at this point in the history
…n#73325)

## About The Pull Request
Let me paint you a story.
A long time ago monkeys once rested their feet on the floor, this was a
time of bliss and peace. But sometime around the horrors of making
monkeys subtypes of humans did an atrocity occur.

![image](https://user-images.githubusercontent.com/55666666/217657059-5c960ab4-c3de-493c-ac12-28de99b43d7f.png)
**The monkeys were moved up.**
I thought this was bad, and alot of people on the forum tended to agree
with me

![image](https://user-images.githubusercontent.com/55666666/217657707-120354c7-b1a5-4d93-8813-8e10e142bd92.png)
This was do to some purpose of adjusting them so it could be easier to
fit item sprites onto them instead of preforming the hours of work
refractoring to make the heights of the items dynamic and adjustable. A
simple pixel shift may have sufficed, but you see, such a change would
NEVER allow the frankensteining of monkey and human features together.
This is that refractor.

In essence, the following is now true.
A top_offset can now be generated for a human based on a varible on
their chest and legs. By default, and as is true with human legs and
chests, this variable is ZERO by default. Monkey legs and chest have
NEGATIVE values proportionate and onto how much smaller their sprite is
compared to humans. Other bodyparts, as well as any other accociated
overlays, or clothing will automatically be offset to this axis. THIS
MEANS THAT MONKEYS ARE ON THE FLOOR. But is means something else too.
Something more freakish,


![image](https://user-images.githubusercontent.com/55666666/217659439-bc0b1a35-76c8-4490-b869-770180605822.png)
**What abominable monsters**, unreachable by players as long as we can't
stitch monkeys and humans together (oh but just wait until the feature
freeze ends)
Oh but you might be thinking, if legs can make a mob go down.
can it make a mob

**go**
**up??**

**OH NO**


![image](https://user-images.githubusercontent.com/55666666/217707042-0d53022f-d93a-4262-a5ce-ef15a99eb897.png)

![image](https://user-images.githubusercontent.com/55666666/217707060-779f5901-ab90-4a64-9ca7-0b147e24f099.png)

![image](https://user-images.githubusercontent.com/55666666/217707821-23d7457c-5881-40ae-8d9d-c9fbd645aba6.png)

These lads are stepping, and have been implemented solely for proof of
concept as a way to flex the system I have created and remain
inaccessible without admin intervention.

But really, when all is said and done, all this PR does in terms of
player facing changes is move the monkey back down.

![image](https://user-images.githubusercontent.com/55666666/217708365-b6922a6d-08d0-4267-8713-4f8dac29038e.png)
Oh and fixed monkey husked which have been broken for who knows how
long.

![image](https://user-images.githubusercontent.com/55666666/217708464-5a9b6f89-4223-4ae5-a21e-3a274a9f8db8.png)
## Why It's Good For The Game
The monkey is restored to its original position. Tools now exist to have
legs and torsos of varying heights. Monkey Husking is fixed.
## Changelog
:cl: itseasytosee
fix: Monkeys ues the proper husk sprites.
imageadd: The monkey has been moved back down to its lower, more
submissive position.
refactor: Your bodyparts are now dynamically rendered at a height
relevant to the length of your legs and torso, what does this mean for
you? Not much to be honest, but you might see a monkey pop up a bit if
you cut its legs off.
admin: The Tallboy is here
/:cl:

---------

Co-authored-by: Fikou <[email protected]>
Co-authored-by: san7890 <[email protected]>
  • Loading branch information
3 people authored Feb 27, 2023
1 parent 20ac6d5 commit 8ab7452
Show file tree
Hide file tree
Showing 21 changed files with 146 additions and 6 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,16 @@
#define SPECIES_LIZARD_SILVER "silverscale"
#define SPECIES_NIGHTMARE "nightmare"
#define SPECIES_MONKEY "monkey"
#define SPECIES_MONKEY_FREAK "monkey_freak"
#define SPECIES_MONKEY_HUMAN_LEGGED "monkey_human_legged"
#define SPECIES_MOTH "moth"
#define SPECIES_MUSHROOM "mush"
#define SPECIES_PLASMAMAN "plasmaman"
#define SPECIES_PODPERSON "pod"
#define SPECIES_SHADOW "shadow"
#define SPECIES_SKELETON "skeleton"
#define SPECIES_SNAIL "snail"
#define SPECIES_TALLBOY "tallboy"
#define SPECIES_VAMPIRE "vampire"
#define SPECIES_ZOMBIE "zombie"
#define SPECIES_ZOMBIE_INFECTIOUS "memezombie"
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/carbon_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,7 @@
/// Only load in visual organs
var/visual_only_organs = FALSE

/// Stores the result of our last known top_offset generation for optimisation purposes when drawing limb icons.
var/last_top_offset

COOLDOWN_DECLARE(bleeding_message_cd)
22 changes: 20 additions & 2 deletions code/modules/mob/living/carbon/carbon_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@
var/old_key = icon_render_keys?[limb.body_zone] //Checks the mob's icon render key list for the bodypart
icon_render_keys[limb.body_zone] = (limb.is_husked) ? limb.generate_husk_key().Join() : limb.generate_icon_key().Join() //Generates a key for the current bodypart

if(icon_render_keys[limb.body_zone] != old_key) //If the keys match, that means the limb doesn't need to be redrawn
if(icon_render_keys[limb.body_zone] != old_key || get_top_offset() != last_top_offset) //If the keys match, that means the limb doesn't need to be redrawn
needs_update += limb

var/list/missing_bodyparts = get_missing_limbs()
Expand All @@ -484,12 +484,18 @@
//GENERATE NEW LIMBS
var/list/new_limbs = list()
for(var/obj/item/bodypart/limb as anything in bodyparts)
if(limb in needs_update) //Checks to see if the limb needs to be redrawn
if(limb in needs_update)
var/bodypart_icon = limb.get_limb_icon()
if(!istype(limb, /obj/item/bodypart/leg))
var/top_offset = get_top_offset()
for(var/image/image as anything in bodypart_icon)
image.pixel_y += top_offset
new_limbs += bodypart_icon
limb_icon_cache[icon_render_keys[limb.body_zone]] = bodypart_icon //Caches the icon with the bodypart key, as it is new
else
new_limbs += limb_icon_cache[icon_render_keys[limb.body_zone]] //Pulls existing sprites from the cache
last_top_offset = get_top_offset()


remove_overlay(BODYPARTS_LAYER)

Expand All @@ -498,6 +504,18 @@

apply_overlay(BODYPARTS_LAYER)

/// This looks at the chest and legs of the mob and decides how much our chest, arms, and head should be adjusted. This is useful for limbs that are larger or smaller than the scope of normal human height while keeping the feet anchored to the bottom of the tile
/mob/living/carbon/proc/get_top_offset()
var/from_chest
var/from_leg
for(var/obj/item/bodypart/leg/leg_checked in bodyparts)
if(leg_checked.top_offset > from_leg || isnull(from_leg)) // We find the tallest leg available
from_leg = leg_checked.top_offset
if(isnull(from_leg))
from_leg = 0 // If we have no legs, we set this to zero to avoid any math issues that might stem from it being NULL
for(var/obj/item/bodypart/chest/chest_checked in bodyparts) // Take the height from the chest
from_chest = chest_checked.top_offset
return (from_chest + from_leg) // The total hight of the chest and legs together

/////////////////////////
// Limb Icon Cache 2.0 //
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/human/human_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,9 @@ generate/load female uniform sprites matching all previously decided variables
.[2] = offsets["y"]
else
.[2] = worn_y_offset
if(ishuman(loc) && slot_flags != ITEM_SLOT_FEET) /// we adjust the human body for high given by body parts, execpt shoes, because they are always on the bottom
var/mob/living/carbon/human/human_holder = loc
.[2] += human_holder.get_top_offset()

//Can't think of a better way to do this, sadly
/mob/proc/get_item_offsets_for_index(i)
Expand Down
18 changes: 15 additions & 3 deletions code/modules/mob/living/carbon/human/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
*/
/datum/species/proc/handle_body(mob/living/carbon/human/species_human)
species_human.remove_overlay(BODY_LAYER)
var/height_offset = species_human.get_top_offset() // From high changed by varying limb height
if(HAS_TRAIT(species_human, TRAIT_INVISIBLE_MAN))
return handle_mutant_bodyparts(species_human)
var/list/standing = list()
Expand All @@ -557,6 +558,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
if(OFFSET_FACE in species_human.dna.species.offset_features)
lip_overlay.pixel_x += species_human.dna.species.offset_features[OFFSET_FACE][1]
lip_overlay.pixel_y += species_human.dna.species.offset_features[OFFSET_FACE][2]
lip_overlay.pixel_y += height_offset
standing += lip_overlay

// eyes
Expand All @@ -572,6 +574,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
if(OFFSET_FACE in species_human.dna.species.offset_features)
add_pixel_x = species_human.dna.species.offset_features[OFFSET_FACE][1]
add_pixel_y = species_human.dna.species.offset_features[OFFSET_FACE][2]
add_pixel_y += height_offset

if(!eye_organ)
no_eyeslay = mutable_appearance('icons/mob/species/human/human_face.dmi', "eyes_missing", -BODY_LAYER)
Expand All @@ -582,7 +585,8 @@ GLOBAL_LIST_EMPTY(features_by_species)
eye_organ.refresh(call_update = FALSE)

if(!no_eyeslay)
for(var/eye_overlay in eye_organ.generate_body_overlay(species_human))
for(var/mutable_appearance/eye_overlay in eye_organ.generate_body_overlay(species_human))
eye_overlay.pixel_y += height_offset
standing += eye_overlay

// organic body markings
Expand All @@ -597,18 +601,22 @@ GLOBAL_LIST_EMPTY(features_by_species)
if(!HAS_TRAIT(species_human, TRAIT_HUSK))
if(noggin && (IS_ORGANIC_LIMB(noggin)))
var/mutable_appearance/markings_head_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_head", -BODY_LAYER)
markings_head_overlay.pixel_y += height_offset
standing += markings_head_overlay

if(chest && (IS_ORGANIC_LIMB(chest)))
var/mutable_appearance/markings_chest_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_chest", -BODY_LAYER)
markings_chest_overlay.pixel_y += height_offset
standing += markings_chest_overlay

if(right_arm && (IS_ORGANIC_LIMB(right_arm)))
var/mutable_appearance/markings_r_arm_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_r_arm", -BODY_LAYER)
markings_r_arm_overlay.pixel_y += height_offset
standing += markings_r_arm_overlay

if(left_arm && (IS_ORGANIC_LIMB(left_arm)))
var/mutable_appearance/markings_l_arm_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_l_arm", -BODY_LAYER)
markings_l_arm_overlay.pixel_y += height_offset
standing += markings_l_arm_overlay

if(right_leg && (IS_ORGANIC_LIMB(right_leg)))
Expand All @@ -631,15 +639,19 @@ GLOBAL_LIST_EMPTY(features_by_species)
underwear_overlay = mutable_appearance(underwear.icon, underwear.icon_state, -BODY_LAYER)
if(!underwear.use_static)
underwear_overlay.color = species_human.underwear_color
underwear_overlay.pixel_y += height_offset
standing += underwear_overlay

if(species_human.undershirt)
var/datum/sprite_accessory/undershirt/undershirt = GLOB.undershirt_list[species_human.undershirt]
if(undershirt)
var/mutable_appearance/working_shirt
if(species_human.dna.species.sexes && species_human.physique == FEMALE)
standing += wear_female_version(undershirt.icon_state, undershirt.icon, BODY_LAYER)
working_shirt = wear_female_version(undershirt.icon_state, undershirt.icon, BODY_LAYER)
else
standing += mutable_appearance(undershirt.icon, undershirt.icon_state, -BODY_LAYER)
working_shirt = mutable_appearance(undershirt.icon, undershirt.icon_state, -BODY_LAYER)
working_shirt.pixel_y += height_offset
standing += working_shirt

if(species_human.socks && species_human.num_legs >= 2 && !(src.bodytype & BODYTYPE_DIGITIGRADE))
var/datum/sprite_accessory/socks/socks = GLOB.socks_list[species_human.socks]
Expand Down
43 changes: 43 additions & 0 deletions code/modules/mob/living/carbon/human/species_types/abominations.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/// These won't appear normally in games, they are meant to for debuging the adjustment of limbs based on the height of a humans bodyparts.
/datum/species/human/tallboy
name = "\improper Tall Boy"
id = SPECIES_TALLBOY
bodypart_overrides = list(
BODY_ZONE_L_ARM = /obj/item/bodypart/arm/left,
BODY_ZONE_R_ARM = /obj/item/bodypart/arm/right,
BODY_ZONE_HEAD = /obj/item/bodypart/head,
BODY_ZONE_L_LEG = /obj/item/bodypart/leg/left/tallboy,
BODY_ZONE_R_LEG = /obj/item/bodypart/leg/right/tallboy,
BODY_ZONE_CHEST = /obj/item/bodypart/chest,
)

/datum/species/monkey/human_legged
id = SPECIES_MONKEY_HUMAN_LEGGED
bodypart_overrides = list(
BODY_ZONE_L_ARM = /obj/item/bodypart/arm/left/monkey,
BODY_ZONE_R_ARM = /obj/item/bodypart/arm/right/monkey,
BODY_ZONE_HEAD = /obj/item/bodypart/head/monkey,
BODY_ZONE_L_LEG = /obj/item/bodypart/leg/left,
BODY_ZONE_R_LEG = /obj/item/bodypart/leg/right,
BODY_ZONE_CHEST = /obj/item/bodypart/chest/monkey,
)

/datum/species/monkey/monkey_freak
id = SPECIES_MONKEY_FREAK
bodypart_overrides = list(
BODY_ZONE_L_ARM = /obj/item/bodypart/arm/left,
BODY_ZONE_R_ARM = /obj/item/bodypart/arm/right,
BODY_ZONE_HEAD = /obj/item/bodypart/head/monkey,
BODY_ZONE_L_LEG = /obj/item/bodypart/leg/left/monkey,
BODY_ZONE_R_LEG = /obj/item/bodypart/leg/right/monkey,
BODY_ZONE_CHEST = /obj/item/bodypart/chest,
)

/mob/living/carbon/human/species/monkey/humand_legged
race = /datum/species/monkey/human_legged

/mob/living/carbon/human/species/monkey/monkey_freak
race = /datum/species/monkey/monkey_freak

/mob/living/carbon/human/species/tallboy
race = /datum/species/human/tallboy
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@
))

return to_add

2 changes: 2 additions & 0 deletions code/modules/surgery/bodyparts/_bodyparts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@
var/unarmed_damage_high = 1
///Damage at which attacks from this bodypart will stun
var/unarmed_stun_threshold = 2
/// How many pixels this bodypart will offset the top half of the mob, used for abnormally sized torsos and legs
var/top_offset = 0

/// Traits that are given to the holder of the part. If you want an effect that changes this, don't add directly to this. Use the add_bodypart_trait() proc
var/list/bodypart_traits = list()
Expand Down
3 changes: 3 additions & 0 deletions code/modules/surgery/bodyparts/head.dm
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@

/obj/item/bodypart/head/monkey
icon = 'icons/mob/species/monkey/bodyparts.dmi'
icon_static = 'icons/mob/species/monkey/bodyparts.dmi'
icon_husk = 'icons/mob/species/monkey/bodyparts.dmi'
husk_type = "monkey"
icon_state = "default_monkey_head"
limb_id = SPECIES_MONKEY
bodytype = BODYTYPE_MONKEY | BODYTYPE_ORGANIC
Expand Down
27 changes: 26 additions & 1 deletion code/modules/surgery/bodyparts/parts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@
/obj/item/bodypart/chest/monkey
icon = 'icons/mob/species/monkey/bodyparts.dmi'
icon_static = 'icons/mob/species/monkey/bodyparts.dmi'
icon_husk = 'icons/mob/species/monkey/bodyparts.dmi'
husk_type = "monkey"
top_offset = -5
icon_state = "default_monkey_chest"
limb_id = SPECIES_MONKEY
should_draw_greyscale = FALSE
is_dimorphic = FALSE
wound_resistance = -10
bodytype = BODYTYPE_MONKEY | BODYTYPE_ORGANIC
acceptable_bodytype = BODYTYPE_MONKEY
acceptable_bodytype = BODYTYPE_HUMANOID
dmg_overlay_type = SPECIES_MONKEY

/obj/item/bodypart/chest/alien
Expand Down Expand Up @@ -162,6 +165,8 @@
/obj/item/bodypart/arm/left/monkey
icon = 'icons/mob/species/monkey/bodyparts.dmi'
icon_static = 'icons/mob/species/monkey/bodyparts.dmi'
icon_husk = 'icons/mob/species/monkey/bodyparts.dmi'
husk_type = "monkey"
icon_state = "default_monkey_l_arm"
limb_id = SPECIES_MONKEY
should_draw_greyscale = FALSE
Expand Down Expand Up @@ -263,6 +268,8 @@
/obj/item/bodypart/arm/right/monkey
icon = 'icons/mob/species/monkey/bodyparts.dmi'
icon_static = 'icons/mob/species/monkey/bodyparts.dmi'
icon_husk = 'icons/mob/species/monkey/bodyparts.dmi'
husk_type = "monkey"
icon_state = "default_monkey_r_arm"
limb_id = SPECIES_MONKEY
bodytype = BODYTYPE_MONKEY | BODYTYPE_ORGANIC
Expand Down Expand Up @@ -370,6 +377,9 @@
/obj/item/bodypart/leg/left/monkey
icon = 'icons/mob/species/monkey/bodyparts.dmi'
icon_static = 'icons/mob/species/monkey/bodyparts.dmi'
icon_husk = 'icons/mob/species/monkey/bodyparts.dmi'
husk_type = "monkey"
top_offset = -3
icon_state = "default_monkey_l_leg"
limb_id = SPECIES_MONKEY
should_draw_greyscale = FALSE
Expand Down Expand Up @@ -461,6 +471,9 @@
/obj/item/bodypart/leg/right/monkey
icon = 'icons/mob/species/monkey/bodyparts.dmi'
icon_static = 'icons/mob/species/monkey/bodyparts.dmi'
icon_husk = 'icons/mob/species/monkey/bodyparts.dmi'
husk_type = "monkey"
top_offset = -3
icon_state = "default_monkey_r_leg"
limb_id = SPECIES_MONKEY
should_draw_greyscale = FALSE
Expand All @@ -484,3 +497,15 @@
can_be_disabled = FALSE
max_damage = 100
should_draw_greyscale = FALSE

/obj/item/bodypart/leg/right/tallboy
limb_id = SPECIES_TALLBOY
top_offset = 23
unarmed_damage_low = 30
unarmed_damage_low = 50

/obj/item/bodypart/leg/left/tallboy
limb_id = SPECIES_TALLBOY
top_offset = 23
unarmed_damage_low = 30
unarmed_damage_low = 50
26 changes: 26 additions & 0 deletions code/modules/unit_tests/limbsanity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,29 @@
TEST_FAIL("[path] does not have a valid icon for female variants")
else if(!icon_exists(UNLINT(part.should_draw_greyscale ? part.icon_greyscale : part.icon_static), "[part.limb_id]_[part.body_zone]"))
TEST_FAIL("[path] does not have a valid icon")

/// Tests the height adjustment system which dynamically changes how much the chest, head, and arms of a carbon are adjusted upwards or downwards based on the length of their legs and chest.
/datum/unit_test/limb_height_adjustment

/datum/unit_test/limb_height_adjustment/Run()
var/mob/living/carbon/human/john_doe = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/species/monkey/monkey = allocate(/mob/living/carbon/human/species/monkey)
var/mob/living/carbon/human/tallboy = allocate(/mob/living/carbon/human/consistent)

tallboy.set_species(/datum/species/human/tallboy)
TEST_ASSERT_EQUAL(john_doe.get_top_offset(), 0, "John Doe found to have a top offset other than zero.")
TEST_ASSERT_EQUAL(monkey.get_top_offset(), -8, "Monkey found to have a top offset other than -8.")
TEST_ASSERT_EQUAL(tallboy.get_top_offset(), 23, "Tallboy human varient found to have a top offset other than 23.")


var/obj/item/bodypart/leg/left/monkey/left_monky_leg = allocate(/obj/item/bodypart/leg/left/monkey)
var/obj/item/bodypart/leg/right/monkey/right_monky_leg = allocate(/obj/item/bodypart/leg/right/monkey)

left_monky_leg.replace_limb(john_doe, TRUE)

TEST_ASSERT_EQUAL(john_doe.get_top_offset(), 0, "John Doe has a top offset other than 0 with one human leg and one monkey leg.")

right_monky_leg.replace_limb(john_doe, TRUE)

TEST_ASSERT_EQUAL(john_doe.get_top_offset(), -3, "John Doe has a top offset other than -3 with two monkey legs.")

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/mob/effects/dam_mob.dmi
Binary file not shown.
Binary file modified icons/mob/effects/onfire.dmi
Binary file not shown.
Binary file modified icons/mob/species/human/bodyparts.dmi
Binary file not shown.
Binary file modified icons/mob/species/human/bodyparts_greyscale.dmi
Binary file not shown.
Binary file modified icons/mob/species/monkey/bodyparts.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3889,6 +3889,7 @@
#include "code\modules\mob\living\carbon\human\suicides.dm"
#include "code\modules\mob\living\carbon\human\monkey\monkey.dm"
#include "code\modules\mob\living\carbon\human\species_types\abductors.dm"
#include "code\modules\mob\living\carbon\human\species_types\abominations.dm"
#include "code\modules\mob\living\carbon\human\species_types\android.dm"
#include "code\modules\mob\living\carbon\human\species_types\dullahan.dm"
#include "code\modules\mob\living\carbon\human\species_types\ethereal.dm"
Expand Down

0 comments on commit 8ab7452

Please sign in to comment.