From 0f6a60600dde56418a8d8dee7082612c63c9b57d Mon Sep 17 00:00:00 2001 From: phil235 Date: Tue, 14 Apr 2015 14:55:05 +0200 Subject: [PATCH 1/2] Fixes alien nest overlay appearing above standing mobs. Also fixes lying mobs appearing in front of standing mobs. Fixes alien humanoid custom pixel shift being reset by life(). Refactors how pixel reinitialisation (when standing or lying or during animations) is done. Adding get_standard_pixel_y_offset() proc (and same for x), removing lying_pixel_y_offset var from all mobs, adding custom_pixel_x_offset (and y) so Wjohnston can play with his aliens. --- code/game/machinery/syndicatebeacon.dm | 2 +- code/game/machinery/syndicatebomb.dm | 2 +- code/game/mecha/mecha.dm | 2 +- .../stool_bed_chair_nest/alien_nests.dm | 10 ++++----- .../structures/stool_bed_chair_nest/bed.dm | 5 ++--- code/modules/mob/living/carbon/alien/alien.dm | 5 ++++- .../carbon/alien/humanoid/update_icons.dm | 13 ++++++------ code/modules/mob/living/carbon/carbon.dm | 6 ++++++ .../mob/living/carbon/carbon_defines.dm | 1 - .../modules/mob/living/carbon/update_icons.dm | 6 +++--- code/modules/mob/living/living.dm | 21 ++++++++++--------- code/modules/mob/living/living_defines.dm | 1 - code/modules/mob/mob.dm | 6 ++++++ 13 files changed, 46 insertions(+), 34 deletions(-) diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm index 85107a4deb7..957f0665266 100644 --- a/code/game/machinery/syndicatebeacon.dm +++ b/code/game/machinery/syndicatebeacon.dm @@ -111,7 +111,7 @@ anchored = 0 density = 1 - layer = MOB_LAYER - 0.1 //so people can't hide it and it's REALLY OBVIOUS + layer = MOB_LAYER - 0.2 //so people can't hide it and it's REALLY OBVIOUS stat = 0 var/active = 0 diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index a0ef6a5fc31..bff628e32d3 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -6,7 +6,7 @@ anchored = 0 density = 0 - layer = MOB_LAYER - 0.1 //so people can't hide it and it's REALLY OBVIOUS + layer = MOB_LAYER - 0.2 //so people can't hide it and it's REALLY OBVIOUS unacidable = 1 var/datum/wires/syndicatebomb/wires = null diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 88b7cc77e2d..2e9ddccfaaf 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -16,7 +16,7 @@ opacity = 1 ///opaque. Menacing. anchored = 1 //no pulling around. unacidable = 1 //and no deleting hoomans inside - layer = MOB_LAYER //icon draw layer + layer = MOB_LAYER - 0.2//icon draw layer infra_luminosity = 15 //byond implementation is bugged. force = 5 var/can_move = 1 diff --git a/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm b/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm index 15c26a7a058..91b89fb8637 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm @@ -55,12 +55,12 @@ if(M == buckled_mob) M.pixel_y = 0 M.pixel_x = initial(M.pixel_x) + 2 - overlays += image('icons/mob/alien.dmi', "nestoverlay", layer=6) + M.layer = MOB_LAYER - 0.3 + overlays += image('icons/mob/alien.dmi', "nestoverlay", layer=MOB_LAYER - 0.2) else - M.pixel_x = initial(M.pixel_x) - M.pixel_y = initial(M.pixel_y) - if(M.lying) - M.pixel_y = M.lying_pixel_offset + M.pixel_x = M.get_standard_pixel_x_offset(M.lying) + M.pixel_y = M.get_standard_pixel_y_offset(M.lying) + M.layer = initial(M.layer) overlays.Cut() /obj/structure/stool/bed/nest/attackby(obj/item/weapon/W as obj, mob/user as mob, params) diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index 3a4588dcb3b..950e27b42eb 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -68,9 +68,8 @@ else density = 0 icon_state = "down" - M.pixel_y = initial(M.pixel_y) - if(M.lying) - M.pixel_y = M.lying_pixel_offset + M.pixel_x = M.get_standard_pixel_x_offset(M.lying) + M.pixel_y = M.get_standard_pixel_y_offset(M.lying) /obj/item/roller diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 03afa9e94ed..79c1960f3a8 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -12,7 +12,6 @@ ventcrawler = 2 languages = ALIEN verb_say = "hisses" - lying_pixel_offset = 0 var/nightvision = 1 var/storedPlasma = 250 var/max_plasma = 500 @@ -205,6 +204,10 @@ Des: Removes all infected images from the alien. /mob/living/carbon/alien/canBeHandcuffed() return 1 +/mob/living/carbon/alien/get_standard_pixel_y_offset(lying = 0) + return initial(pixel_y) + + #undef HEAT_DAMAGE_LEVEL_1 #undef HEAT_DAMAGE_LEVEL_2 #undef HEAT_DAMAGE_LEVEL_3 diff --git a/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm b/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm index 2ccc95f56cf..85a63338919 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm @@ -14,7 +14,6 @@ for(var/image/I in overlays_standing) overlays += I - if(stat == DEAD) //If we mostly took damage from fire if(fireloss > 125) @@ -35,9 +34,10 @@ icon_state = "alien[caste]_s" if(leaping) - var/old_icon = icon - icon = alt_icon - alt_icon = old_icon + if(alt_icon == initial(alt_icon)) + var/old_icon = icon + icon = alt_icon + alt_icon = old_icon icon_state = "alien[caste]_leap" pixel_x = -32 pixel_y = -32 @@ -46,9 +46,8 @@ var/old_icon = icon icon = alt_icon alt_icon = old_icon - pixel_x = initial(pixel_x) - pixel_y = initial(pixel_y) - + pixel_x = get_standard_pixel_x_offset(lying) + pixel_y = get_standard_pixel_y_offset(lying) /mob/living/carbon/alien/humanoid/regenerate_icons() ..() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index bea7a98615b..24399ec8137 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -494,3 +494,9 @@ var/const/GALOSHES_DONT_HELP = 8 /mob/living/carbon/proc/is_mouth_covered(head_only = 0, mask_only = 0) if( (!mask_only && head && (head.flags & HEADCOVERSMOUTH)) || (!head_only && wear_mask && (wear_mask.flags & MASKCOVERSMOUTH)) ) return 1 + +/mob/living/carbon/get_standard_pixel_y_offset(lying = 0) + if(lying) + return -6 + else + return initial(pixel_y) diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index b694d7c2ca5..14510956dab 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -22,5 +22,4 @@ var/co2overloadtime = null var/temperature_resistance = T0C+75 - lying_pixel_offset = -6 //offset for pixel_y when lying down. has_limbs = 1 diff --git a/code/modules/mob/living/carbon/update_icons.dm b/code/modules/mob/living/carbon/update_icons.dm index 1136f3533bb..40c8b4f11e2 100644 --- a/code/modules/mob/living/carbon/update_icons.dm +++ b/code/modules/mob/living/carbon/update_icons.dm @@ -11,11 +11,11 @@ changed++ ntransform.TurnTo(lying_prev,lying) if(lying == 0) //Lying to standing - final_pixel_y = initial(pixel_y) + final_pixel_y = get_standard_pixel_y_offset() else //if(lying != 0) if(lying_prev == 0) //Standing to lying - pixel_y = initial(pixel_y) - final_pixel_y = lying_pixel_offset + pixel_y = get_standard_pixel_y_offset() + final_pixel_y = get_standard_pixel_y_offset(lying) if(dir & (EAST|WEST)) //Facing east or west final_dir = pick(NORTH, SOUTH) //So you fall on your side rather than your face or ass diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 4e13acf2437..49f1577c94e 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -670,9 +670,7 @@ Sorry Giacom. Please don't be mad :( animate(src, pixel_y = pixel_y + 2, time = 10, loop = -1) floating = 1 else if(!on && floating) - var/final_pixel_y = initial(pixel_y) - if(lying && !buckled) - final_pixel_y = lying_pixel_offset + var/final_pixel_y = get_standard_pixel_y_offset(lying) animate(src, pixel_y = final_pixel_y, time = 10) floating = 0 @@ -770,9 +768,7 @@ Sorry Giacom. Please don't be mad :( /mob/living/do_attack_animation(atom/A) - var/final_pixel_y = initial(pixel_y) - if(lying && !buckled) - final_pixel_y = lying_pixel_offset + var/final_pixel_y = get_standard_pixel_y_offset(lying) ..(A, final_pixel_y) floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure to restart it in next life(). @@ -780,11 +776,10 @@ Sorry Giacom. Please don't be mad :( var/amplitude = min(4, (jitteriness/100) + 1) var/pixel_x_diff = rand(-amplitude, amplitude) var/pixel_y_diff = rand(-amplitude/3, amplitude/3) - var/final_pixel_y = initial(pixel_y) - if(lying && !buckled) - final_pixel_y = lying_pixel_offset + var/final_pixel_x = get_standard_pixel_x_offset(lying) + var/final_pixel_y = get_standard_pixel_y_offset(lying) animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = 6) - animate(pixel_x = initial(pixel_x) , pixel_y = final_pixel_y , time = 2) + animate(pixel_x = final_pixel_x , pixel_y = final_pixel_y , time = 2) floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure to restart it in next life(). /mob/living/proc/get_temperature(var/datum/gas_mixture/environment) @@ -812,3 +807,9 @@ Sorry Giacom. Please don't be mad :( loc_temp = environment.temperature return loc_temp + +/mob/living/proc/get_standard_pixel_x_offset(lying = 0) + return initial(pixel_x) + +/mob/living/proc/get_standard_pixel_y_offset(lying = 0) + return initial(pixel_y) \ No newline at end of file diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 394626546c8..c75676e4115 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -41,6 +41,5 @@ var/mob_size = MOB_SIZE_HUMAN var/metabolism_efficiency = 1 //more or less efficiency to metabolize helpful/harmful reagents and regulate body temperature.. var/list/image/staticOverlays = list() - var/lying_pixel_offset = 0 //offset for pixel_y when the mob is lying down. var/has_limbs = 0 //does the mob have distinct limbs?(arms,legs, chest,head) var/list/datum/action/actions = list() \ No newline at end of file diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 0d8377c6532..09ae9e28a7f 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -788,6 +788,12 @@ var/list/slot_equipment_priority = list( \ fall(ko) canmove = !(ko || resting || stunned || buckled) density = !lying + if(lying) + if(layer == initial(layer)) //to avoid special cases like hiding larvas. + layer = MOB_LAYER - 0.2 //so mob lying always appear behind standing mobs + else + if(layer == MOB_LAYER - 0.2) + layer = initial(layer) update_transform() lying_prev = lying return canmove From a584b8df0ef16fc3e5f1bb927f93d51665ec211b Mon Sep 17 00:00:00 2001 From: phil235 Date: Tue, 14 Apr 2015 20:30:02 +0200 Subject: [PATCH 2/2] woops --- .../living/carbon/alien/humanoid/humanoid.dm | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 1e993e79363..40c3574d756 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -8,6 +8,8 @@ var/leap_on_click = 0 var/pounce_cooldown = 0 var/pounce_cooldown_time = 30 + var/custom_pixel_x_offset = 0 //for admin fuckery. + var/custom_pixel_y_offset = 0 //This is fine right now, if we're adding organ specific damage this needs to be updated /mob/living/carbon/alien/humanoid/New() @@ -127,4 +129,20 @@ /mob/living/carbon/alien/humanoid/cuff_resist(obj/item/I) playsound(src, 'sound/voice/hiss5.ogg', 40, 1, 1) //Alien roars when starting to break free - ..(I, cuff_break = 1) + ..(I, cuff_break = 1) + +/mob/living/carbon/alien/humanoid/get_standard_pixel_y_offset(lying = 0) + if(leaping) + return -32 + else if(custom_pixel_y_offset) + return custom_pixel_y_offset + else + return initial(pixel_y) + +/mob/living/carbon/alien/humanoid/get_standard_pixel_x_offset(lying = 0) + if(leaping) + return -32 + else if(custom_pixel_x_offset) + return custom_pixel_x_offset + else + return initial(pixel_x) \ No newline at end of file