Projectile impact effects, sounds and blood splatters. (#8444)

Based.
This commit is contained in:
Matt Atlas
2020-03-20 21:28:28 +01:00
committed by GitHub
parent f6aebb669a
commit 9ab1f2cfb1
29 changed files with 144 additions and 82 deletions
+1
View File
@@ -28,6 +28,7 @@
#include "code\__defines\dna.dm"
#include "code\__defines\dview.dm"
#include "code\__defines\gamemode.dm"
#include "code\__defines\guns.dm"
#include "code\__defines\hydroponics.dm"
#include "code\__defines\items_clothing.dm"
#include "code\__defines\lighting.dm"
+8
View File
@@ -0,0 +1,8 @@
#define BULLET_IMPACT_NONE "none"
#define BULLET_IMPACT_METAL "metal"
#define BULLET_IMPACT_MEAT "meat"
#define SOUNDS_BULLET_MEAT list('sound/effects/projectile_impact/bullet_meat1.ogg', 'sound/effects/projectile_impact/bullet_meat2.ogg', 'sound/effects/projectile_impact/bullet_meat3.ogg', 'sound/effects/projectile_impact/bullet_meat4.ogg')
#define SOUNDS_BULLET_METAL list('sound/effects/projectile_impact/bullet_metal1.ogg', 'sound/effects/projectile_impact/bullet_metal2.ogg', 'sound/effects/projectile_impact/bullet_metal3.ogg')
#define SOUNDS_LASER_MEAT list('sound/effects/projectile_impact/energy_meat1.ogg','sound/effects/projectile_impact/energy_meat2.ogg')
#define SOUNDS_LASER_METAL list('sound/effects/projectile_impact/energy_metal1.ogg','sound/effects/projectile_impact/energy_metal2.ogg')
+7 -1
View File
@@ -567,4 +567,10 @@
else if(Oval < midval)
max = mid
else
min = mid+1
min = mid+1
/proc/filter_list(var/list/L, var/type)
. = list()
for(var/entry in L)
if(istype(entry, type))
. += entry
+3
View File
@@ -296,3 +296,6 @@
/atom/movable/proc/do_simple_ranged_interaction(var/mob/user)
return FALSE
/atom/movable/proc/get_bullet_impact_effect_type()
return BULLET_IMPACT_NONE
@@ -1953,3 +1953,23 @@
for(var/obj/item/organ/external/E in organs)
E.fracture()
return
/mob/living/carbon/human/get_bullet_impact_effect_type(var/def_zone)
var/obj/item/organ/external/E = get_organ(def_zone)
if(!E || E.is_stump())
return BULLET_IMPACT_NONE
if(BP_IS_ROBOTIC(E))
return BULLET_IMPACT_METAL
return BULLET_IMPACT_MEAT
/mob/living/carbon/human/bullet_impact_visuals(var/obj/item/projectile/P, var/def_zone, var/damage)
..()
switch(get_bullet_impact_effect_type(def_zone))
if(BULLET_IMPACT_MEAT)
if(P.damtype == BRUTE)
var/hit_dir = get_dir(P.starting, src)
var/obj/effect/decal/cleanable/blood/B = blood_splatter(get_step(src, hit_dir), src, 1, hit_dir)
B.icon_state = pick("dir_splatter_1","dir_splatter_2")
var/scale = min(1, round(P.damage / 50, 0.2))
var/matrix/M = new()
B.transform = M.Scale(scale)
@@ -399,8 +399,8 @@ This function restores all organs.
/mob/living/carbon/human/apply_damage(var/damage = 0, var/damagetype = BRUTE, var/def_zone = null, var/blocked = 0, var/sharp = 0, var/edge = 0, var/obj/used_weapon = null, var/damage_flags)
//visible_message("Hit debug. [damage] | [damagetype] | [def_zone] | [blocked] | [sharp] | [used_weapon]")
if (src.invisibility == INVISIBILITY_LEVEL_TWO && back && (istype(back, /obj/item/rig)))
if (damage > 0)
if (invisibility == INVISIBILITY_LEVEL_TWO && back && (istype(back, /obj/item/rig)))
if(damage > 0)
to_chat(src, "<span class='danger'>You are now visible.</span>")
src.invisibility = 0
+4 -2
View File
@@ -9,12 +9,14 @@
*/
/mob/living/proc/apply_damage(var/damage = 0,var/damagetype = BRUTE, var/def_zone = null, var/blocked = 0, var/used_weapon = null, var/sharp = 0, var/edge = 0, var/damage_flags)
if(!damage || (blocked >= 100)) return 0
if(!damage || (blocked >= 100))
return 0
switch(damagetype)
if(BRUTE)
adjustBruteLoss(damage * BLOCKED_MULT(blocked))
if(BURN)
if(COLD_RESISTANCE in mutations) damage = 0
if(COLD_RESISTANCE in mutations)
damage = 0
adjustFireLoss(damage * BLOCKED_MULT(blocked))
if(TOX)
adjustToxLoss(damage * BLOCKED_MULT(blocked))
+12 -1
View File
@@ -91,15 +91,26 @@
var/absorb = run_armor_check(def_zone, P.check_armour, P.armor_penetration)
var/proj_sharp = is_sharp(P)
var/proj_edge = has_edge(P)
var/damaged
if ((proj_sharp || proj_edge) && prob(absorb))
proj_sharp = 0
proj_edge = 0
if(!P.nodamage)
apply_damage(P.damage, P.damage_type, def_zone, absorb, 0, P, sharp=proj_sharp, edge=proj_edge, damage_flags = P.damage_flags, used_weapon = "\a [P.name]")
damaged = apply_damage(P.damage, P.damage_type, def_zone, absorb, 0, P, sharp=proj_sharp, edge=proj_edge, damage_flags = P.damage_flags, used_weapon = "\a [P.name]")
bullet_impact_visuals(P, def_zone, damaged)
P.on_hit(src, absorb, def_zone)
return absorb
//For visuals, blood splatters and so on.
/mob/living/proc/bullet_impact_visuals(var/obj/item/projectile/P, var/def_zone, var/damage)
var/list/impact_sounds = LAZYACCESS(P.impact_sounds, get_bullet_impact_effect_type(def_zone))
if(length(impact_sounds))
playsound(src, pick(impact_sounds), 75)
/mob/living/get_bullet_impact_effect_type(var/def_zone)
return BULLET_IMPACT_MEAT
//Handles the effects of "stun" weapons
/mob/living/proc/stun_effect_act(var/stun_amount, var/agony_amount, var/def_zone, var/used_weapon=null)
flash_pain()
+4 -1
View File
@@ -387,4 +387,7 @@
break
if(!underdoor)
spawn(3)//A slight delay to let us finish walking out from under the door
layer = initial(layer)
layer = initial(layer)
/mob/living/silicon/get_bullet_impact_effect_type(var/def_zone)
return BULLET_IMPACT_METAL
@@ -29,6 +29,7 @@
supernatural = TRUE
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_ONE
blood_type = "#000000"
tameable = FALSE
@@ -65,6 +66,9 @@
ghostize()
qdel(src)
/mob/living/simple_animal/construct/get_bullet_impact_effect_type(var/def_zone)
return BULLET_IMPACT_METAL
/mob/living/simple_animal/construct/attack_generic(var/mob/user)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(istype(user, /mob/living/simple_animal/construct))
@@ -13,6 +13,7 @@
desc = "A primitive in design, hovering robot, with some menacing looking blades jutting out from it. It bears no manufacturer markings of any kind."
icon = 'icons/mob/npc/hivebot.dmi'
icon_state = "hivebot"
blood_type = "#000000"
health = 15
maxHealth = 15
harm_intent_damage = 3
@@ -40,6 +41,9 @@
attack_emote = "focuses on"
var/mob/living/simple_animal/hostile/hivebotbeacon/linked_parent = null
/mob/living/simple_animal/hostile/hivebot/get_bullet_impact_effect_type(var/def_zone)
return BULLET_IMPACT_METAL
/mob/living/simple_animal/hostile/hivebot/guardian
health = 80
maxHealth = 45
@@ -13,6 +13,7 @@
var/icon_living = ""
var/icon_dead = ""
var/icon_gib = null //We only try to show a gibbing animation if this exists.
var/blood_type = "#A10808" //Blood colour for impact visuals.
var/list/speak = list()
var/speak_chance = 0
@@ -617,74 +618,6 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
user.visible_message("<span class='danger'>[user] butchers \the [src] messily!</span>")
gib()
/*
//Code to handle finding and nomming nearby food items
/mob/living/simple_animal/proc/handle_foodscanning()
if (client || !hunger_enabled || !autoseek_food)
return 0
//Feeding, chasing food, FOOOOODDDD
if(!stat && !resting && !buckled)
turns_since_scan++
if(turns_since_scan >= scan_interval)
turns_since_scan = 0
if((movement_target) && (!(isturf(movement_target.loc) || ishuman(movement_target.loc))) || (foodtarget && !can_eat() ))
movement_target = null
foodtarget = 0
stop_automated_movement = 0
if( !movement_target || !(movement_target.loc in oview(src, 7)) )
walk_to(src,0)
movement_target = null
foodtarget = 0
stop_automated_movement = 0
if (can_eat())
for(var/obj/item/reagent_containers/food/snacks/S in oview(src,7))
if(isturf(S.loc) || ishuman(S.loc))
movement_target = S
foodtarget = 1
break
//Look for food in people's hand
if (!movement_target && beg_for_food)
var/obj/item/reagent_containers/food/snacks/F = null
for(var/mob/living/carbon/human/H in oview(src,scan_range))
if(istype(H.l_hand, /obj/item/reagent_containers/food/snacks))
F = H.l_hand
if(istype(H.r_hand, /obj/item/reagent_containers/food/snacks))
F = H.r_hand
if (F)
movement_target = F
foodtarget = 1
break
if(movement_target)
scan_interval = min_scan_interval
stop_automated_movement = 1
if (isturf(movement_target.loc))
walk_to(src, movement_target, 0, DS2TICKS(seek_move_delay)) //Stand ontop of food
else
walk_to(src, get_turf(movement_target), 1, DS2TICKS(seek_move_delay)) //Don't stand ontop of people
if (movement_target)
set_dir(get_dir(src, movement_target))
if(isturf(movement_target.loc) && Adjacent(get_turf(movement_target), src))
UnarmedAttack(movement_target)
if (get_turf(movement_target) == loc)
set_dir(pick(NORTH, SOUTH, EAST, WEST, NORTH, NORTH))//Face a random direction when eating, but mostly upwards
else if(ishuman(movement_target.loc) && Adjacent(get_turf(movement_target.loc)) && (prob(10) || nutrition / max_nutrition <= 0.25))
if(nutrition / max_nutrition <= 0.25)
steal_food(movement_target, movement_target.loc)
else
beg(movement_target, movement_target.loc)
else
scan_interval = max(min_scan_interval, min(scan_interval+1, max_scan_interval))//If nothing is happening, ian's scanning frequency slows down to save processing
*/
//For picking up small animals
/mob/living/simple_animal/MouseDrop(atom/over_object)
if (holder_type)//we need a defined holder type in order for picking up to work
@@ -787,4 +720,18 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
adjustFireLoss(rand(3, 5))
/mob/living/simple_animal/get_digestion_product()
return "nutriment"
return "nutriment"
/mob/living/simple_animal/bullet_impact_visuals(var/obj/item/projectile/P, var/def_zone, var/damage)
..()
switch(get_bullet_impact_effect_type(def_zone))
if(BULLET_IMPACT_MEAT)
if(P.damtype == BRUTE)
var/hit_dir = get_dir(P.starting, src)
var/obj/effect/decal/cleanable/blood/B = blood_splatter(get_step(src, hit_dir), src, 1, hit_dir)
B.icon_state = pick("dir_splatter_1","dir_splatter_2")
B.basecolor = blood_type
var/scale = min(1, round(mob_size / MOB_TINY, 0.1))
var/matrix/M = new()
B.transform = M.Scale(scale)
B.update_icon()
+8
View File
@@ -269,10 +269,14 @@ proc/blood_splatter(var/target, var/datum/reagent/blood/source, var/large, var/s
var/obj/effect/decal/cleanable/blood/B
var/decal_type = /obj/effect/decal/cleanable/blood/splatter
var/turf/T = get_turf(target)
if(istype(source,/mob/living/carbon/human))
var/mob/living/carbon/human/M = source
source = M.get_blood(M.vessel)
if(!istype(source))
source = null
// Are we dripping or splattering?
var/list/drips = list()
// Only a certain number of drips (or one large splatter) can be on a given turf.
@@ -284,6 +288,10 @@ proc/blood_splatter(var/target, var/datum/reagent/blood/source, var/large, var/s
// Find a blood decal or create a new one.
B = locate(decal_type) in T
if(T)
var/list/existing = filter_list(T.contents, decal_type)
if(length(existing) > 3)
B = pick(existing)
if(!B)
B = new decal_type(T)
+3 -3
View File
@@ -32,6 +32,7 @@
var/damage_flags = DAM_BULLET
var/nodamage = FALSE //Determines if the projectile will skip any damage inflictions
var/check_armour = "bullet" //Defines what armor to use when it hits things. Must be set to bullet, laser, energy,or bomb //Cael - bio and rad are also valid
var/list/impact_sounds //for different categories, IMPACT_MEAT etc
var/stun = 0
var/weaken = 0
@@ -108,14 +109,13 @@
if(isanimal(target))
return FALSE
var/mob/living/L = target
if (damage_type == BRUTE && damage > 5) //weak hits shouldn't make you gush blood
if(damage_type == BRUTE && damage > 5) //weak hits shouldn't make you gush blood
var/splatter_color = "#A10808"
var/mob/living/carbon/human/H = target
if (istype(H)&& H.species && H.species.blood_color)
if (istype(H) && H.species && H.species.blood_color)
splatter_color = H.species.blood_color
var/splatter_dir = starting ? get_dir(starting, target.loc) : dir
new /obj/effect/temp_visual/dir_setting/bloodsplatter(target.loc, splatter_dir, splatter_color)
if(hit_effect)
new hit_effect(target.loc)
@@ -4,6 +4,7 @@
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
damage = 30
damage_type = BURN
impact_sounds = list(BULLET_IMPACT_MEAT = SOUNDS_LASER_MEAT, BULLET_IMPACT_METAL = SOUNDS_LASER_METAL)
check_armour = "laser"
eyeblur = 4
damage_flags = DAM_LASER
@@ -3,10 +3,11 @@
icon_state = "bullet"
damage = 60
damage_type = BRUTE
nodamage = 0
impact_sounds = list(BULLET_IMPACT_MEAT = SOUNDS_BULLET_MEAT, BULLET_IMPACT_METAL = SOUNDS_BULLET_METAL)
nodamage = FALSE
check_armour = "bullet"
embed = 1
sharp = 1
embed = TRUE
sharp = TRUE
shrapnel_type = /obj/item/material/shard/shrapnel
var/mob_passthrough_check = 0
@@ -0,0 +1,43 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: MattAtlas
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Projectiles now have impact sounds."
- rscadd: "Shooting mobs now creates a small blood splatter."
- rscadd: "Simple animals now bleed when they are shot."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.