[TG Mirror] General code maintenance for rcd devices and their DEFINE file [MDB IGNORE] #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Mirrored on Skyrat: ${this.url}
Original PR: (original url)
About The Pull Request
The changes made can be best summarized into points
1. Cleans up
code/_DEFINES/construction.dm
Looking at the top comment of this file
https://github.com/tgstation/tgstation/blob/0fb8b8b218400b3f1805ae81e9bb0364d7a4e9c6/code/__DEFINES/construction.dm#L1
One would expect stuff related to materials, rcd, and other construction related stuff. Well this file is anything but
Why is there stuff related to food & crafting over here then?
https://github.com/tgstation/tgstation/blob/0fb8b8b218400b3f1805ae81e9bb0364d7a4e9c6/code/__DEFINES/construction.dm#L91-L94
It gets worse why are global lists declared here?
https://github.com/tgstation/tgstation/blob/0fb8b8b218400b3f1805ae81e9bb0364d7a4e9c6/code/__DEFINES/construction.dm#L115
There is a dedicated folder to store global lists i.e.
code/_globalvars/lists
for lists like these. These clearly don't belong hereOn top of that a lot of construction related defines has been just dumped here making it too large for it's purposes. which is why this file has been scraped and it's
code/_DEFINES/crafting.dm
code/_globalvars/lists/crafting.dm
code/_DEFINES/construction
foldercode/_DEFINES/construction/actions.dm
-> for wrench act or other construction related actionscode/_DEFINES/construction/material.dm
-> contains your sheet defines and cable & stack related values. Also mergedcode/_DEFINES/material.dm
with this file so it belongs in one placecode/_DEFINES/construction/rcd.dm
-> dedicated file for everything rcd relatedcode/_DEFINES/construction/structures.dm
-> contains the construction states for various stuff like walls, girders, floodlight etcBy splitting this file into multiple meaningful define file names will help in reducing merge conflicts and will aid in faster navigation so this is the 1st part of this PR
2. Debloats the
RCD.dm
file(Part 1)This uses the same concepts as above. i.e. moving defines into their appropriate files for e.g.
https://github.com/tgstation/tgstation/blob/0fb8b8b218400b3f1805ae81e9bb0364d7a4e9c6/code/game/objects/items/rcd/RCD.dm#L170
code/_globalvars
folder so these vars and their related functions to initialize them are moved into thecode/_globalvars/rcd.dm
filehttps://github.com/tgstation/tgstation/blob/0fb8b8b218400b3f1805ae81e9bb0364d7a4e9c6/code/game/objects/items/rcd/RCD.dm#L200
This proc does not belong to the
obj/item/construction/rcd
type it's a global "helper function" this is an effect proc as it creates rcd holograms so it has been moved to thecode/game/objects/effects/rcd.dm
file which is a global effect that can be used by anyoneAnd with that we have moved these vars & procs into their correct places & reduced the size of this file . We can go even further
3. Debloats the
RCD.dm
file(Part 2)This deals with the large list which contains all the designs supported by the RCD
https://github.com/tgstation/tgstation/blob/0fb8b8b218400b3f1805ae81e9bb0364d7a4e9c6/code/game/objects/items/rcd/RCD.dm#L42
This list contains a lot of local defines. We can scrape some of them and reduce the overall bulkiness & memory requirements of this list and so the following defines
Have all been removed making this list a lot more cleaner. Why? because a lot of these are just semantic sugar, we can infer the value of a lot of these defines if we just know the type path of the structure the rcd is trying to build for e.g. take these 2 defines
https://github.com/tgstation/tgstation/blob/0fb8b8b218400b3f1805ae81e9bb0364d7a4e9c6/code/game/objects/items/rcd/RCD.dm#L13-L15
These defines tell the rcd UI the name and the icon it should display. Rather than specifying these manually in the design we can infer them like this
And so by using similar logic to the remaining defines we can eliminate a lot of these local defines and reduce the overall size of this list.
The same logic applies to the different modes of construction, the following defines
https://github.com/tgstation/tgstation/blob/0fb8b8b218400b3f1805ae81e9bb0364d7a4e9c6/code/__DEFINES/construction.dm#L186-L192
Have all been removed and replaced with a single value
RCD_STRUCTURE
All these modes follow the same principle when building them
So rather than creating a new construction mode every time you want to add a new design we can use this mode to apply this general approach every time
The design list has also now been made into a global list rather than a private static list. The big advantage to this is that the rcd asset cache can now access this list and load the correct icons from the list directly. This means you no longer have to manually specify what icons you want to load which is the case currently.
https://github.com/tgstation/tgstation/blob/0fb8b8b218400b3f1805ae81e9bb0364d7a4e9c6/code/modules/asset_cache/assets/rcd.dm#L8-L9
This has lead to the UI icons breaking twice now in the past
Hopefully this should never repeat itself again
4. Other RCD like device changes
ui_act
across RCD, Plumbing RCD and RTDui_data()
toui_static_data()
making the experience much fasterJust some general clean up going on here
5. The Large majority of other code changes
These are actually small code changes spread across multiple files. These effect the
rcd_act()
& thercd_vals()
procs across all items. Basically itto_chat()
&visible_message()
calls. This was done because we already have enough visual feedback of what's going on. When we construct a wall we don't need ato_chat()
to tell us you have a built a wall, we can clearly see that"mode"
with a predefined constantRCD_DESIGN_MODE
to bring some standard to use across all casesShould reduce chat spam and improve readability of code.
6. Airlock & Window names
The rcd asset cache relies on the design name to be unique. So i filled in the missing names for some airlocks & windows which are subjective and open to change but must have some value
7 Removes Microwave PDA upgrade
The RCD should not be allowed to build this microwave considering how quickly it can spawn multiple structures and more importantly as it's a special multipurpose machine so you should spend some effort in printing it's parts and acquiring tools to complete it. This upgrade makes obsolete the need to carry an
The most important point to note here is that whenever an RPED/circuit board is printed at an lathe it charges you "Lathe Tax". The RCD with this upgrade would essentially bypass the need to "Pay Taxes" at these lathes as you are just creating a circuit board from thin air. This causes economy imbalance(10 cr per print) which scales up the more of these machines you make so to avoid this let's end the problem here
Not to mention people would not find the need to print the circuit board for a regular microwave now if they have an RCD because they can just make this microwave type making the need for a regular microwave completely pointless.
Just build a machine frame with the RCD and complete the microwave from there
Changelog
🆑 SyncIt21
code: moved global vars, lists and helper procs for construction related stuff to their appropriate files
code: reduced overall code size & memory of rcd design list and removed unused defines
refactor: removed a ton of chat alerts for rcd related actions to help reduce chat spam
refactor: some airlock & window default names have changed
fix: broken icon in radial menu of rld silo link
remove: removes microwave pda upgrade from RCD. It's a special machine so spend some time in building it rather than shitting them out for free with the RCD. Use the RCD upgrade to spawn a machine frame instead & go from there
/:cl: