Skip to content

Commit

Permalink
Fixes borgs duplicating ammunition with the munition clamp upgrade (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
IndusRobot authored Jun 14, 2024
1 parent 37579a6 commit 57cd724
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
16 changes: 16 additions & 0 deletions nsv13/code/modules/munitions/ship_weapons/_ship_weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@
to_chat(user, "<span class='notice'>You start to load [A] into [src].</span>")
loading = TRUE
if(do_after(user, load_delay, target = src))
if ( !user_has_payload( A, user ) )
loading = FALSE
return FALSE
if(mag_load_sound)
playsound(src, mag_load_sound, 100, 1)

Expand All @@ -291,6 +294,19 @@

return FALSE

/obj/machinery/ship_weapon/proc/user_has_payload(obj/item/A, mob/user) // Searches humans and borgs for gunpowder before depositing
if ( !user )
return FALSE

// Prove you're not human
if ( istype( user, /mob/living/silicon/robot ) )
// Give me your hands
var/obj/item/borg/apparatus/munitions/hands = locate( /obj/item/borg/apparatus/munitions ) in user.contents
if ( !hands?.stored )
return FALSE

return TRUE

/**
* If we're not magazine-fed, eject round(s) from the weapon.
* Transitions to STATE_NOTLOADED from higher states.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,27 @@
if(locate(/obj/machinery/deck_turret/autoelevator) in orange(2, src))
temp /= 2
if(do_after(user, temp, target = src))
if(user)
if(user_has_payload(A, user))
to_chat(user, "<span class='notice'>You load [A] into [src].</span>")
bag = A
bag.forceMove(src)
icon_state = "[initial(icon_state)]_loaded"
playsound(src.loc, 'nsv13/sound/effects/ship/mac_load.ogg', 100, 1)
loading = FALSE

/obj/machinery/deck_turret/powder_gate/proc/user_has_payload(obj/item/A, mob/user) // Searches humans and borgs for gunpowder before depositing
if ( !user )
return FALSE

// Prove you're not human
if ( istype( user, /mob/living/silicon/robot ) )
// Give me your hands
var/obj/item/borg/apparatus/munitions/hands = locate( /obj/item/borg/apparatus/munitions ) in user.contents
if ( !hands?.stored )
return FALSE

return TRUE

/obj/item/powder_bag
name = "gunpowder bag"
desc = "A highly flammable bag of gunpowder which is used in naval artillery systems."
Expand Down

0 comments on commit 57cd724

Please sign in to comment.