Merge pull request #1188 from tigercat2000/mobsize

-tg- Mob Size & Refactors
This commit is contained in:
Fox-McCloud
2015-05-28 19:19:12 -04:00
18 changed files with 115 additions and 65 deletions
@@ -26,18 +26,17 @@
large = 1
/mob/living/carbon/alien/humanoid/sentinel/large/update_icons()
lying_prev = lying //so we don't update overlays for lying/standing unless our stance changes again
update_hud() //TODO: remove the need for this to be here
overlays.Cut()
if(lying)
if(resting) icon_state = "prat_sleep"
else icon_state = "prat_l"
for(var/image/I in overlays_lying)
overlays += I
if(stat == DEAD)
icon_state = "prat_dead"
else if(stat == UNCONSCIOUS || lying || resting)
icon_state = "prat_sleep"
else
icon_state = "prat_s"
for(var/image/I in overlays_standing)
overlays += I
for(var/image/I in overlays_standing)
overlays += I
/mob/living/carbon/alien/humanoid/sentinel/New()
var/datum/reagents/R = new/datum/reagents(100)
@@ -20,18 +20,19 @@
pixel_x = -32
/mob/living/carbon/alien/humanoid/empress/large/update_icons()
lying_prev = lying //so we don't update overlays for lying/standing unless our stance changes again
update_hud() //TODO: remove the need for this to be here
overlays.Cut()
if(lying)
if(resting) icon_state = "empress_sleep"
else icon_state = "empress_l"
for(var/image/I in overlays_lying)
overlays += I
if(stat == DEAD)
icon_state = "empress_dead"
else if(stat == UNCONSCIOUS || lying || resting)
icon_state = "empress_sleep"
else
icon_state = "empress_s"
for(var/image/I in overlays_standing)
overlays += I
for(var/image/I in overlays_standing)
overlays += I
/mob/living/carbon/alien/humanoid/empress/New()
var/datum/reagents/R = new/datum/reagents(100)
@@ -78,18 +78,18 @@
large = 1
/mob/living/carbon/alien/humanoid/queen/large/update_icons()
lying_prev = lying //so we don't update overlays for lying/standing unless our stance changes again
update_hud() //TODO: remove the need for this to be here
overlays.Cut()
if(lying)
if(resting) icon_state = "queen_sleep"
else icon_state = "queen_l"
for(var/image/I in overlays_lying)
overlays += I
if(stat == DEAD)
icon_state = "queen_dead"
else if(stat == UNCONSCIOUS || lying || resting)
icon_state = "queen_sleep"
else
icon_state = "queen_s"
for(var/image/I in overlays_standing)
overlays += I
for(var/image/I in overlays_standing)
overlays += I
/*
@@ -9,7 +9,6 @@
/////////////////////////////////
/mob/living/carbon/alien/humanoid
var/list/overlays_lying[X_TOTAL_LAYERS]
var/list/overlays_standing[X_TOTAL_LAYERS]
/mob/living/carbon/alien/humanoid/update_icons()
@@ -63,7 +62,13 @@
update_hud()
update_icons()
update_fire()
update_transform()
/mob/living/carbon/alien/humanoid/update_transform() //The old method of updating lying/standing was update_icons(). Aliens still expect that.
if(lying > 0)
lying = 90 //Anything else looks retarded
..()
update_icons()
/mob/living/carbon/alien/humanoid/update_hud()
@@ -74,32 +79,24 @@
client.screen |= contents
/mob/living/carbon/alien/humanoid/update_fire()
overlays -= overlays_lying[X_FIRE_LAYER]
overlays -= overlays_standing[X_FIRE_LAYER]
if(on_fire)
overlays_lying[X_FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Lying", "layer"= -X_FIRE_LAYER)
overlays_standing[X_FIRE_LAYER] = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Standing", "layer"= -X_FIRE_LAYER)
if(src.lying)
overlays += overlays_lying[X_FIRE_LAYER]
else
overlays += overlays_standing[X_FIRE_LAYER]
overlays += overlays_standing[X_FIRE_LAYER]
return
else
overlays_lying[X_FIRE_LAYER] = null
overlays_standing[X_FIRE_LAYER] = null
/mob/living/carbon/alien/humanoid/update_inv_wear_suit(var/update_icons=1)
if(wear_suit)
var/t_state = wear_suit.item_state
if(!t_state) t_state = wear_suit.icon_state
var/image/lying = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "[t_state]2")
var/image/standing = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "[t_state]")
if(wear_suit.blood_DNA)
var/t_suit = "suit"
if( istype(wear_suit, /obj/item/clothing/suit/armor) )
t_suit = "armor"
lying.overlays += image("icon" = 'icons/effects/blood.dmi', "icon_state" = "[t_suit]blood2")
standing.overlays += image("icon" = 'icons/effects/blood.dmi', "icon_state" = "[t_suit]blood")
//TODO
@@ -109,10 +106,8 @@
drop_r_hand()
drop_l_hand()
overlays_lying[X_SUIT_LAYER] = lying
overlays_standing[X_SUIT_LAYER] = standing
else
overlays_lying[X_SUIT_LAYER] = null
overlays_standing[X_SUIT_LAYER] = null
if(update_icons) update_icons()
@@ -121,16 +116,12 @@
if (head)
var/t_state = head.item_state
if(!t_state) t_state = head.icon_state
var/image/lying = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "[t_state]2")
var/image/standing = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "[t_state]")
if(head.blood_DNA)
lying.overlays += image("icon" = 'icons/effects/blood.dmi', "icon_state" = "helmetblood2")
standing.overlays += image("icon" = 'icons/effects/blood.dmi', "icon_state" = "helmetblood")
head.screen_loc = ui_alien_head
overlays_lying[X_HEAD_LAYER] = lying
overlays_standing[X_HEAD_LAYER] = standing
else
overlays_lying[X_HEAD_LAYER] = null
overlays_standing[X_HEAD_LAYER] = null
if(update_icons) update_icons()
@@ -164,12 +155,10 @@
//Call when target overlay should be added/removed
/mob/living/carbon/alien/humanoid/update_targeted(var/update_icons=1)
if (targeted_by && target_locked)
overlays_lying[TARGETED_LAYER] = target_locked
overlays_standing[TARGETED_LAYER] = target_locked
else if (!targeted_by && target_locked)
del(target_locked)
if (!targeted_by)
overlays_lying[TARGETED_LAYER] = null
overlays_standing[TARGETED_LAYER] = null
if(update_icons) update_icons()
@@ -12,11 +12,14 @@
if(stat == DEAD)
icon_state = "larva[state]_dead"
else if (handcuffed || legcuffed)
else if (handcuffed || legcuffed) //This should be an overlay. Who made this an icon_state?
icon_state = "larva[state]_cuff"
else if(stat == UNCONSCIOUS || lying || resting)
icon_state = "larva[state]_sleep"
else if (stunned)
icon_state = "larva[state]_stun"
else if(lying || resting)
icon_state = "larva[state]_sleep"
else
icon_state = "larva[state]"
/mob/living/carbon/alien/larva/update_transform() //All this is handled in update_icons()
return update_icons()
+8 -1
View File
@@ -661,4 +661,11 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
return 0
/mob/living/carbon/is_muzzled()
return(istype(src.wear_mask, /obj/item/clothing/mask/muzzle))
return(istype(src.wear_mask, /obj/item/clothing/mask/muzzle))
/mob/living/carbon/get_standard_pixel_y_offset(lying = 0)
if(lying)
if(buckled) return initial(pixel_y)
return -6
else
return initial(pixel_y)
@@ -153,16 +153,15 @@ Please contact me on #coderbus IRC. ~Carn x
//this proc is messy as I was forced to include some old laggy cloaking code to it so that I don't break cloakers
//I'll work on removing that stuff by rewriting some of the cloaking stuff at a later date.
/mob/living/carbon/human/update_icons()
lying_prev = lying //so we don't update overlays for lying/standing unless our stance changes again
update_hud() //TODO: remove the need for this
overlays.Cut()
var/stealth = 0
//cloaking devices. //TODO: get rid of this :<
for(var/obj/item/weapon/cloaking_device/S in list(l_hand,r_hand,belt,l_store,r_store))
if(S.active)
stealth = 1
break
if(stealth)
icon = 'icons/mob/human.dmi'
icon_state = "body_cloaked"
@@ -172,17 +171,13 @@ Please contact me on #coderbus IRC. ~Carn x
if(istype(I)) overlays += I
else
icon = stand_icon
for(var/image/I in overlays_standing)
overlays += I
if(lying)
var/matrix/M = matrix()
M.Turn(90)
M.Translate(1,-6)
src.transform = M
else
var/matrix/M = matrix()
src.transform = M
if(overlays.len != overlays_standing.len)
overlays.Cut()
for(var/thing in overlays_standing)
if(thing) overlays += thing
update_transform()
var/global/list/damage_icon_parts = list()
@@ -0,0 +1,31 @@
//LOOK G-MA, I'VE JOINED CARBON PROCS THAT ARE IDENTICAL IN ALL CASES INTO ONE PROC, I'M BETTER THAN LIFE()
//I thought about mob/living but silicons and simple_animals don't want this just yet.
//Right now just handles lying down, but could handle other cases later.
//IMPORTANT: Multiple animate() calls do not stack well, so try to do them all at once if you can.
/mob/living/carbon/update_transform()
var/matrix/ntransform = matrix(transform) //aka transform.Copy()
var/final_pixel_y = pixel_y
var/final_dir = dir
var/changed = 0
if(lying != lying_prev)
changed++
ntransform.TurnTo(lying_prev,lying)
if(lying == 0) //Lying to standing
final_pixel_y = get_standard_pixel_y_offset()
else //if(lying != 0)
if(lying_prev == 0) //Standing to lying
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
lying_prev = lying //so we don't try to animate until there's been another change.
if(resize != RESIZE_DEFAULT_SIZE)
changed++
ntransform.Scale(resize)
resize = RESIZE_DEFAULT_SIZE
if(changed)
animate(src, transform = ntransform, time = 2, pixel_y = final_pixel_y, dir = final_dir, easing = EASE_IN|EASE_OUT)
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart it in next life().
+6
View File
@@ -892,3 +892,9 @@
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 = initial(pixel_y) , time = 2)
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
/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)
@@ -490,6 +490,18 @@
/mob/living/simple_animal/update_fire()
return
/mob/living/simple_animal/update_transform()
var/matrix/ntransform = matrix(transform) //aka transform.Copy()
var/changed = 0
if(resize != RESIZE_DEFAULT_SIZE)
changed++
ntransform.Scale(resize)
resize = RESIZE_DEFAULT_SIZE
if(changed)
animate(src, transform = ntransform, time = 2, easing = EASE_IN|EASE_OUT)
/mob/living/simple_animal/revive()
..()
health = maxHealth
+5 -6
View File
@@ -1057,7 +1057,7 @@ var/list/slot_equipment_priority = list( \
if(istype(buckled, /obj/vehicle))
var/obj/vehicle/V = buckled
if(stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH))
lying = 1
lying = 90
canmove = 0
pixel_y = V.mob_offset_y - 5
else
@@ -1070,13 +1070,13 @@ var/list/slot_equipment_priority = list( \
if( istype(buckled,/obj/structure/stool/bed/chair) )
lying = 0
else
lying = 1
lying = 90
else if(buckled && is_movable)
anchored = 0
canmove = 1
lying = 0
else if( stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH))
lying = 1
lying = 90
canmove = 0
else if( stunned )
canmove = 0
@@ -1102,9 +1102,8 @@ var/list/slot_equipment_priority = list( \
if(update_icon) //forces a full overlay update
update_icon = 0
regenerate_icons()
else if( lying != lying_prev )
update_icons()
update_transform()
lying_prev = lying
return canmove
/mob/proc/fall(var/forced)
+2
View File
@@ -232,3 +232,5 @@
var/list/active_genes=list()
var/last_movement = -100 // Last world.time the mob actually moved of its own accord.
var/resize = 1 //Badminnery resize
+3
View File
@@ -69,3 +69,6 @@ mob/proc/update_inv_wear_pda()
/mob/proc/update_targeted()
return
/mob/proc/update_transform()
return