[GBP no update] Minor refactor to reflecting projectiles, detgun fix (#18114)

* initial

* change these please

* let it not ignore carp, i suppose

* this instead

* review, fixes

* charlie code
This commit is contained in:
S34N
2022-06-28 22:37:04 +01:00
committed by GitHub
parent bb36a5b0d1
commit 3807bf43c7
11 changed files with 30 additions and 18 deletions
+1
View File
@@ -58,6 +58,7 @@
/obj/item/gun/energy/proc/update_ammo_types()
var/obj/item/ammo_casing/energy/shot
select = clamp(select, 1, length(ammo_type)) // If we decrease ammo types while selecting a removed one, we want to make sure it doesnt try to select an out of bounds index
for(var/i = 1, i <= ammo_type.len, i++)
var/shottype = ammo_type[i]
shot = new shottype(src)
@@ -772,6 +772,7 @@
var/linked_pinpointer_UID
shaded_charge = TRUE
can_holster = TRUE
can_fit_in_turrets = FALSE
can_charge = FALSE
unique_reskin = TRUE
charge_sections = 5
+10 -4
View File
@@ -39,7 +39,8 @@
var/flag = 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/projectile_type = "/obj/item/projectile"
var/range = 50 //This will de-increment every step. When 0, it will delete the projectile.
var/is_reflectable = FALSE // Can it be reflected or not?
/// Determines the reflectability level of a projectile, either REFLECTABILITY_NEVER, REFLECTABILITY_PHYSICAL, REFLECTABILITY_ENERGY in order of ease to reflect.
var/reflectability = REFLECTABILITY_PHYSICAL
var/alwayslog = FALSE // ALWAYS log this projectile on hit even if it doesn't hit a living target. Useful for AOE explosion / EMP.
//Effects
var/stun = 0
@@ -196,7 +197,7 @@
if(!yes) //prevents double bumps.
return
if(check_ricochet(A) && check_ricochet_flag(A) && ricochets < ricochets_max)
if(check_ricochet(A) && check_ricochet_flag(A) && ricochets < ricochets_max && is_reflectable(REFLECTABILITY_PHYSICAL))
ricochets++
if(A.handle_ricochet(src))
on_ricochet(A)
@@ -330,8 +331,6 @@
if(ismob(source))
firer = source // The reflecting mob will be the new firer
else
firer = null // Reflected by something other than a mob so firer will be null
// redirect the projectile
original = locate(new_x, new_y, z)
@@ -390,3 +389,10 @@
return
if(trajectory && !trajectory_ignore_forcemove && isturf(target))
trajectory.initialize_location(target.x, target.y, target.z, 0, 0)
/obj/item/projectile/proc/is_reflectable(desired_reflectability_level)
if(reflectability == REFLECTABILITY_NEVER) //You'd trust coders not to try and override never reflectable things, but heaven help us I do not
return FALSE
if(reflectability < desired_reflectability_level)
return FALSE
return TRUE
+1 -1
View File
@@ -9,7 +9,7 @@
flag = "laser"
eyeblur = 4 SECONDS
impact_effect_type = /obj/effect/temp_visual/impact_effect/red_laser
is_reflectable = TRUE
reflectability = REFLECTABILITY_ENERGY
light_range = 2
light_color = LIGHT_COLOR_DARKRED
ricochets_max = 50 //Honk!
@@ -4,7 +4,7 @@
damage = 0
damage_type = BURN
flag = "energy"
is_reflectable = TRUE
reflectability = REFLECTABILITY_ENERGY
/obj/item/projectile/energy/electrode
name = "electrode"
@@ -146,7 +146,7 @@
damage_type = BURN
armour_penetration = 10 // It can have a little armor pen, as a treat. Bigger than it looks, energy armor is often low.
shield_buster = TRUE
is_reflectable = FALSE //I will let eswords block it like a normal projectile, but it's not getting reflected, and eshields will take the hit hard.
reflectability = REFLECTABILITY_PHYSICAL //I will let eswords block it like a normal projectile, but it's not getting reflected, and eshields will take the hit hard. Carp still can reflect though, screw you.
/obj/item/projectile/energy/detective
name = "energy revolver shot"
@@ -170,6 +170,7 @@
icon_state = "yellow_laser"
light_color = LIGHT_COLOR_YELLOW
stamina = 0
reflectability = REFLECTABILITY_PHYSICAL //No mr cult juggernaught, please don't set me to search!
/obj/item/projectile/energy/detective/tracker_warrant_shot/on_hit(atom/target)
. = ..()
@@ -182,26 +183,24 @@
/obj/item/projectile/energy/detective/tracker_warrant_shot/proc/start_tracking(atom/target)
var/obj/item/gun/energy/detective/D = firer_source_atom
if(!D)
no_worky()
no_worky(target)
return
if(D.tracking_target_UID)
no_worky(tracking_already = TRUE)
return
D.start_pointing(target.UID())
qdel(src)
/obj/item/projectile/energy/detective/tracker_warrant_shot/proc/set_warrant(atom/target)
var/mob/living/carbon/human/target_to_mark = target
var/perpname = target_to_mark.get_visible_name(TRUE)
if(!perpname || perpname == "Unknown")
no_worky(warrant_fail = TRUE)
no_worky(target, warrant_fail = TRUE)
return
var/datum/data/record/R = find_record("name", perpname, GLOB.data_core.security)
if(!R || (R.fields["criminal"] in list(SEC_RECORD_STATUS_EXECUTE, SEC_RECORD_STATUS_ARREST)))
to_chat(firer, "<span class='danger'>Weapon Alert: Target already set to higher warrant status or has no record!</span>")
no_worky(target, warrant_fail = TRUE)
return
set_criminal_status(firer, R, SEC_RECORD_STATUS_SEARCH, "Target tagged by Detective Revolver", "Detective Revolver")
qdel(src)
/obj/item/projectile/energy/detective/tracker_warrant_shot/proc/no_worky(atom/target, tracking_already, warrant_fail)
if(tracking_already)