diff --git a/code/__DEFINES/projectiles.dm b/code/__DEFINES/projectiles.dm index 1bd67fbe02..0ed0d01889 100644 --- a/code/__DEFINES/projectiles.dm +++ b/code/__DEFINES/projectiles.dm @@ -1,12 +1,3 @@ -/// This atom should be ricocheted off of from its inherent properties using standard % chance handling. -#define PROJECTILE_RICOCHET_YES 1 -/// This atom should not be ricocheted off of from its inherent properties. -#define PROJECTILE_RICOCHET_NO 2 -/// This atom should prevent any kind of projectile ricochet from its inherent properties. -#define PROJECTILE_RICOCHET_PREVENT 3 -/// This atom should force a projectile ricochet from its inherent properties. -#define PROJECTILE_RICOCHET_FORCE 4 - //bullet_act() return values #define BULLET_ACT_HIT "HIT" //It's a successful hit, whatever that means in the context of the thing it's hitting. #define BULLET_ACT_BLOCK "BLOCK" //It's a blocked hit, whatever that means in the context of the thing it's hitting. diff --git a/code/game/atoms.dm b/code/game/atoms.dm index de9df3a23e..852391112c 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -156,13 +156,6 @@ return ..() -/** - * Checks if a projectile should ricochet off of us. Projectiles get final say. - * [__DEFINES/projectiles.dm] for return values. - */ -/atom/proc/check_projectile_ricochet(obj/item/projectile/P) - return (flags_1 & DEFAULT_RICOCHET_1)? PROJECTILE_RICOCHET_YES : PROJECTILE_RICOCHET_NO - /atom/proc/handle_ricochet(obj/item/projectile/P) var/turf/p_turf = get_turf(P) var/face_direction = get_dir(src, p_turf) diff --git a/code/game/turfs/simulated/wall/mineral_walls.dm b/code/game/turfs/simulated/wall/mineral_walls.dm index 4466511acd..096f0a0b89 100644 --- a/code/game/turfs/simulated/wall/mineral_walls.dm +++ b/code/game/turfs/simulated/wall/mineral_walls.dm @@ -191,7 +191,8 @@ icon = 'icons/turf/walls/shuttle_wall.dmi' icon_state = "map-shuttle" explosion_block = 3 - flags_1 = CAN_BE_DIRTY_1 | DEFAULT_RICOCHET_1 + flags_1 = CAN_BE_DIRTY_1 + flags_ricochet = RICOCHET_SHINY | RICOCHET_HARD sheet_type = /obj/item/stack/sheet/mineral/titanium smooth = SMOOTH_MORE|SMOOTH_DIAGONAL canSmoothWith = list(/turf/closed/wall/mineral/titanium, /obj/machinery/door/airlock/shuttle, /obj/machinery/door/airlock, /obj/structure/window/shuttle, /obj/structure/shuttle/engine/heater, /obj/structure/falsewall/titanium) diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 37248f814c..ba88baea08 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -6,7 +6,7 @@ icon = 'icons/turf/walls/wall.dmi' icon_state = "wall" explosion_block = 1 - + flags_ricochet = RICOCHET_HARD thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT heat_capacity = 312500 //a little over 5 cm thick , 312500 for 1 m by 2.5 m by 0.25 m plasteel wall attack_hand_speed = 8 diff --git a/code/modules/antagonists/blob/blob/blobs/shield.dm b/code/modules/antagonists/blob/blob/blobs/shield.dm index a2a6ce94d3..a3a1403e58 100644 --- a/code/modules/antagonists/blob/blob/blobs/shield.dm +++ b/code/modules/antagonists/blob/blob/blobs/shield.dm @@ -45,11 +45,8 @@ desc = "A solid wall of slightly twitching tendrils with a reflective glow." damaged_desc = "A wall of twitching tendrils with a reflective glow." icon_state = "blob_glow" + flags_ricochet = RICOCHET_SHINY point_return = 8 max_integrity = 100 brute_resist = 1 explosion_block = 2 - -/obj/structure/blob/shield/reflective/check_projectile_ricochet(obj/item/projectile/P) - return PROJECTILE_RICOCHET_FORCE - diff --git a/code/modules/projectiles/ammunition/_firing.dm b/code/modules/projectiles/ammunition/_firing.dm index 4f886c12c0..71434ece58 100644 --- a/code/modules/projectiles/ammunition/_firing.dm +++ b/code/modules/projectiles/ammunition/_firing.dm @@ -37,9 +37,11 @@ var/obj/item/gun/G = fired_from BB.damage *= G.projectile_damage_multiplier if(HAS_TRAIT(user, TRAIT_INSANE_AIM)) - BB.ricochets_max = max(BB.ricochets_max, 20) //bouncy! + BB.ricochets_max = max(BB.ricochets_max, 10) //bouncy! BB.ricochet_chance = max(BB.ricochet_chance, 200) //it decays BB.ricochet_auto_aim_range = max(BB.ricochet_auto_aim_range, 3) + BB.ricochet_auto_aim_angle = max(BB.ricochet_auto_aim_angle, 30) + BB.ricochet_decay_chance = min(BB.ricochet_decay_chance, 1) BB.ricochet_incidence_leeway = 0 if(reagents && BB.reagents) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index f3d78af59b..faa96b3e61 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -316,16 +316,18 @@ if(!trajectory) return var/turf/T = get_turf(A) - if(check_ricochet(A) && A.handle_ricochet(src)) //if you can ricochet, attempt to ricochet off the object - on_ricochet(A) //if allowed, use autoaim to ricochet into someone, otherwise default to ricocheting off the object from above - var/datum/point/pcache = trajectory.copy_to() - if(hitscan) - store_hitscan_collision(pcache) - decayedRange = max(0, decayedRange - reflect_range_decrease) - ricochet_chance *= ricochet_decay_chance - damage *= ricochet_decay_damage - range = decayedRange - return TRUE + if(check_ricochet(A) && check_ricochet_flag(A)) //if you can ricochet, attempt to ricochet off the object + ricochets++ + if(A.handle_ricochet(src)) + on_ricochet(A) //if allowed, use autoaim to ricochet into someone, otherwise default to ricocheting off the object from above + var/datum/point/pcache = trajectory.copy_to() + if(hitscan) + store_hitscan_collision(pcache) + decayedRange = max(0, decayedRange - reflect_range_decrease) + ricochet_chance *= ricochet_decay_chance + damage *= ricochet_decay_damage + range = decayedRange + return TRUE var/distance = get_dist(T, starting) // Get the distance between the turf shot from and the mob we hit and use that for the calculations. if(def_zone && check_zone(def_zone) != BODY_ZONE_CHEST) @@ -401,24 +403,12 @@ //Returns null if nothing at all was found. /obj/item/projectile/proc/check_ricochet(atom/A) - if(ricochets > ricochets_max) //safety thing, we don't care about what the other thing says about this. - return FALSE - var/them = A.check_projectile_ricochet(src) - switch(them) - if(PROJECTILE_RICOCHET_PREVENT) - return FALSE - if(PROJECTILE_RICOCHET_FORCE) - return TRUE - if(PROJECTILE_RICOCHET_NO) - return FALSE - if(PROJECTILE_RICOCHET_YES) - var/chance = ricochet_chance * A.ricochet_chance_mod - if(firer && HAS_TRAIT(firer, TRAIT_NICE_SHOT)) - chance += NICE_SHOT_RICOCHET_BONUS - if(prob(chance)) - return TRUE - else - CRASH("Invalid return value for projectile ricochet check from [A].") + var/chance = ricochet_chance * A.ricochet_chance_mod + if(firer && HAS_TRAIT(firer, TRAIT_NICE_SHOT)) + chance += NICE_SHOT_RICOCHET_BONUS + if(prob(chance)) + return TRUE + return FALSE /obj/item/projectile/proc/check_ricochet_flag(atom/A) if((flag in list("energy", "laser")) && (A.flags_ricochet & RICOCHET_SHINY))