Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solar Devils (PVE ERT) Changes, Alt IFF Component #7193

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_gun.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#define COMSIG_GUN_FIRE "gun_fire"
#define COMSIG_GUN_STOP_FIRE "gun_stop_fire"
#define COMSIG_GUN_FIRE_MODE_TOGGLE "gun_fire_mode_toggle"
#define COMSIG_GUN_AUTOFIREDELAY_MODIFIED "gun_autofiredelay_modified"
#define COMSIG_GUN_BURST_SHOTS_TO_FIRE_MODIFIED "gun_burst_shots_to_fire_modified"
#define COMSIG_GUN_BURST_SHOT_DELAY_MODIFIED "gun_burst_shot_delay_modified"

#define COMSIG_GUN_VULTURE_FIRED_ONEHAND "gun_vulture_fired_onehand"
#define COMSIG_VULTURE_SCOPE_MOVED "vulture_scope_moved"
#define COMSIG_VULTURE_SCOPE_SCOPED "vulture_scope_scoped"
#define COMSIG_VULTURE_SCOPE_UNSCOPED "vulture_scope_unscoped"

/// from /obj/item/weapon/gun/proc/recalculate_attachment_bonuses() : ()
#define COMSIG_GUN_RECALCULATE_ATTACHMENT_BONUSES "gun_recalculate_attachment_bonuses"

/// from /obj/item/weapon/gun/proc/load_into_chamber() : ()
#define COMSIG_GUN_INTERRUPT_FIRE "gun_interrupt_fire"

//Signals for automatic fire at component
#define COMSIG_AUTOMATIC_SHOOTER_START_SHOOTING_AT "start_shooting_at"
#define COMSIG_AUTOMATIC_SHOOTER_STOP_SHOOTING_AT "stop_shooting_at"
#define COMSIG_AUTOMATIC_SHOOTER_SHOOT "shoot"

//Signals for gun auto fire component
#define COMSIG_GET_BURST_FIRE "get_burst_fire"
#define BURST_FIRING (1<<0)

/// Called before a gun fires a projectile, note NOT point blanks, /obj/item/weapon/gun/proc/handle_fire()
#define COMSIG_GUN_BEFORE_FIRE "gun_before_fire"
#define COMPONENT_CANCEL_GUN_BEFORE_FIRE (1<<0) //continue full-auto/burst attempts
#define COMPONENT_HARD_CANCEL_GUN_BEFORE_FIRE (1<<1) //hard stop firing

/// Called when IFF is toggled on or off
#define COMSIG_GUN_IFF_TOGGLED "gun_iff_toggled"
27 changes: 0 additions & 27 deletions code/__DEFINES/dcs/signals/atom/signals_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,6 @@
/// from /obj/item/proc/unzoom() : (mob/user)
#define COMSIG_ITEM_UNZOOM "item_unzoom"

//Signals for automatic fire at component
#define COMSIG_AUTOMATIC_SHOOTER_START_SHOOTING_AT "start_shooting_at"
#define COMSIG_AUTOMATIC_SHOOTER_STOP_SHOOTING_AT "stop_shooting_at"
#define COMSIG_AUTOMATIC_SHOOTER_SHOOT "shoot"

//Signals for gun auto fire component
#define COMSIG_GET_BURST_FIRE "get_burst_fire"
#define BURST_FIRING (1<<0)

#define COMSIG_GUN_FIRE "gun_fire"
#define COMSIG_GUN_STOP_FIRE "gun_stop_fire"
#define COMSIG_GUN_FIRE_MODE_TOGGLE "gun_fire_mode_toggle"
#define COMSIG_GUN_AUTOFIREDELAY_MODIFIED "gun_autofiredelay_modified"
#define COMSIG_GUN_BURST_SHOTS_TO_FIRE_MODIFIED "gun_burst_shots_to_fire_modified"
#define COMSIG_GUN_BURST_SHOT_DELAY_MODIFIED "gun_burst_shot_delay_modified"

#define COMSIG_GUN_VULTURE_FIRED_ONEHAND "gun_vulture_fired_onehand"
#define COMSIG_VULTURE_SCOPE_MOVED "vulture_scope_moved"
#define COMSIG_VULTURE_SCOPE_SCOPED "vulture_scope_scoped"
#define COMSIG_VULTURE_SCOPE_UNSCOPED "vulture_scope_unscoped"

/// from /obj/item/weapon/gun/proc/recalculate_attachment_bonuses() : ()
#define COMSIG_GUN_RECALCULATE_ATTACHMENT_BONUSES "gun_recalculate_attachment_bonuses"

