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

[PORT] Footprint Sprites are BASED (on shoes and legs) #1304

Merged
merged 4 commits into from
Feb 27, 2024
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
5 changes: 5 additions & 0 deletions code/__DEFINES/cleaning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@
#define CLEAN_SCRUB (CLEAN_WASH | CLEAN_TYPE_FINGERPRINTS | CLEAN_TYPE_FIBERS | CLEAN_TYPE_HARD_DECAL)
#define CLEAN_RAD CLEAN_TYPE_RADIATION
#define CLEAN_ALL ALL

// Footprint sprites to use when making footprints in blood, oil, etc.
#define FOOTPRINT_SPRITE_SHOES "shoes"
#define FOOTPRINT_SPRITE_PAWS "paws"
#define FOOTPRINT_SPRITE_CLAWS "claws"
19 changes: 11 additions & 8 deletions code/datums/components/bloodysoles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
/// The world.time when we last picked up blood
var/last_pickup

var/footprint_sprite = FOOTPRINT_SPRITE_SHOES

/datum/component/bloodysoles/Initialize()
if(!isclothing(parent))
return COMPONENT_INCOMPATIBLE
Expand Down Expand Up @@ -100,9 +102,9 @@
/**
* Find a blood decal on a turf that matches our last_blood_state
*/
/datum/component/bloodysoles/proc/find_pool_by_blood_state(turf/turfLoc, typeFilter = null)
/datum/component/bloodysoles/proc/find_pool_by_blood_state(turf/turfLoc, typeFilter = null, footprint_sprite)
for(var/obj/effect/decal/cleanable/blood/pool in turfLoc)
if(pool.blood_state == last_blood_state && (!typeFilter || istype(pool, typeFilter)))
if(pool.blood_state == last_blood_state && pool.footprint_sprite == footprint_sprite && (!typeFilter || istype(pool, typeFilter)))
return pool

