mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 16:13:19 +01:00
Fixes Universal Damage Issues. Implements Proper Ricochets (#12532)
This commit is contained in:
committed by
variableundefined
parent
57298cb79f
commit
f4451fcb3d
@@ -59,6 +59,8 @@
|
||||
|
||||
#define OVERLAY_QUEUED_2 4096
|
||||
|
||||
#define CHECK_RICOCHET_2 8192
|
||||
|
||||
//Reagent flags
|
||||
#define REAGENT_NOREACT 1
|
||||
|
||||
@@ -142,6 +144,4 @@
|
||||
#define INDESTRUCTIBLE (1<<6) //doesn't take damage
|
||||
#define FREEZE_PROOF (1<<7) //can't be frozen
|
||||
|
||||
#define CHECK_RICOCHET_1 (1<<4)
|
||||
|
||||
GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768))
|
||||
|
||||
@@ -38,26 +38,16 @@
|
||||
brute_resist = 0.5
|
||||
explosion_block = 2
|
||||
point_return = 9
|
||||
flags_2 = CHECK_RICOCHET_1
|
||||
var/reflect_chance = 80 //80% chance to reflect
|
||||
flags_2 = CHECK_RICOCHET_2
|
||||
|
||||
/obj/structure/blob/shield/reflective/handle_ricochet(obj/item/projectile/P)
|
||||
if(P.is_reflectable && prob(reflect_chance) && !P.legacy)
|
||||
var/P_turf = get_turf(P)
|
||||
var/face_direction = get_dir(src, P_turf)
|
||||
var/face_angle = dir2angle(face_direction)
|
||||
var/incidence_s = GET_ANGLE_OF_INCIDENCE(face_angle, (P.Angle + 180))
|
||||
if(abs(incidence_s) > 90 && abs(incidence_s) < 270)
|
||||
return FALSE
|
||||
var/new_angle_s = SIMPLIFY_DEGREES(face_angle + incidence_s)
|
||||
P.setAngle(new_angle_s)
|
||||
P.firer = src //so people who fired the lasers are not immune to them when it reflects
|
||||
visible_message("<span class='warning'>[P] reflects off [src]!</span>")
|
||||
return -1// complete projectile permutation
|
||||
else if(P.is_reflectable && P.legacy) //to stop legacy projectile exploits
|
||||
visible_message("<span class='warning'>[P] disperses into energy from [src]!</span>")
|
||||
qdel(P)
|
||||
else
|
||||
playsound(src, P.hitsound, 50, 1)
|
||||
visible_message("<span class='danger'>[src] is hit by \a [P]!</span>")
|
||||
take_damage(P.damage, P.damage_type)
|
||||
var/turf/p_turf = get_turf(P)
|
||||
var/face_direction = get_dir(src, p_turf)
|
||||
var/face_angle = dir2angle(face_direction)
|
||||
var/incidence_s = GET_ANGLE_OF_INCIDENCE(face_angle, (P.Angle + 180))
|
||||
if(abs(incidence_s) > 90 && abs(incidence_s) < 270)
|
||||
return FALSE
|
||||
var/new_angle_s = SIMPLIFY_DEGREES(face_angle + incidence_s)
|
||||
P.setAngle(new_angle_s)
|
||||
visible_message("<span class='warning'>[P] reflects off [src]!</span>")
|
||||
return TRUE
|
||||
@@ -161,9 +161,9 @@
|
||||
|
||||
var/obj/item/I = new D.build_path(loc)
|
||||
if(D.locked)
|
||||
var/obj/item/storage/lockbox/large/L = new /obj/item/storage/lockbox/large(get_step(src, SOUTH)) //(Don't use capitals in paths, or single letters.
|
||||
var/obj/item/storage/lockbox/research/large/L = new /obj/item/storage/lockbox/research/large(get_step(src, SOUTH))
|
||||
I.forceMove(L)
|
||||
L.name += " [initial(I.name)]"
|
||||
L.name += " ([I.name])"
|
||||
L.origin_tech = I.origin_tech
|
||||
else
|
||||
I.forceMove(get_step(src, SOUTH))
|
||||
|
||||
@@ -73,13 +73,6 @@
|
||||
|
||||
/obj/item/storage/lockbox/hear_message(mob/living/M as mob, msg)
|
||||
|
||||
/obj/item/storage/lockbox/large
|
||||
name = "Large lockbox"
|
||||
desc = "A large lockbox"
|
||||
max_w_class = WEIGHT_CLASS_BULKY
|
||||
max_combined_w_class = 4 //The sum of the w_classes of all the items in this storage item.
|
||||
storage_slots = 1
|
||||
|
||||
/obj/item/storage/lockbox/mindshield
|
||||
name = "Lockbox (Mindshield Implants)"
|
||||
req_access = list(access_security)
|
||||
@@ -129,4 +122,16 @@
|
||||
/obj/item/storage/lockbox/t4/New()
|
||||
..()
|
||||
for(var/i in 0 to 2)
|
||||
new /obj/item/grenade/plastic/x4/thermite(src)
|
||||
new /obj/item/grenade/plastic/x4/thermite(src)
|
||||
|
||||
/obj/item/storage/lockbox/research
|
||||
|
||||
/obj/item/storage/lockbox/research/deconstruct(disassembled = TRUE) // Get wrecked, Science nerds
|
||||
qdel(src)
|
||||
|
||||
/obj/item/storage/lockbox/research/large
|
||||
name = "Large lockbox"
|
||||
desc = "A large lockbox"
|
||||
max_w_class = WEIGHT_CLASS_BULKY
|
||||
max_combined_w_class = 4 //The sum of the w_classes of all the items in this storage item.
|
||||
storage_slots = 1
|
||||
@@ -10,7 +10,6 @@
|
||||
var/max_fire_temperature_sustained = 0 //The max temperature of the fire which it was subjected to
|
||||
var/dirt = 0
|
||||
var/dirtoverlay = null
|
||||
var/unacidable = FALSE
|
||||
|
||||
/turf/simulated/New()
|
||||
..()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/turf/simulated/floor/indestructible
|
||||
unacidable = TRUE
|
||||
|
||||
/turf/simulated/floor/indestructible/ex_act(severity)
|
||||
return
|
||||
|
||||
@@ -131,7 +131,6 @@
|
||||
var/insulated
|
||||
heat_capacity = 325000
|
||||
floor_tile = /obj/item/stack/rods
|
||||
unacidable = TRUE
|
||||
|
||||
/turf/simulated/floor/engine/break_tile()
|
||||
return //unbreakable
|
||||
|
||||
@@ -127,6 +127,17 @@
|
||||
if(radiated_temperature > max_temperature)
|
||||
take_damage(rand(10, 20) * (radiated_temperature / max_temperature))
|
||||
|
||||
/turf/simulated/wall/handle_ricochet(obj/item/projectile/P) //A huge pile of shitcode!
|
||||
var/turf/p_turf = get_turf(P)
|
||||
var/face_direction = get_dir(src, p_turf)
|
||||
var/face_angle = dir2angle(face_direction)
|
||||
var/incidence_s = GET_ANGLE_OF_INCIDENCE(face_angle, (P.Angle + 180))
|
||||
if(abs(incidence_s) > 90 && abs(incidence_s) < 270)
|
||||
return FALSE
|
||||
var/new_angle_s = SIMPLIFY_DEGREES(face_angle + incidence_s)
|
||||
P.setAngle(new_angle_s)
|
||||
return TRUE
|
||||
|
||||
/turf/simulated/wall/proc/dismantle_wall(devastated = 0, explode = 0)
|
||||
if(devastated)
|
||||
devastate_wall()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/turf/simulated/wall/indestructible
|
||||
unacidable = TRUE
|
||||
|
||||
/turf/simulated/wall/indestructible/dismantle_wall(devastated = 0, explode = 0)
|
||||
return
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
icon = 'icons/turf/walls/shuttle_wall.dmi'
|
||||
icon_state = "map-shuttle"
|
||||
explosion_block = 3
|
||||
flags_2 = CHECK_RICOCHET_2
|
||||
sheet_type = /obj/item/stack/sheet/mineral/titanium
|
||||
smooth = SMOOTH_MORE|SMOOTH_DIAGONAL
|
||||
canSmoothWith = list(/turf/simulated/wall/mineral/titanium, /obj/machinery/door/airlock/shuttle, /obj/machinery/door/airlock, /obj/structure/window/full/shuttle, /obj/structure/shuttle/engine/heater, /obj/structure/falsewall/titanium)
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
sheet_type = /obj/item/stack/sheet/plasteel
|
||||
sheet_amount = 1
|
||||
girder_type = /obj/structure/girder/reinforced
|
||||
unacidable = TRUE
|
||||
var/d_state = RWALL_INTACT
|
||||
var/can_be_reinforced = 1
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
var/lying = 0
|
||||
var/lying_prev = 0
|
||||
var/lastpuke = 0
|
||||
var/unacidable = 0
|
||||
var/can_strip = 1
|
||||
var/list/languages = list() // For speaking/listening.
|
||||
var/list/abilities = list() // For species-derived or admin-given powers.
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
var/impact_effect_type //what type of impact effect to show when hitting something
|
||||
var/ricochets = 0
|
||||
var/ricochets_max = 2
|
||||
var/ricochet_chance = 0
|
||||
var/ricochet_chance = 30
|
||||
|
||||
var/log_override = FALSE //whether print to admin attack logs or just keep it in the diary
|
||||
|
||||
@@ -185,13 +185,13 @@
|
||||
|
||||
if(check_ricochet(A) && check_ricochet_flag(A) && ricochets < ricochets_max)
|
||||
ricochets++
|
||||
if(A.handle_ricochet(src))
|
||||
on_ricochet(A)
|
||||
ignore_source_check = TRUE
|
||||
range = initial(range)
|
||||
return TRUE
|
||||
if(firer)
|
||||
if(A == firer || (A == firer.loc && istype(A, /obj/mecha))) //cannot shoot yourself or your mech
|
||||
if(A.handle_ricochet(src))
|
||||
on_ricochet(A)
|
||||
ignore_source_check = TRUE
|
||||
range = initial(range)
|
||||
return TRUE
|
||||
if(firer && !ignore_source_check)
|
||||
if(A == firer || (A == firer.loc && ismecha(A))) //cannot shoot yourself or your mech
|
||||
loc = A.loc
|
||||
return 0
|
||||
|
||||
@@ -325,7 +325,7 @@ obj/item/projectile/Crossed(atom/movable/AM, oldloc) //A mob moving on a tile wi
|
||||
return FALSE
|
||||
|
||||
/obj/item/projectile/proc/check_ricochet_flag(atom/A)
|
||||
if(A.flags_2 & CHECK_RICOCHET_1)
|
||||
if(A.flags_2 & CHECK_RICOCHET_2)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
is_reflectable = TRUE
|
||||
light_range = 2
|
||||
light_color = LIGHT_COLOR_RED
|
||||
ricochets_max = 50 //Honk!
|
||||
ricochet_chance = 80
|
||||
|
||||
/obj/item/projectile/beam/laser
|
||||
|
||||
@@ -72,8 +74,6 @@
|
||||
name = "emitter beam"
|
||||
icon_state = "emitter"
|
||||
damage = 30
|
||||
legacy = 1
|
||||
animate_movement = SLIDE_STEPS
|
||||
impact_effect_type = /obj/effect/temp_visual/impact_effect/green_laser
|
||||
light_color = LIGHT_COLOR_GREEN
|
||||
|
||||
|
||||
@@ -470,8 +470,8 @@ won't update every console in existence) but it's more of a hassle to do. Also,
|
||||
if(!istype(new_item, /obj/item/stack/sheet)) // To avoid materials dupe glitches
|
||||
new_item.materials = efficient_mats.Copy()
|
||||
if(O)
|
||||
var/obj/item/storage/lockbox/L = new/obj/item/storage/lockbox(linked_lathe.loc)
|
||||
new_item.loc = L
|
||||
var/obj/item/storage/lockbox/research/L = new/obj/item/storage/lockbox/research(linked_lathe.loc)
|
||||
new_item.forceMove(L)
|
||||
L.name += " ([new_item.name])"
|
||||
L.origin_tech = new_item.origin_tech
|
||||
L.req_access = being_built.access_requirement
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 37 KiB |
Reference in New Issue
Block a user