/// from /obj/item/weapon/gun/proc/load_into_chamber() : ()
#define COMSIG_GUN_INTERRUPT_FIRE "gun_interrupt_fire"

//from /datum/authority/branch/role/proc/equip_role()
#define COMSIG_POST_SPAWN_UPDATE "post_spawn_update"

Expand Down
7 changes: 7 additions & 0 deletions code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@
else
client.remove_from_screen(screen)

/mob/proc/get_maximum_view_range()
if(!client)
return world.view


var/offset = max(abs(client.pixel_x), abs(client.pixel_y))
return client.view + offset / 32

/atom/movable/screen/fullscreen
icon = 'icons/mob/hud/screen1_full.dmi'
Expand Down
105 changes: 105 additions & 0 deletions code/datums/components/iff_fire_prevention.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#define IFF_HALT_COOLDOWN 0.5 SECONDS

/// A component that prevents gun (although you can attach it to anything else that shoot projectiles) from shooting when mob from the same faction stands in the way.
/// You can also pass number of ticks, to make gun have an additional delay if firing prevention comes into play, but it is not neccesary.
/datum/component/iff_fire_prevention
var/iff_additional_fire_delay
COOLDOWN_DECLARE(iff_halt_cooldown)

/datum/component/iff_fire_prevention/Initialize(additional_fire_delay = 0)
. = ..()
iff_additional_fire_delay = additional_fire_delay


/datum/component/iff_fire_prevention/RegisterWithParent()
. = ..()
RegisterSignal(parent, COMSIG_GUN_BEFORE_FIRE, PROC_REF(check_firing_lane))
RegisterSignal(parent, COMSIG_GUN_IFF_TOGGLED, PROC_REF(handle_iff_toggle))

/datum/component/iff_fire_prevention/UnregisterFromParent()
. = ..()
UnregisterSignal(parent, list(
COMSIG_GUN_BEFORE_FIRE,
COMSIG_GUN_IFF_TOGGLED
))

/datum/component/iff_fire_prevention/proc/check_firing_lane(obj/firing_weapon, obj/projectile/projectile_to_fire, atom/target, mob/living/user)
SIGNAL_HANDLER

var/angle = Get_Angle(user, target)

var/range_to_check = user.get_maximum_view_range()

var/extended_target_turf = get_angle_target_turf(user, angle, range_to_check)

var/turf/starting_turf = get_turf(user)

if(!starting_turf || !extended_target_turf)
return COMPONENT_CANCEL_GUN_BEFORE_FIRE

var/list/checked_turfs = get_line(starting_turf, extended_target_turf)

//Don't shoot yourself, thanks
if(target == user)
if(COOLDOWN_FINISHED(src, iff_halt_cooldown) && user.client)
playsound_client(user.client, 'sound/weapons/smartgun_fail.ogg', src, 25)
to_chat(user, SPAN_WARNING("[firing_weapon] halts firing as an IFF marked target crosses your field of fire!"))
COOLDOWN_START(src, iff_halt_cooldown, IFF_HALT_COOLDOWN)
if(iff_additional_fire_delay)
var/obj/item/weapon/gun/gun = firing_weapon
if(istype(gun))
LAZYSET(user.fire_delay_next_fire, gun, world.time + iff_additional_fire_delay)
return COMPONENT_CANCEL_GUN_BEFORE_FIRE

//At some angles (scatter or otherwise) the original target is not in checked_turfs so we put it in there in order based on distance from user
//If we are literally clicking on someone with IFF then we don't want to fire, feels funny as a user otherwise
if(projectile_to_fire.original)
var/turf/original_target_turf = get_turf(projectile_to_fire.original)

if(original_target_turf && !(original_target_turf in checked_turfs))
var/user_to_target_dist = get_dist(starting_turf, original_target_turf)
var/list/temp_checked_turfs = checked_turfs.Copy()
checked_turfs = list()

for(var/turf/checked_turf as anything in temp_checked_turfs)
if(!(original_target_turf in checked_turfs) && user_to_target_dist < get_dist(starting_turf, checked_turf))
checked_turfs += original_target_turf

checked_turfs += checked_turf

for(var/turf/checked_turf as anything in checked_turfs)

//Wall, should block the bullet so we're good to stop checking.
if(istype(checked_turf, /turf/closed))
return

for(var/mob/living/checked_living in checked_turf)
if(checked_living == user) // sometimes it still happens
continue
if(checked_living.body_position == LYING_DOWN && projectile_to_fire.original != checked_living)
continue