/**
Expand Down Expand Up @@ -158,23 +160,23 @@
return

var/half_our_blood = bloody_shoes[last_blood_state] / 2

var/footprint_sprite = wielder.get_footprint_sprite()
// Add footprints in old loc if we have enough cream
if(half_our_blood >= BLOOD_FOOTPRINTS_MIN)
var/turf/oldLocTurf = get_turf(OldLoc)
var/obj/effect/decal/cleanable/blood/footprints/oldLocFP = find_pool_by_blood_state(oldLocTurf, /obj/effect/decal/cleanable/blood/footprints)
var/obj/effect/decal/cleanable/blood/footprints/oldLocFP = find_pool_by_blood_state(oldLocTurf, /obj/effect/decal/cleanable/blood/footprints, footprint_sprite)
if(oldLocFP)
// Footprints found in the tile we left, add us to it
add_parent_to_footprint(oldLocFP)
if (!(oldLocFP.exited_dirs & wielder.dir))
oldLocFP.exited_dirs |= wielder.dir
oldLocFP.update_appearance()
else if(find_pool_by_blood_state(oldLocTurf))
else if(find_pool_by_blood_state(oldLocTurf, footprint_sprite = footprint_sprite))
// No footprints in the tile we left, but there was some other blood pool there. Add exit footprints on it
adjust_bloody_shoes(last_blood_state, half_our_blood)
update_icon()

oldLocFP = new(oldLocTurf)
oldLocFP = new(oldLocTurf, footprint_sprite)
if(!QDELETED(oldLocFP)) ///prints merged
oldLocFP.blood_state = last_blood_state
oldLocFP.exited_dirs |= wielder.dir
Expand All @@ -194,7 +196,7 @@
adjust_bloody_shoes(last_blood_state, half_our_blood)
update_icon()

var/obj/effect/decal/cleanable/blood/footprints/FP = new(get_turf(parent_atom))
var/obj/effect/decal/cleanable/blood/footprints/FP = new(get_turf(parent_atom), footprint_sprite)
if(!QDELETED(FP)) ///prints merged
FP.blood_state = last_blood_state
FP.entered_dirs |= wielder.dir
Expand Down Expand Up @@ -253,7 +255,8 @@
return COMPONENT_INCOMPATIBLE
parent_atom = parent
wielder = parent

if(footprint_sprite)
src.footprint_sprite = footprint_sprite
if(!bloody_feet)
bloody_feet = mutable_appearance('icons/effects/blood.dmi', "shoeblood", SHOES_LAYER)

Expand Down
43 changes: 32 additions & 11 deletions code/game/objects/effects/decals/cleanable/humans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
var/drydesc = "Looks like it's been here a while. Eew." //as above
var/drytime = 0
var/count = 0
var/footprint_sprite = null

/obj/effect/decal/cleanable/blood/Initialize(mapload)
. = ..()
Expand Down Expand Up @@ -232,7 +233,7 @@
name = "footprints"
desc = "WHOSE FOOTPRINTS ARE THESE?"
icon = 'icons/effects/footprints.dmi'
icon_state = "blood1"
icon_state = "blood_shoes_enter"
random_icon_states = null
blood_state = BLOOD_STATE_HUMAN //the icon state to load images from
var/entered_dirs = 0
Expand All @@ -247,12 +248,13 @@
dryname = "dried footprints"
drydesc = "HMM... SOMEONE WAS HERE!"

/obj/effect/decal/cleanable/blood/footprints/Initialize(mapload)
/obj/effect/decal/cleanable/blood/footprints/Initialize(mapload, footprint_sprite)
src.footprint_sprite = footprint_sprite
. = ..()
icon_state = "" //All of the footprint visuals come from overlays
if(mapload)
entered_dirs |= dir //Keep the same appearance as in the map editor
update_appearance()
update_appearance(mapload ? (ALL) : (UPDATE_NAME | UPDATE_DESC))

//Rotate all of the footprint directions too
/obj/effect/decal/cleanable/blood/footprints/setDir(newdir)
Expand All @@ -274,6 +276,21 @@
update_appearance()
return ..()

/obj/effect/decal/cleanable/blood/footprints/update_name(updates)
switch(footprint_sprite)
if(FOOTPRINT_SPRITE_CLAWS)
name = "clawprints"
if(FOOTPRINT_SPRITE_SHOES)
name = "footprints"
if(FOOTPRINT_SPRITE_PAWS)
name = "pawprints"
dryname = "dried [name]"
return ..()

/obj/effect/decal/cleanable/blood/footprints/update_desc(updates)
desc = "WHOSE [uppertext(name)] ARE THESE?"
return ..()

/obj/effect/decal/cleanable/blood/footprints/update_icon()
. = ..()
alpha = min(BLOODY_FOOTPRINT_BASE_ALPHA + (255 - BLOODY_FOOTPRINT_BASE_ALPHA) * bloodiness / (BLOOD_ITEM_MAX / 2), 255)
Expand All @@ -288,22 +305,22 @@ GLOBAL_LIST_EMPTY(bloody_footprints_cache)
. = ..()
for(var/Ddir in GLOB.cardinals)
if(entered_dirs & Ddir)
var/image/bloodstep_overlay = GLOB.bloody_footprints_cache["entered-[blood_state]-[Ddir]"]
var/image/bloodstep_overlay = GLOB.bloody_footprints_cache["entered-[footprint_sprite]-[blood_state]-[Ddir]"]
if(!bloodstep_overlay)
GLOB.bloody_footprints_cache["entered-[blood_state]-[Ddir]"] = bloodstep_overlay = image(icon, "[blood_state]1", dir = Ddir)
GLOB.bloody_footprints_cache["entered-[footprint_sprite]-[blood_state]-[Ddir]"] = bloodstep_overlay = image(icon, "[blood_state]_[footprint_sprite]_enter", dir = Ddir)
. += bloodstep_overlay

if(exited_dirs & Ddir)
var/image/bloodstep_overlay = GLOB.bloody_footprints_cache["exited-[blood_state]-[Ddir]"]
var/image/bloodstep_overlay = GLOB.bloody_footprints_cache["exited-[footprint_sprite]-[blood_state]-[Ddir]"]
if(!bloodstep_overlay)
GLOB.bloody_footprints_cache["exited-[blood_state]-[Ddir]"] = bloodstep_overlay = image(icon, "[blood_state]2", dir = Ddir)
GLOB.bloody_footprints_cache["exited-[footprint_sprite]-[blood_state]-[Ddir]"] = bloodstep_overlay = image(icon, "[blood_state]_[footprint_sprite]_exit", dir = Ddir)
. += bloodstep_overlay


/obj/effect/decal/cleanable/blood/footprints/examine(mob/user)
. = ..()
if((shoe_types.len + species_types.len) > 0)
. += "You recognise the footprints as belonging to:"
. += "You recognise the [name] as belonging to:"
for(var/sole in shoe_types)
var/obj/item/clothing/item = sole
var/article = initial(item.gender) == PLURAL ? "Some" : "A"
Expand All @@ -313,14 +330,18 @@ GLOBAL_LIST_EMPTY(bloody_footprints_cache)
if(species == "unknown")
. += "Some <B>feet</B>."
else if(species == SPECIES_MONKEY)
. += "[icon2html('icons/mob/species/human/human.dmi', user, "monkey")] Some <B>monkey feet</B>."
. += "[icon2html('icons/mob/species/human/human.dmi', user, "monkey")] Some <B>monkey paws</B>."
else if(species == SPECIES_SIMIAN)
. += "[icon2html('monkestation/icons/mob/species/simian/bodyparts.dmi', user, "simian_l_leg")] Some <B>simian paws</B>."
else if(species == SPECIES_LIZARD)
. += "[icon2html('icons/mob/species/lizard/bodyparts.dmi', user, "digitigrade_l_leg")] Some <B>lizard claws</B>."
else if(species == SPECIES_HUMAN)
. += "[icon2html('icons/mob/species/human/bodyparts.dmi', user, "default_human_l_leg")] Some <B>human feet</B>."
else
. += "[icon2html('icons/mob/species/human/bodyparts.dmi', user, "[species]_l_leg")] Some <B>[species] feet</B>."

/obj/effect/decal/cleanable/blood/footprints/replace_decal(obj/effect/decal/cleanable/C)
if(blood_state != C.blood_state) //We only replace footprints of the same type as us
/obj/effect/decal/cleanable/blood/footprints/replace_decal(obj/effect/decal/cleanable/blood/blood_decal)
if(blood_state != blood_decal.blood_state || footprint_sprite != blood_decal.footprint_sprite) //We only replace footprints of the same type as us
return FALSE
return ..()

Expand Down
1 change: 1 addition & 0 deletions code/modules/clothing/shoes/_shoes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var/lace_time = 5 SECONDS
///An active alert
var/datum/weakref/our_alert_ref
var/footprint_sprite = FOOTPRINT_SPRITE_SHOES

/datum/armor/clothing_shoes
bio = 50
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,9 @@
/proc/cmp_organ_slot_asc(slot_a, slot_b)
return GLOB.organ_process_order.Find(slot_a) - GLOB.organ_process_order.Find(slot_b)

/mob/living/carbon/proc/get_footprint_sprite()
return FOOTPRINT_SPRITE_PAWS

/mob/living/carbon/vv_get_dropdown()
. = ..()
VV_DROPDOWN_OPTION("", "---------")
Expand Down
10 changes: 8 additions & 2 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
RegisterSignal(src, COMSIG_COMPONENT_CLEAN_FACE_ACT, PROC_REF(clean_face))
AddComponent(/datum/component/personal_crafting)
AddElement(/datum/element/footstep, FOOTSTEP_MOB_HUMAN, 1, -6)
AddComponent(/datum/component/bloodysoles/feet)
AddComponent(/datum/component/bloodysoles/feet, FOOTPRINT_SPRITE_SHOES)
AddElement(/datum/element/ridable, /datum/component/riding/creature/human)
AddElement(/datum/element/strippable, GLOB.strippable_human_items, TYPE_PROC_REF(/mob/living/carbon/human/, should_strip))
var/static/list/loc_connections = list(
Expand Down Expand Up @@ -345,6 +345,12 @@
var/obj/item/bodypart/the_part = isbodypart(target_zone) ? target_zone : get_bodypart(check_zone(target_zone)) //keep these synced
to_chat(user, span_alert("There is no exposed flesh or thin material on [p_their()] [the_part.name]."))

/mob/living/carbon/human/get_footprint_sprite()
var/obj/item/bodypart/leg/L = get_bodypart(BODY_ZONE_R_LEG) || get_bodypart(BODY_ZONE_L_LEG)
return shoes?.footprint_sprite || L?.footprint_sprite

#define CHECK_PERMIT(item) (item && item.item_flags & NEEDS_PERMIT)

/mob/living/carbon/human/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null)
if(judgement_criteria & JUDGE_EMAGGED)
return 10 //Everyone is a criminal!
Expand Down Expand Up @@ -911,7 +917,7 @@
if(diff < 0) //Taking damage, not healing
return diff * physiology.stamina_mod
return diff

/mob/living/carbon/human/adjust_nutrition(change) //Honestly FUCK the oldcoders for putting nutrition on /mob someone else can move it up because holy hell I'd have to fix SO many typechecks
if(HAS_TRAIT(src, TRAIT_NOHUNGER))
return FALSE
Expand Down
4 changes: 4 additions & 0 deletions code/modules/surgery/bodyparts/parts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@
var/digitigrade_id
/// Used solely by digitigrade limbs to remember what their old limb ID was.
var/old_limb_id
/// Used by the bloodysoles component to make footprints
var/footprint_sprite = FOOTPRINT_SPRITE_SHOES
biological_state = BIO_STANDARD_JOINTED

/obj/item/bodypart/leg/Destroy()
Expand Down Expand Up @@ -407,6 +409,7 @@
unarmed_damage_low = 2
unarmed_damage_high = 3
unarmed_stun_threshold = 4
footprint_sprite = FOOTPRINT_SPRITE_PAWS

/obj/item/bodypart/leg/left/alien
icon = 'icons/mob/species/alien/bodyparts.dmi'
Expand Down Expand Up @@ -501,6 +504,7 @@
unarmed_damage_low = 2
unarmed_damage_high = 3
unarmed_stun_threshold = 4
footprint_sprite = FOOTPRINT_SPRITE_PAWS

/obj/item/bodypart/leg/right/alien
icon = 'icons/mob/species/alien/bodyparts.dmi'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
limb_id = SPECIES_LIZARD
can_be_digitigrade = TRUE
digitigrade_id = "digitigrade"
footprint_sprite = FOOTPRINT_SPRITE_CLAWS

/obj/item/bodypart/leg/right/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
limb_id = SPECIES_LIZARD
can_be_digitigrade = TRUE
digitigrade_id = "digitigrade"
footprint_sprite = FOOTPRINT_SPRITE_CLAWS
Binary file modified icons/effects/footprints.dmi
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
husk_type = "simian"
limb_id = SPECIES_SIMIAN
bodytype = BODYTYPE_HUMANOID | BODYTYPE_ORGANIC | BODYTYPE_CUSTOM
footprint_sprite = FOOTPRINT_SPRITE_PAWS

/obj/item/bodypart/leg/right/simian
icon_greyscale = 'monkestation/icons/mob/species/simian/bodyparts.dmi'
husk_type = "simian"
limb_id = SPECIES_SIMIAN
bodytype = BODYTYPE_HUMANOID | BODYTYPE_ORGANIC | BODYTYPE_CUSTOM
footprint_sprite = FOOTPRINT_SPRITE_PAWS

dmg_overlay_type = "monkey"
Loading