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

Fix m56d and m2c crushing, labeling, and damage retention #5481

Merged
merged 4 commits into from
Jan 19, 2024
Merged
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: 18 additions & 16 deletions code/modules/cm_marines/m2c.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,21 @@
if(!check_can_setup(user, rotate_check, OT, ACR))
return

var/obj/structure/machinery/m56d_hmg/auto/M = new /obj/structure/machinery/m56d_hmg/auto(user.loc)
transfer_label_component(M)
M.setDir(user.dir) // Make sure we face the right direction
M.anchored = TRUE
playsound(M, 'sound/items/m56dauto_setup.ogg', 75, TRUE)
to_chat(user, SPAN_NOTICE("You deploy [M]."))
M.rounds = rounds
M.overheat_value = overheat_value
M.health = health
M.update_icon()
var/obj/structure/machinery/m56d_hmg/auto/HMG = new(user.loc)
transfer_label_component(HMG)
HMG.setDir(user.dir) // Make sure we face the right direction
HMG.anchored = TRUE
playsound(HMG, 'sound/items/m56dauto_setup.ogg', 75, TRUE)
to_chat(user, SPAN_NOTICE("You deploy [HMG]."))
HMG.rounds = rounds
HMG.overheat_value = overheat_value
HMG.health = health
HMG.update_damage_state()
HMG.update_icon()
qdel(src)

if(M.rounds > 0)
M.try_mount_gun(user)
if(HMG.rounds > 0)
HMG.try_mount_gun(user)

/obj/item/device/m2c_gun/attackby(obj/item/O as obj, mob/user as mob)
if(!ishuman(user))
Expand Down Expand Up @@ -313,12 +314,13 @@
if(health <= 0)
playsound(src.loc, 'sound/items/Welder2.ogg', 25, 1)
visible_message(SPAN_WARNING("[src] has broken down completely!"))
var/obj/item/device/m2c_gun/HMG = new(src.loc)
var/obj/item/device/m2c_gun/HMG = new(loc)
HMG.rounds = rounds
HMG.broken_gun = TRUE
HMG.unacidable = FALSE
HMG.health = 0
HMG.update_icon()
transfer_label_component(HMG)
qdel(src)
return

Expand Down Expand Up @@ -475,10 +477,10 @@
return
user.visible_message(SPAN_NOTICE("[user] disassembles [src]."),SPAN_NOTICE("You fold up the tripod for [src], disassembling it."))
playsound(src.loc, 'sound/items/m56dauto_setup.ogg', 75, 1)
var/obj/item/device/m2c_gun/HMG = new(src.loc)
var/obj/item/device/m2c_gun/HMG = new(loc)
transfer_label_component(HMG)
HMG.rounds = src.rounds
HMG.overheat_value = round(0.5 * src.overheat_value)
HMG.rounds = rounds
HMG.overheat_value = round(0.5 * overheat_value)
if (HMG.overheat_value <= 10)
HMG.overheat_value = 0
HMG.update_icon()
Expand Down
88 changes: 54 additions & 34 deletions code/modules/cm_marines/smartgun_mount.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,15 @@
to_chat(user, SPAN_WARNING("This is too close to [machine]!"))
return

var/obj/structure/machinery/m56d_post/M = new /obj/structure/machinery/m56d_post(user.loc)
M.setDir(user.dir) // Make sure we face the right direction
M.gun_rounds = src.rounds //Inherit the amount of ammo we had.
M.gun_mounted = TRUE
M.anchored = TRUE
M.update_icon()
transfer_label_component(M)
to_chat(user, SPAN_NOTICE("You deploy \the [src]."))
var/obj/structure/machinery/m56d_post/post = new(user.loc)
post.setDir(user.dir) // Make sure we face the right direction
post.gun_rounds = rounds
post.gun_mounted = TRUE
post.gun_health = health // retain damage
post.anchored = TRUE
post.update_icon()
transfer_label_component(post)
to_chat(user, SPAN_NOTICE("You deploy [src]."))
qdel(src)


Expand Down Expand Up @@ -223,8 +224,8 @@
return

to_chat(user, SPAN_NOTICE("You deploy \the [src]."))
var/obj/structure/machinery/m56d_post/M = new /obj/structure/machinery/m56d_post(user.loc)
transfer_label_component(M)
var/obj/structure/machinery/m56d_post/post = new(user.loc)
transfer_label_component(post)
qdel(src)


Expand All @@ -238,8 +239,12 @@
density = TRUE
layer = ABOVE_MOB_LAYER
projectile_coverage = PROJECTILE_COVERAGE_LOW
var/gun_mounted = FALSE //Has the gun been mounted?
var/gun_rounds = 0 //Did the gun come with any ammo?
///Whether a gun is mounted
var/gun_mounted = FALSE
///Ammo amount of the mounted gun
var/gun_rounds = 0
///Health of the mounted gun
var/gun_health = 0
health = 50

/obj/structure/machinery/m56d_post/initialize_pass_flags(datum/pass_flags_container/PF)
Expand Down Expand Up @@ -302,8 +307,9 @@
to_chat(user, SPAN_WARNING("\The [src] can't be folded while screwed to the floor. Unscrew it first."))
return
to_chat(user, SPAN_NOTICE("You fold [src]."))
var/obj/item/device/m56d_post/P = new(loc)
user.put_in_hands(P)
var/obj/item/device/m56d_post/post = new(loc)
transfer_label_component(post)
user.put_in_hands(post)
qdel(src)

/obj/structure/machinery/m56d_post/attackby(obj/item/O, mob/user)
Expand Down Expand Up @@ -331,6 +337,8 @@
user.visible_message(SPAN_NOTICE("[user] installs [MG] into place."),SPAN_NOTICE("You install [MG] into place."))
gun_mounted = 1
gun_rounds = MG.rounds
gun_health = MG.health
MG.transfer_label_component(src)
update_icon()
user.temp_drop_inv_item(MG)
qdel(MG)
Expand All @@ -343,12 +351,19 @@
to_chat(user, "You begin dismounting [src]'s gun...")
if(do_after(user, 30 * user.get_skill_duration_multiplier(SKILL_ENGINEER), INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD) && gun_mounted)
playsound(src.loc, 'sound/items/Crowbar.ogg', 25, 1)
user.visible_message(SPAN_NOTICE("[user] removes [src]'s gun."),SPAN_NOTICE("You remove [src]'s gun."))
var/obj/item/device/m56d_gun/G = new(loc)
G.rounds = gun_rounds
G.update_icon()
user.visible_message(SPAN_NOTICE("[user] removes [src]'s gun."), SPAN_NOTICE("You remove [src]'s gun."))
var/obj/item/device/m56d_gun/HMG = new(loc)
HMG.rounds = gun_rounds
if(gun_health)
HMG.health = gun_health
HMG.update_icon()
transfer_label_component(HMG)
var/datum/component/label/label = GetComponent(/datum/component/label)
if(label)
label.remove_label()
gun_mounted = FALSE
gun_rounds = 0
gun_health = 0
update_icon()
return