if(checked_living.get_target_lock(user.faction_group))
if(HAS_TRAIT(checked_living, TRAIT_CLOAKED))
continue
if(COOLDOWN_FINISHED(src, iff_halt_cooldown) && user.client)
playsound_client(user.client, 'sound/weapons/smartgun_fail.ogg', src, 25)
to_chat(user, SPAN_WARNING("[firing_weapon] halts firing as an IFF marked target crosses your field of fire!"))
COOLDOWN_START(src, iff_halt_cooldown, IFF_HALT_COOLDOWN)
if(iff_additional_fire_delay)
var/obj/item/weapon/gun/gun = firing_weapon
if(istype(gun))
LAZYSET(user.fire_delay_next_fire, gun, world.time + iff_additional_fire_delay)
return COMPONENT_CANCEL_GUN_BEFORE_FIRE

return //if we have a target we *can* hit and find it before any IFF targets we want to fire

/// Disable fire prevention when IFF is toggled off and other way around
/datum/component/iff_fire_prevention/proc/handle_iff_toggle(obj/gun, iff_enabled)
SIGNAL_HANDLER
if(iff_enabled)
RegisterSignal(parent, COMSIG_GUN_BEFORE_FIRE, PROC_REF(check_firing_lane))
else
UnregisterSignal(parent, COMSIG_GUN_BEFORE_FIRE)

#undef IFF_HALT_COOLDOWN
6 changes: 5 additions & 1 deletion code/datums/skills/uscm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ SOLAR DEVILS (PvE Marines)
SKILL_VEHICLE = SKILL_VEHICLE_SMALL,
SKILL_JTAC = SKILL_JTAC_BEGINNER,
SKILL_ENDURANCE = SKILL_ENDURANCE_TRAINED,
SKILL_SPEC_WEAPONS = SKILL_SPEC_SMARTGUN,
)

/datum/skills/combat_medic_pve
Expand All @@ -457,6 +458,7 @@ SOLAR DEVILS (PvE Marines)
SKILL_ENDURANCE = SKILL_ENDURANCE_TRAINED,
SKILL_MEDICAL = SKILL_MEDICAL_MEDIC,
SKILL_SURGERY = SKILL_SURGERY_NOVICE,
SKILL_SPEC_WEAPONS = SKILL_SPEC_SMARTGUN,
)

/datum/skills/smartgunner_pve
Expand Down Expand Up @@ -484,6 +486,7 @@ SOLAR DEVILS (PvE Marines)
SKILL_LEADERSHIP = SKILL_LEAD_TRAINED,
SKILL_ENDURANCE = SKILL_ENDURANCE_TRAINED,
SKILL_PILOT = SKILL_PILOT_TRAINED,
SKILL_SPEC_WEAPONS = SKILL_SPEC_SMARTGUN,
)

/datum/skills/sl_pve
Expand All @@ -496,10 +499,11 @@ SOLAR DEVILS (PvE Marines)
SKILL_ENDURANCE = SKILL_ENDURANCE_MASTER,
SKILL_CQC = SKILL_CQC_TRAINED,
SKILL_LEADERSHIP = SKILL_LEAD_EXPERT,
SKILL_MEDICAL = SKILL_MEDICAL_TRAINED,
SKILL_MEDICAL = SKILL_MEDICAL_MEDIC,
SKILL_SURGERY = SKILL_SURGERY_NOVICE,
SKILL_VEHICLE = SKILL_VEHICLE_SMALL,
SKILL_JTAC = SKILL_JTAC_TRAINED,
SKILL_INTEL = SKILL_INTEL_TRAINED,
SKILL_PILOT = SKILL_PILOT_EXPERT,
SKILL_SPEC_WEAPONS = SKILL_SPEC_SMARTGUN,
)
4 changes: 2 additions & 2 deletions code/game/objects/items/storage/toolkit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
new /obj/item/circuitboard/apc(src)
new /obj/item/circuitboard/apc(src)
new /obj/item/cell/high(src)
new /obj/item/cell/high(src)
new /obj/item/clothing/glasses/welding(src)
new /obj/item/explosive/plastic/breaching_charge(src)
new /obj/item/explosive/plastic/breaching_charge(src)


/obj/item/storage/toolkit/empty/fill_preset_inventory()
Expand Down
5 changes: 5 additions & 0 deletions code/game/objects/items/tools/maintenance_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,11 @@
to_chat(H, SPAN_WARNING("Your eyes are really starting to hurt. This can't be good for you!"))
return FALSE

/obj/item/tool/weldingtool/screen
name = "shielded blowtorch"
desc = "A blowtorch, this one has a welding screen installed to prevent eye damage."
has_welding_screen = TRUE

/obj/item/tool/weldingtool/largetank
name = "industrial blowtorch"
max_fuel = 60
Expand Down
Loading
Loading