Skip to content

Commit

Permalink
[MIRROR] Allows RPD Upgrade Disks to be installed by hand [MDB IGNORE…
Browse files Browse the repository at this point in the history
…] (#24719) (#399)

* Allows RPD Upgrade Disks to be installed by hand (#79343)

## About The Pull Request
Closes #79301

Saw this PR, realized how much this annoyed me whenever I played. Not a
hard fix either, since RCD's were a perfect example.
(In the future perhaps items that use upgrades like this could have one
base type of disk, and a component for 'upgrade_disk_tool', but that's
way, WAY out of my experience. Just something I noticed between the RPD
and RCD disks.)

![ApplicationFrameHost_cfnBFrRVWv](https://github.com/tgstation/tgstation/assets/76465278/fbe5784e-ce5d-45b5-a5e5-5dfbfef93fdf)

One on the Left already has the upgrade. Neither try to double-install
it! (Shown for posterity)

Ones on the right are installed both ways. One, the RPD on the Disk. The
other, the Disk on the RPD!

---

Actual PR changes:
- New proc on the RPD called `install_upgrade()` - If the upgrade disk
isn't installed, it installs it onto the RPD and deletes the disk. So,
the same as the RCD one, but fewer checks since the RPD's got a lot
fewer disks. But, easier to add new ones now.
- Since `install_upgrade()` is a thing, the attack chain's code for how
RPD's originally got upgraded is now much shorter. It still functions
the same, though - nothing was removed in this PR!
- Adds an attackby check - if the RPD's attacked by an upgrade disk it
will try to `install_upgrade()`. So basically, what RCD's have.
## Why It's Good For The Game
Consistency between the RPD and RCD upgrade-wise. The RPD's other method
of installing (hitting the disk WITH the RPD) still works, but now
players used to the RCD won't get confused.
## Changelog
:cl:
qol: The RPD now accepts upgrade disks inserted by hand, as well as
their original method of hitting the disk with the RPD
/:cl:

---------



* Allows RPD Upgrade Disks to be installed by hand

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: OrionTheFox <[email protected]>
Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>
  • Loading branch information
4 people authored Nov 1, 2023
1 parent 03d04ff commit 214ba82
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions code/game/objects/items/rcd/RPD.dm
Original file line number Diff line number Diff line change
Expand Up @@ -408,18 +408,7 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
return ..()

if(istype(atom_to_attack, /obj/item/rpd_upgrade))
var/obj/item/rpd_upgrade/rpd_up = atom_to_attack

//already installed
if(rpd_up.upgrade_flags & upgrade_flags)
balloon_alert(user, "already installed!")
return TRUE

//install & delete upgrade
upgrade_flags |= rpd_up.upgrade_flags
playsound(src.loc, 'sound/machines/click.ogg', 50, TRUE)
balloon_alert(user, "upgrade installed")
qdel(rpd_up)
install_upgrade(atom_to_attack, user)
return TRUE

var/atom/attack_target = atom_to_attack
Expand Down Expand Up @@ -627,6 +616,23 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
else
return ..()

/obj/item/pipe_dispenser/attackby(obj/item/item, mob/user, params)
if(istype(item, /obj/item/rpd_upgrade))
install_upgrade(item, user)
return TRUE
return ..()

/// Installs an upgrade into the RPD after checking if it is already installed
/obj/item/pipe_dispenser/proc/install_upgrade(obj/item/rpd_upgrade/rpd_disk, mob/user)
// Check if the upgrade's already present
if(rpd_disk.upgrade_flags & upgrade_flags)
balloon_alert(user, "already installed!")
return
// Adds the upgrade from the disk and then deletes the disk
upgrade_flags |= rpd_disk.upgrade_flags
playsound(loc, 'sound/machines/click.ogg', 50, vary = TRUE)
balloon_alert(user, "upgrade installed")
qdel(rpd_disk)

///Changes the piping layer when the mousewheel is scrolled up or down.
/obj/item/pipe_dispenser/proc/mouse_wheeled(mob/source_mob, atom/A, delta_x, delta_y, params)
Expand Down

0 comments on commit 214ba82

Please sign in to comment.