Skip to content

Commit

Permalink
Merge pull request #3717 from MistakeNot4892/devupdate
Browse files Browse the repository at this point in the history
Dev update from stable
  • Loading branch information
MistakeNot4892 authored Feb 23, 2024
2 parents 4656c2e + 5e0ffab commit ace24bd
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 117 deletions.
1 change: 1 addition & 0 deletions code/game/antagonist/station/traitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
dudes -= player.current
for(var/datum/objective/obj in player.objectives)
dudes -= obj.owner?.current
dudes -= obj.target?.current

if(length(dudes))
var/mob/living/carbon/human/M = pick(dudes)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human_organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
update_inhand_overlays(FALSE)
update_body(FALSE)
update_bandages(FALSE)
update_damage_icon(FALSE)
update_damage_overlays(FALSE)
hud_reset()
queue_icon_update() //Avoids calling icon updates 50 times when adding multiple organs

Expand Down
48 changes: 4 additions & 44 deletions code/modules/mob/living/carbon/human/update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ There are several things that need to be remembered:
> There are also these special cases:
update_mutations() //handles updating your appearance for certain mutations. e.g TK head-glows
update_damage_icon() //handles damage overlays for brute/burn damage //(will rename this when I geta round to it)
update_damage_overlays() //handles damage overlays for brute/burn damage //(will rename this when I geta round to it)
update_body() //Handles updating your mob's icon to reflect their gender/race/complexion etc
update_hair() //Handles updating your hair overlay (used to be update_face, but mouth and
...eyes were merged into update_body)
Expand Down Expand Up @@ -100,9 +100,6 @@ If you have any questions/constructive-comments/bugs-to-report/or have a massivl
Please contact me on #coderbus IRC. ~Carn x
*/

/mob/living/carbon/human
var/previous_damage_appearance // store what the body last looked like, so we only have to update it if something changed

/mob/living/carbon/human/refresh_visible_overlays()
update_mutations(FALSE)
update_body(FALSE)
Expand All @@ -113,7 +110,7 @@ Please contact me on #coderbus IRC. ~Carn x
update_fire(FALSE)
update_surgery(FALSE)
update_bandages(FALSE)
update_damage_icon(FALSE)
update_damage_overlays(FALSE)
return ..()

/mob/living/carbon/human/on_update_icon()
Expand Down Expand Up @@ -213,46 +210,9 @@ Please contact me on #coderbus IRC. ~Carn x

return transform

var/global/list/damage_icon_parts = list()

//DAMAGE OVERLAYS
//constructs damage icon for each organ from mask * damage field and saves it in our overlays_ lists
/mob/living/carbon/human/update_damage_icon(var/update_icons=1)

// first check whether something actually changed about damage appearance
var/damage_appearance = ""
for(var/obj/item/organ/external/O in get_external_organs())
damage_appearance += O.damage_state

if(damage_appearance == previous_damage_appearance)
// nothing to do here
return

previous_damage_appearance = damage_appearance
var/decl/bodytype/root_bodytype = get_bodytype()
var/image/standing_image = image(root_bodytype.get_damage_overlays(src), icon_state = "00")

// blend the individual damage states with our icons
for(var/obj/item/organ/external/O in get_external_organs())
O.update_damstate()
O.update_icon()
if(O.damage_state == "00")
continue
var/icon/DI
var/use_colour = (BP_IS_PROSTHETIC(O) ? SYNTH_BLOOD_COLOR : O.species.get_species_blood_color(src))
var/cache_index = "[O.damage_state]/[O.bodytype.type]/[O.icon_state]/[use_colour]/[species.name]"
if(damage_icon_parts[cache_index] == null)
DI = new /icon(O.bodytype.get_damage_overlays(src), O.damage_state) // the damage icon for whole human
DI.Blend(get_limb_mask_for(O.bodytype, O.icon_state), ICON_MULTIPLY) // mask with this organ's pixels
DI.Blend(use_colour, ICON_MULTIPLY)
damage_icon_parts[cache_index] = DI
else
DI = damage_icon_parts[cache_index]

standing_image.overlays += DI

/mob/living/carbon/human/update_damage_overlays(update_icons = TRUE)
. = ..()
update_bandages(update_icons)
set_current_mob_overlay(HO_DAMAGE_LAYER, standing_image, update_icons)

/mob/living/carbon/human/proc/update_bandages(var/update_icons=1)
var/list/bandage_overlays
Expand Down
38 changes: 36 additions & 2 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,42 @@ default behaviour is:
brain.update_icon()
..(repair_brain)

/mob/living/proc/update_damage_icon()
return
/mob/living
var/previous_damage_appearance // store what the body last looked like, so we only have to update it if something changed
var/static/list/damage_icon_parts = list()

/mob/living/proc/update_damage_overlays(update_icons = TRUE)

// first check whether something actually changed about damage appearance
var/damage_appearance = ""
for(var/obj/item/organ/external/O in get_external_organs())
damage_appearance += O.damage_state || "00"

if(damage_appearance == previous_damage_appearance)
// nothing to do here
return

previous_damage_appearance = damage_appearance
var/decl/bodytype/root_bodytype = get_bodytype()
var/image/standing_image = image(root_bodytype.get_damage_overlays(src), icon_state = "00")

// blend the individual damage states with our icons
for(var/obj/item/organ/external/O in get_external_organs())
if(!O.damage_state || O.damage_state == "00")
continue
var/icon/DI
var/use_colour = (BP_IS_PROSTHETIC(O) ? SYNTH_BLOOD_COLOR : O.species.get_species_blood_color(src))
var/cache_index = "[O.damage_state]/[O.bodytype.type]/[O.icon_state]/[use_colour]/[O.species.name]"
if(damage_icon_parts[cache_index] == null)
DI = new /icon(O.bodytype.get_damage_overlays(src), O.damage_state) // the damage icon for whole human
DI.Blend(get_limb_mask_for(O.bodytype, O.icon_state), ICON_MULTIPLY) // mask with this organ's pixels
DI.Blend(use_colour, ICON_MULTIPLY)
damage_icon_parts[cache_index] = DI
else
DI = damage_icon_parts[cache_index]

standing_image.overlays += DI
set_current_mob_overlay(HO_DAMAGE_LAYER, standing_image, update_icons)

/mob/living/handle_grabs_after_move(var/turf/old_loc, var/direction)

Expand Down
6 changes: 3 additions & 3 deletions code/modules/organs/external/_external.dm
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ Note that amputating the affected organ does in fact remove the infection from t
if(update_surgery)
owner.update_surgery()
if (update_damstate())
owner.update_damage_icon(TRUE)
owner.update_damage_overlays(TRUE)

//Updates brute_damn and burn_damn from wound damages. Updates BLEEDING status.
/obj/item/organ/external/proc/update_damages()
Expand Down Expand Up @@ -948,8 +948,8 @@ Note that amputating the affected organ does in fact remove the infection from t
var/n_is = damage_state_text()
if (n_is != damage_state)
damage_state = n_is
return 1
return 0
return TRUE
return FALSE

// new damage icon system
// returns just the brute/burn damage code
Expand Down
2 changes: 1 addition & 1 deletion code/modules/organs/external/_external_damage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
owner.update_bandages()

if(owner && update_damstate())
owner.update_damage_icon()
owner.update_damage_overlays()

if(created_wound && isobj(used_weapon))
var/obj/O = used_weapon
Expand Down
12 changes: 12 additions & 0 deletions code/modules/species/species_bodytype.dm
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,18 @@ var/global/list/bodytypes_by_category = list()
/decl/bodytype/validate()
. = ..()

var/damage_icon = get_damage_overlays()
if(damage_icon)
for(var/brute = 0 to 3)
for(var/burn = 0 to 3)
var/damage_state = "[brute][burn]"
if(!check_state_in_icon(damage_state, damage_icon))
. += "missing state '[damage_state]' in icon '[damage_icon]'"
if(!check_state_in_icon("", damage_icon))
. += "missing default empty state in icon '[damage_icon]'"
else
. += "null damage overlay icon"

if(eye_base_low_light_vision > 1)
. += "base low light vision is greater than 1 (over 100%)"
else if(eye_base_low_light_vision < 0)
Expand Down
124 changes: 59 additions & 65 deletions code/modules/ventcrawl/ventcrawl.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ var/global/list/ventcrawl_machinery = list(
/obj/item/sword/cultblade
)

/mob/living/var/list/icon/pipes_shown = list()
/mob/living/var/is_ventcrawling = 0
/mob/var/next_play_vent = 0
/mob/living
var/list/image/pipes_shown
var/is_ventcrawling = FALSE
var/next_play_vent = 0

/mob/living/proc/can_ventcrawl()
if(!client)
return FALSE
if(!(/mob/living/proc/ventcrawl in verbs))
to_chat(src, "<span class='warning'>You don't possess the ability to ventcrawl!</span>")
to_chat(src, SPAN_WARNING("You don't possess the ability to ventcrawl!"))
return FALSE
if(incapacitated())
to_chat(src, "<span class='warning'>You cannot ventcrawl in your current state!</span>")
to_chat(src, SPAN_WARNING("You cannot ventcrawl in your current state!"))
return FALSE
return ventcrawl_carry()

Expand Down Expand Up @@ -56,7 +57,7 @@ var/global/list/ventcrawl_machinery = list(
/mob/living/proc/ventcrawl_carry()
for(var/atom/A in contents)
if(!is_allowed_vent_crawl_item(A))
to_chat(src, "<span class='warning'>You can't carry \the [A] while ventcrawling!</span>")
to_chat(src, SPAN_WARNING("You can't carry \the [A] while ventcrawling!"))
return FALSE
return TRUE

Expand Down Expand Up @@ -86,67 +87,62 @@ var/global/list/ventcrawl_machinery = list(
return 1

/mob/living/proc/handle_ventcrawl(var/atom/clicked_on)

if(!can_ventcrawl())
return

var/obj/machinery/atmospherics/unary/vent_found
if(clicked_on && Adjacent(clicked_on))
vent_found = clicked_on
if(!istype(vent_found) || !vent_found.can_crawl_through())
vent_found = null
var/obj/machinery/atmospherics/unary/vent_found = clicked_on
if(!istype(vent_found) || !vent_found.can_crawl_through() || !Adjacent(vent_found))
vent_found = null
for(var/obj/machinery/atmospherics/unary/machine in range(1,src))
if(!Adjacent(machine))
continue
if(!is_type_in_list(machine, ventcrawl_machinery))
continue
if(!machine.can_crawl_through())
continue
vent_found = machine
break

if(!vent_found)
for(var/obj/machinery/atmospherics/machine in range(1,src))
if(is_type_in_list(machine, ventcrawl_machinery))
vent_found = machine

if(!vent_found || !vent_found.can_crawl_through())
vent_found = null

if(vent_found)
break

if(vent_found)
var/datum/pipe_network/network = vent_found.network_in_dir(vent_found.dir)
if(network && (network.normal_members.len || network.line_members.len))

to_chat(src, "You begin climbing into the ventilation system...")
if(vent_found.air_contents && !issilicon(src))

switch(vent_found.air_contents.temperature)
if(0 to BODYTEMP_COLD_DAMAGE_LIMIT)
to_chat(src, "<span class='danger'>You feel a painful freeze coming from the vent!</span>")
if(BODYTEMP_COLD_DAMAGE_LIMIT to T0C)
to_chat(src, "<span class='warning'>You feel an icy chill coming from the vent.</span>")
if(T0C + 40 to BODYTEMP_HEAT_DAMAGE_LIMIT)
to_chat(src, "<span class='warning'>You feel a hot wash coming from the vent.</span>")
if(BODYTEMP_HEAT_DAMAGE_LIMIT to INFINITY)
to_chat(src, "<span class='danger'>You feel a searing heat coming from the vent!</span>")
switch(vent_found.air_contents.return_pressure())
if(0 to HAZARD_LOW_PRESSURE)
to_chat(src, "<span class='danger'>You feel a rushing draw pulling you into the vent!</span>")
if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE)
to_chat(src, "<span class='warning'>You feel a strong drag pulling you into the vent.</span>")
if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE)
to_chat(src, "<span class='warning'>You feel a strong current pushing you away from the vent.</span>")
if(HAZARD_HIGH_PRESSURE to INFINITY)
to_chat(src, "<span class='danger'>You feel a roaring wind pushing you away from the vent!</span>")
if(!do_after(src, 45, vent_found, 1, 1))
return
if(!can_ventcrawl())
return