Expand Down Expand Up @@ -389,13 +404,16 @@
var/disassemble_time = 30
if(do_after(user, disassemble_time * user.get_skill_duration_multiplier(SKILL_ENGINEER), INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD))
playsound(src.loc, 'sound/items/Deconstruct.ogg', 25, 1)
user.visible_message(SPAN_NOTICE("[user] screws the M56D into the mount."),SPAN_NOTICE("You finalize the M56D heavy machine gun."))
var/obj/structure/machinery/m56d_hmg/G = new(src.loc) //Here comes our new turret.
transfer_label_component(G)
G.visible_message("[icon2html(G, viewers(src))] <B>\The [G] is now complete!</B>") //finished it for everyone to
G.setDir(dir) //make sure we face the right direction
G.rounds = src.gun_rounds //Inherent the amount of ammo we had.
G.update_icon()
user.visible_message(SPAN_NOTICE("[user] screws the M56D into the mount."), SPAN_NOTICE("You finalize the M56D heavy machine gun."))
var/obj/structure/machinery/m56d_hmg/HMG = new(loc)
transfer_label_component(HMG)
HMG.visible_message("[icon2html(HMG, viewers(src))] <B>\The [HMG] is now complete!</B>")
HMG.setDir(dir)
HMG.rounds = gun_rounds
if(gun_health)
HMG.health = gun_health
HMG.update_damage_state()
HMG.update_icon()
qdel(src)
else
if(anchored)
Expand Down Expand Up @@ -562,7 +580,7 @@
return
else
playsound(src.loc, 'sound/items/Ratchet.ogg', 25, 1)
user.visible_message("[user] rotates \the [src].","You rotate \the [src].")
user.visible_message("[user] rotates [src].", "You rotate [src].")
setDir(turn(dir, -90))
if(operator)
update_pixels(operator)
Expand All @@ -576,14 +594,15 @@

var/disassemble_time = 30
if(do_after(user, disassemble_time * user.get_skill_duration_multiplier(SKILL_ENGINEER), INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD))
user.visible_message(SPAN_NOTICE(" [user] disassembles [src]! "),SPAN_NOTICE(" You disassemble [src]!"))
user.visible_message(SPAN_NOTICE("[user] disassembles [src]!"), SPAN_NOTICE("You disassemble [src]!"))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 25, 1)
var/obj/item/device/m56d_gun/HMG = new(src.loc) //Here we generate our disassembled mg.
var/obj/item/device/m56d_gun/HMG = new(loc)
transfer_label_component(HMG)
HMG.rounds = src.rounds //Inherent the amount of ammo we had.
HMG.rounds = rounds
HMG.has_mount = TRUE
HMG.health = health
HMG.update_icon()
qdel(src) //Now we clean up the constructed gun.
qdel(src)
return

if(istype(O, /obj/item/ammo_magazine/m56d)) // RELOADING DOCTOR FREEMAN.
Expand All @@ -595,7 +614,7 @@
if(user.action_busy) return
if(!do_after(user, 25 * user.get_skill_duration_multiplier(SKILL_ENGINEER), INTERRUPT_ALL, BUSY_ICON_FRIENDLY))
return
user.visible_message(SPAN_NOTICE("[user] loads [src]! "),SPAN_NOTICE("You load [src]!"))
user.visible_message(SPAN_NOTICE("[user] loads [src]!"), SPAN_NOTICE("You load [src]!"))
playsound(loc, 'sound/weapons/gun_minigun_cocked.ogg', 25, 1)
if(rounds)
var/obj/item/ammo_magazine/m56d/D = new(user.loc)
Expand Down Expand Up @@ -638,10 +657,10 @@
if(health <= 0)
var/destroyed = rand(0,1) //Ammo cooks off or something. Who knows.
playsound(src.loc, 'sound/items/Welder2.ogg', 25, 1)
if(!destroyed) new /obj/structure/machinery/m56d_post(loc)
else
if(!destroyed)
var/obj/item/device/m56d_gun/HMG = new(loc)
HMG.rounds = src.rounds //Inherent the amount of ammo we had.
transfer_label_component(HMG)
HMG.rounds = rounds
qdel(src)
return

Expand Down Expand Up @@ -981,6 +1000,7 @@
to_chat(operator, SPAN_HIGHDANGER("You are knocked off the gun by the sheer force of the ram!"))
operator.unset_interaction()
operator.apply_effect(3, WEAKEN)
operator.emote("pain")

/// Getter for burst_firing
/obj/structure/machinery/m56d_hmg/proc/get_burst_firing()
Expand Down
Loading