Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Jun 22, 2023
1 parent 4c96680 commit a0a8bd8
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions code/modules/projectiles/gun_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ As sniper rifles have both and weapon mods can change them as well. ..() deals w
/obj/item/weapon/gun/dropped(mob/user)
. = ..()

turn_off_light(user)
disconnect_light_from_mob(user)

var/delay_left = (last_fired + fire_delay + additional_fire_group_delay) - world.time
if(fire_delay_group && delay_left > 0)
Expand All @@ -160,16 +160,28 @@ As sniper rifles have both and weapon mods can change them as well. ..() deals w
for(var/group in fire_delay_group)
LAZYSET(user.fire_delay_next_fire, group, world.time + delay_left)

/obj/item/weapon/gun/proc/turn_off_light(mob/bearer)
/// This function disconnects the luminosity from the mob and back to the gun
/obj/item/weapon/gun/proc/disconnect_light_from_mob(mob/bearer)
if (!(flags_gun_features & GUN_FLASHLIGHT_ON))
return FALSE
for (var/slot in attachments)
var/obj/item/attachable/attachment = attachments[slot]
if (!attachment || !attachment.light_mod)
continue
bearer.SetLuminosity(0, FALSE, src)
SetLuminosity(attachment.light_mod)
return TRUE
return FALSE

/// This function actually turns the lights on the gun off
/obj/item/weapon/gun/proc/turn_off_light(mob/bearer)
if (!(flags_gun_features & GUN_FLASHLIGHT_ON))
return FALSE
for (var/slot in attachments)
var/obj/item/attachable/attachment = attachments[slot]
if (!attachment || !attachment.light_mod)
continue
attachment.activate_attachment(src, bearer)

return TRUE
return FALSE

Expand Down

0 comments on commit a0a8bd8

Please sign in to comment.