Skip to content

Commit

Permalink
Resolve Matt's issue, and remove crash_with as it's causing a test fa…
Browse files Browse the repository at this point in the history
…ilure improperly.
  • Loading branch information
Cody Brittain committed May 14, 2024
1 parent 972ad7f commit 0a20544
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 42 deletions.
4 changes: 0 additions & 4 deletions code/modules/clothing/spacesuits/rig/modules/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 136,6 @@
laser = new laser(src)
laser.canremove = FALSE
laser.has_safety = FALSE
else
crash_with("[laser] is an invalid path on [src]!")

/obj/item/rig_module/mounted/energy/engage(atom/target, mob/user)

Expand Down Expand Up @@ -168,8 166,6 @@
ballistic = new ballistic(src)
ballistic.canremove = FALSE
ballistic.has_safety = FALSE
else
crash_with("[ballistic] is an invalid path on [src]!")

/obj/item/rig_module/mounted/ballistic/engage(atom/target, mob/user)

Expand Down
21 changes: 21 additions & 0 deletions code/modules/projectiles/guns/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 27,9 @@
var/unjam_cooldown = 0 //Gives the unjammer some time after spamming unjam to not eject their mag
var/jam_chance = 0 //Chance it jams on fire

///Whether the gun is mounted on a heavy vehicle or not
var/mounted = FALSE

///Pixel offset for the suppressor overlay on the x axis.
var/suppressor_x_offset
///Pixel offset for the suppressor overlay on the y axis.
Expand Down Expand Up @@ -141,6 144,15 @@
//Attempts to load A into src, depending on the type of thing being loaded and the load_method
//Maybe this should be broken up into separate procs for each load method?
/obj/item/gun/projectile/proc/load_ammo(var/obj/item/A, mob/user)
if(mounted)
var/obj/item/rig/rig = get_rig()
if(istype(rig))
if(rig.offline || !rig.suit_is_deployed())
to_chat(user, SPAN_WARNING("You can't reload your [name] without deploying your hardsuit!"))
balloon_alert(user, "Deploy your hardsuit first!")
return
else
return
if(istype(A, /obj/item/ammo_magazine))
var/obj/item/ammo_magazine/AM = A
if(!(load_method & AM.mag_type) || caliber != AM.caliber || (allowed_magazines && !is_type_in_list(A, allowed_magazines)))
Expand Down Expand Up @@ -195,6 207,15 @@

//attempts to unload src. If allow_dump is set to 0, the speedloader unloading method will be disabled
/obj/item/gun/projectile/proc/unload_ammo(mob/user, var/allow_dump = 1, var/drop_mag = FALSE)
if(mounted)
var/obj/item/rig/rig = get_rig()
if(istype(rig))
if(rig.offline || !rig.suit_is_deployed())
to_chat(user, SPAN_WARNING("You can't unload your [name] without deploying your hardsuit!"))
balloon_alert(user, "Deploy your hardsuit first!")
return
else
return
if(ammo_magazine)
if(drop_mag)
ammo_magazine.forceMove(user.loc)
Expand Down
40 changes: 2 additions & 38 deletions code/modules/projectiles/guns/projectile/automatic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 37,7 @@
can_suppress = FALSE
auto_eject = TRUE
auto_eject_sound = 'sound/weapons/smg_empty_alarm.ogg'

/obj/item/gun/projectile/automatic/mounted/load_ammo(obj/item/A, mob/user)
var/obj/item/rig/rig = get_rig()
if(istype(rig))
if(!rig.offline && rig.suit_is_deployed())
..()
else
to_chat(user, SPAN_WARNING("You can't reload your submachine gun without deploying your hardsuit!"))
balloon_alert(user, "Deploy your hardsuit first!")
return

/obj/item/gun/projectile/automatic/mounted/unload_ammo(mob/user, allow_dump = 0)
var/obj/item/rig/rig = get_rig()
if(istype(rig))
if(!rig.offline && rig.suit_is_deployed())
..()
else
to_chat(user, SPAN_WARNING("You can't unload your submachine gun without deploying your hardsuit!"))
balloon_alert(user, "Deploy your hardsuit first!")
mounted = TRUE

//Submachine guns and personal defence weapons, go.

Expand Down Expand Up @@ -186,25 168,7 @@
can_suppress = FALSE
accuracy = 0
offhand_accuracy = 0

/obj/item/gun/projectile/automatic/wt550/mounted/load_ammo(obj/item/A, mob/user)
var/obj/item/rig/rig = get_rig()
if(istype(rig))
if(!rig.offline && rig.suit_is_deployed())
..()
else
to_chat(user, SPAN_WARNING("You can't reload your machine pistol without deploying your hardsuit!"))
balloon_alert(user, "Deploy your hardsuit first!")
return

/obj/item/gun/projectile/automatic/wt550/mounted/unload_ammo(mob/user, allow_dump = 0)
var/obj/item/rig/rig = get_rig()
if(istype(rig))
if(!rig.offline && rig.suit_is_deployed())
..()
else
to_chat(user, SPAN_WARNING("You can't unload your machine pistol without deploying your hardsuit!"))
balloon_alert(user, "Deploy your hardsuit first!")
mounted = TRUE

/obj/item/gun/projectile/automatic/konyang_pirate
name = "pirate smg"
Expand Down

0 comments on commit 0a20544

Please sign in to comment.