visible_message("<B>[src] scrambles into the ventilation ducts!</B>", "You climb into the ventilation system.")

forceMove(vent_found)
add_ventcrawl(vent_found)

else
to_chat(src, "This vent is not connected to anything.")
else
to_chat(src, "You must be standing on or beside an air vent to enter it.")
return

var/datum/pipe_network/network = vent_found.network_in_dir(vent_found.dir)
if(!network || (!length(network.normal_members) && !length(network.line_members)))
to_chat(src, "This vent is not connected to anything.")
return

to_chat(src, "You begin climbing into the ventilation system...")
if(vent_found.air_contents && !issilicon(src))
switch(vent_found.air_contents.temperature)
if(0 to BODYTEMP_COLD_DAMAGE_LIMIT)
to_chat(src, SPAN_DANGER("You feel a painful freeze coming from the vent!"))
if(BODYTEMP_COLD_DAMAGE_LIMIT to T0C)
to_chat(src, SPAN_WARNING("You feel an icy chill coming from the vent."))
if(T0C + 40 to BODYTEMP_HEAT_DAMAGE_LIMIT)
to_chat(src, SPAN_WARNING("You feel a hot wash coming from the vent."))
if(BODYTEMP_HEAT_DAMAGE_LIMIT to INFINITY)
to_chat(src, SPAN_DANGER("You feel a searing heat coming from the vent!"))
switch(vent_found.air_contents.return_pressure())
if(0 to HAZARD_LOW_PRESSURE)
to_chat(src, SPAN_DANGER("You feel a rushing draw pulling you into the vent!"))
if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE)
to_chat(src, SPAN_WARNING("You feel a strong drag pulling you into the vent."))
if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE)
to_chat(src, SPAN_WARNING("You feel a strong current pushing you away from the vent."))
if(HAZARD_HIGH_PRESSURE to INFINITY)
to_chat(src, SPAN_DANGER("You feel a roaring wind pushing you away from the vent!"))

if(!do_after(src, 45, vent_found, 1, 1) || !can_ventcrawl())
return

visible_message("<B>\The [src] scrambles into the ventilation ducts!</B>", "You climb into the ventilation system.")
forceMove(vent_found)
add_ventcrawl(vent_found)

/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine)
is_ventcrawling = 1
is_ventcrawling = TRUE
//candrop = 0
var/datum/pipe_network/network = starting_machine.return_network(starting_machine)
if(!network)
Expand All @@ -155,15 +151,13 @@ var/global/list/ventcrawl_machinery = list(
for(var/obj/machinery/atmospherics/A in (pipeline.members || pipeline.edges))
if(!A.pipe_image)
A.pipe_image = emissive_overlay(icon = A, loc = A.loc, dir = A.dir)
pipes_shown += A.pipe_image
LAZYDISTINCTADD(pipes_shown, A.pipe_image)
client.images += A.pipe_image

/mob/living/proc/remove_ventcrawl()
is_ventcrawling = 0
//candrop = 1
is_ventcrawling = FALSE
if(client)
for(var/image/current_image in pipes_shown)
client.images -= current_image
client.eye = src

pipes_shown.len = 0
LAZYCLEARLIST(pipes_shown)
2 changes: 1 addition & 1 deletion code/modules/ventcrawl/ventcrawl_atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
for(var/mob/living/M in global.player_list)
if(M.client)
M.client.images -= pipe_image
M.pipes_shown -= pipe_image
LAZYREMOVE(M.pipes_shown, pipe_image)
pipe_image = null
. = ..()

Expand Down
Binary file modified icons/mob/human_races/species/default_damage_overlays.dmi
Binary file not shown.
Binary file modified mods/species/ascent/icons/species/body/gyne/damage_overlays.dmi
Binary file not shown.
Binary file modified mods/species/bayliens/adherent/icons/damage_overlay.dmi
Binary file not shown.
Binary file modified mods/species/vox/icons/body/stanchion/damage_overlays.dmi
Binary file not shown.

0 comments on commit ace24bd

Please sign in to comment.