Simple Mob Blood Overlays (#10237)

* Simple Mob Blood Overlays

* robot blood fixes

* make this more uniform

* support hivebot active icon states
This commit is contained in:
Geeves
2020-10-30 12:19:42 +01:00
committed by GitHub
parent 536336c224
commit 77bcaab463
15 changed files with 105 additions and 3 deletions
@@ -21,6 +21,7 @@
response_help = "brushes"
response_disarm = "attempts to push"
response_harm = "injures"
blood_overlay_icon = 'icons/mob/npc/blood_overlay_carp.dmi'
gender = NEUTER
faction = "carp"
flying = TRUE
@@ -50,6 +51,14 @@
possession_candidate = TRUE
/mob/living/simple_animal/carp/update_icon()
..()
if(resting || stat == DEAD)
blood_overlay_icon = 'icons/mob/npc/blood_overlay.dmi'
else
blood_overlay_icon = initial(blood_overlay_icon)
handle_blood_overlay(TRUE)
/mob/living/simple_animal/carp/fall_impact()
src.visible_message(SPAN_NOTICE("\The [src] gently floats to a stop."))
return FALSE
@@ -20,6 +20,7 @@
health = 25
mob_size = 10
blood_overlay_icon = 'icons/mob/npc/blood_overlay_carp.dmi'
harm_intent_damage = 8
melee_damage_lower = 15
melee_damage_upper = 15
@@ -46,6 +47,14 @@
see_in_dark = 8
see_invisible = SEE_INVISIBLE_NOLIGHTING
/mob/living/simple_animal/hostile/carp/update_icon()
..()
if(resting || stat == DEAD)
blood_overlay_icon = 'icons/mob/npc/blood_overlay.dmi'
else
blood_overlay_icon = initial(blood_overlay_icon)
handle_blood_overlay(TRUE)
/mob/living/simple_animal/hostile/carp/Allow_Spacemove(var/check_drift = 0)
return 1 //No drifting in space for space carp! //original comments do not steal
@@ -21,6 +21,7 @@
response_help = "pets"
response_disarm = "gently pushes aside"
response_harm = "pokes"
blood_overlay_icon = null
stop_automated_movement_when_pulled = 0
maxHealth = 200
health = 200
@@ -14,6 +14,7 @@
icon = 'icons/mob/npc/hivebot.dmi'
icon_state = "hivebot"
blood_type = "#000000"
blood_overlay_icon = 'icons/mob/npc/blood_overlay_hivebot.dmi'
health = 15
maxHealth = 15
harm_intent_damage = 3
@@ -48,6 +49,20 @@
/mob/living/simple_animal/hostile/hivebot/get_bullet_impact_effect_type(var/def_zone)
return BULLET_IMPACT_METAL
/mob/living/simple_animal/hostile/hivebot/update_icon()
..()
if(resting || stat == DEAD)
blood_overlay_icon = 'icons/mob/npc/blood_overlay.dmi'
else
blood_overlay_icon = initial(blood_overlay_icon)
handle_blood_overlay(TRUE)
/mob/living/simple_animal/hostile/hivebot/get_blood_overlay_name()
if(stance == HOSTILE_STANCE_IDLE)
return "blood_overlay"
else
return "blood_overlay_armed"
/mob/living/simple_animal/hostile/hivebot/guardian
health = 80
maxHealth = 45
@@ -227,6 +242,7 @@
icon_living = "hivebotbeacon_active"
health = 300
maxHealth = 300
blood_type = "#000000"
projectilesound = 'sound/weapons/taser2.ogg'
projectiletype = /obj/item/projectile/beam/hivebot
wander = 0
@@ -505,6 +521,8 @@
icon_state = "hivebotharvester"
health = 100
maxHealth = 100
blood_type = "#000000"
blood_overlay_icon = 'icons/mob/npc/blood_overlay_hivebot.dmi'
harm_intent_damage = 3
melee_damage_lower = 30
melee_damage_upper = 30
@@ -722,6 +740,11 @@
icon_state = "hivebotharvester_ripping"
else
icon_state = "hivebotharvester"
if(resting || stat == DEAD || busy)
blood_overlay_icon = 'icons/mob/npc/blood_overlay.dmi'
else
blood_overlay_icon = initial(blood_overlay_icon)
handle_blood_overlay(TRUE)
/mob/living/simple_animal/hostile/retaliate/hivebotharvester/proc/prospect()
@@ -19,6 +19,7 @@
stop_automated_movement_when_pulled = FALSE
health = 300
maxHealth = 300
blood_type = "#000000"
speed = 8
projectiletype = /obj/item/projectile/beam/drone
projectilesound = 'sound/weapons/laser3.ogg'
@@ -16,6 +16,7 @@
response_help = "pets"
response_disarm = "shoves"
response_harm = "harmlessly punches"
blood_overlay_icon = null
maxHealth = 450
health = 450
harm_intent_damage = 0
@@ -48,6 +48,7 @@
attacktext = "glomped"
attack_sound = 'sound/effects/blobattack.ogg'
blood_overlay_icon = null
var/morphed = FALSE
var/melee_damage_disguised = 0
@@ -9,6 +9,7 @@
icon_state = "republicon"
icon_living = "republicon"
icon_dead = "republicon_dead"
blood_type = "#000000"
speak_chance = 5
turns_per_move = 3
organ_names = list("chest", "lower body", "left arm", "right arm", "left leg", "right leg", "head")
@@ -16,6 +16,7 @@
response_help = "pets"
response_disarm = "gently pushes aside"
response_harm = "pokes"
blood_overlay_icon = null
stop_automated_movement_when_pulled = 0
maxHealth = 700
health = 700
@@ -13,6 +13,7 @@
response_help = "brushes"
response_disarm = "pushes"
response_harm = "hits"
blood_overlay_icon = null
speed = -1
maxHealth = 250
health = 250
@@ -1,3 +1,9 @@
#define BLOOD_NONE "none"
#define BLOOD_LIGHT "light"
#define BLOOD_MEDIUM "medium"
#define BLOOD_HEAVY "heavy"
/mob/living/simple_animal
name = "animal"
icon = 'icons/mob/npc/animal.dmi'
@@ -13,7 +19,12 @@
var/icon_living = ""
var/icon_dead = ""
var/icon_gib = null //We only try to show a gibbing animation if this exists.
appearance_flags = KEEP_TOGETHER
var/blood_type = "#A10808" //Blood colour for impact visuals.
var/blood_overlay_icon = 'icons/mob/npc/blood_overlay.dmi'
var/blood_state = BLOOD_NONE
var/image/blood_overlay
var/list/speak = list()
var/speak_chance = 0
@@ -180,6 +191,7 @@
if(health > maxHealth)
health = maxHealth
handle_blood_overlay()
handle_stunned()
handle_weakened()
handle_paralysed()
@@ -303,6 +315,34 @@
if(purge)
purge -= 1
/mob/living/simple_animal/proc/handle_blood_overlay(var/force_reset = FALSE)
if(!blood_overlay_icon)
return
var/current_blood_state = blood_state
var/blood_mod = health / maxHealth
if(blood_mod > 0.9)
blood_state = BLOOD_NONE
else if(blood_mod >= 0.7)
blood_state = BLOOD_LIGHT
else if(blood_mod >= 0.4)
blood_state = BLOOD_MEDIUM
else
blood_state = BLOOD_HEAVY
if(force_reset || (blood_state != BLOOD_NONE && current_blood_state != blood_state))
if(blood_overlay)
cut_overlay(blood_overlay)
var/blood_overlay_name = get_blood_overlay_name()
var/image/I = image(blood_overlay_icon, src, "[blood_overlay_name]-[blood_state]")
I.color = blood_type
I.blend_mode = BLEND_INSET_OVERLAY
blood_overlay = I
add_overlay(blood_overlay)
/mob/living/simple_animal/proc/get_blood_overlay_name()
return "blood_overlay"
/mob/living/simple_animal/proc/handle_eating()
var/list/food_choices = list()
for(var/obj/item/reagent_containers/food/snacks/S in get_turf(src))
@@ -488,6 +528,9 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
visible_message(SPAN_DANGER("\The [src] has been attacked with \the [O] by \the [user]."))
user.do_attack_animation(src)
/mob/living/simple_animal/apply_damage(damage, damagetype, def_zone, blocked, used_weapon, damage_flags)
. = ..()
handle_blood_overlay()
/mob/living/simple_animal/movement_delay()
var/tally = 0 //Incase I need to add stuff other than "speed" later
@@ -532,11 +575,11 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
/mob/living/simple_animal/death(gibbed, deathmessage = "dies!")
walk_to(src,0)
movement_target = null
icon_state = icon_dead
density = 0
density = FALSE
if (isopenturf(loc))
ADD_FALLING_ATOM(src)
return ..(gibbed,deathmessage)
. = ..(gibbed, deathmessage)
update_icon()
/mob/living/simple_animal/ex_act(severity)
if(!blinded)
@@ -766,3 +809,8 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
return /obj/effect/gibspawner/robot
else
return /obj/effect/gibspawner/generic
#undef BLOOD_NONE
#undef BLOOD_LIGHT
#undef BLOOD_MEDIUM
#undef BLOOD_HEAVY