## About The Pull Request Ok so you know all the dmis we have that are made to work with the smoothing system? carpets, walls, etc. The proper way to edit those is to convert them into a png with 5 "states' it in (one for 0 connections, one for horizontal, one for vertical, one for all cardinals and one for all directions) and then modify THAT, then run it through [the cutter tool.](https://github.com/tgstation/icon-cutter) But none ever does that, because we explain it fucking nowhere. So instead, let's keep all those "base" files in the repo, alongside the configs they work with, and "cut" the pngs into dmis as a part of the build process. I wrote a guide for how to interact with this system as a spriter, you can find it [HERE](https://github.com/LemonInTheDark/tgstation/blob/slice-the-sky/icons/Cutter.md). [Adds a icon cutter build task](52143d2e96) This relies on action ninja's hypnagogic (find more [here](https://github.com/actioninja/hypnagogic)), a rust based icon cutter. It operates inline with the file structure, searching the codebase for templates and resource files and compiling them down to dmis. It can do way more then just bitmask stuff, but that is what we are using it for rn. Hope is to prevent for eternity the "I'm just gonna edit each of these 255 icon states that's how this carpet was made right?" meme, and allow more expansive use of smoothing in future [Adds a lint that ensures config files work right](21eeab9cf8) Checks to ensure they have a paired png and dmi, and also avoids issues with uncompiled changes by double checking that nothing happens before/after a cutter run [Pulls all non smoothed states out of structures into bespoke dmis](a730e0cb47) This is required because the cutter cannot output named icon states, only the actual cut icon [Does something similar to walls](40780e9481) Moves reinforced walls decon stuff from their icon to a var on the type and a set of states in the reinforced_states dmi Moves falsewalls into their own dmi, this involved some changes to gamecode to ensure falsewalls knew which dmi to use and what key. Makes falsewalls display as such in editor rather then just walls Moves smoothrock's gibonite overlays into their own file for similar reasons [Same thing different day (Floors)](9a3da3b697) Pulls bespoke floor icon states into their own file, splits up neon carpets into multiple files to make cutting possible [Actually adds the cut templates and their matching png files](1bd8920dc9) Not much to report here, outside of I changed the prefix for bamboo walls to bamboo_wall so it works with false_walls ## Why It's Good For The Game  None should have to manually edit cut dmis. Ever. Also this makes adding a new smoothed thing trivial, don't even need to know what tool you're using to do it. V good v good. Sets us up nicely for wallening's well, wall of sprites. Some structural decisions, we are essentially committing build artifacts here. That's the best way of handling it because otherwise mappers could need to run build.bat before opening a map, and that is stupid! ## Changelog 🆑 refactor: (Almost) all smoothed icons can now be edited in their pre cut forms /🆑
4.0 KiB
Guide to the icon cutter
What are cut icons?
There are some icons in ss13 that are essentially stitched together from a smaller set of icon states.
Smoothing is a prime example of this, though anything that takes a base image and operates on it fits the system nicely.
How does the cutter work?
The cutter has a bunch of different modes, different ways to operate on images. They all take some sort of input, alongside a (.toml) config file that tells us what to DO with the input.
The .toml file will know the cutter mode to use, alongside any config settings. Smoothing configs can use templates instead of copying out a bunch of information, templates are stored in the cutter_templates folder.
The toml file will be named like this. {name}.{input_extension}.toml. So if I have a config mode that uses pngs as input (almost all of them) it'll look like {name}.png.toml
It'll then use the {name}.png file to make {name}.dmi (or whatever the cutter mode outputs)
You should NEVER modify the cutter's output, it'll be erased. You only want to modify the inputs (configs, pngs, etc).
As I mentioned our cutter has several different modes that do different things with different inputs.
Most cutter stuff in our repo uses the BitmaskSlice mode, you can find info about it here
Bitmask Smoothing (BitmaskSlice)
We use bitmask smoothing to make things in the world merge with each other, "smoothing" them together.
This is done by checking around these objects for things that we want to smooth into, and then encoding that as a set of directions. Now, we need icon states for every possible combination of smoothing directions, but it would be impossible to make those manually.
So instead we take a base set of directions, typically no connections, north/south, east/west, north/south/east/west, and all connections, and then slice them up and stitch them together.
Looks something like this
Example: Bamboo
png of 32x32 blocks, representing connections.
[None, North + South, East + West, North + South + East + West, All]
And its output dmi
How do I modify a smoothed icon?
Modify the png, then recompile the game/run build.bat, it will automatically generate the dmi output.
How do I make a smoothed icon?
Make a png file called {dmi_name}.png. It should be 5 times as wide as the dmi's width, and as tall as the dmi's height
Create a config file called {dmi_name}.png.toml, set its template to the style you want. Don't forget to set the output_name var to the base icon state you're using.
Once you're done, just run build.bat or recompile, and it'll generate your cut dmi files for you.
If you want to make something with nonstandard bounds you'll need to set the relevant variables, you can read the examples found here to understand different mode's configs.
Example: Grass (50x50)
If you want to give a particular smoothing junction a unique icon state use the prefabs var, add a new "state" to the png, and modify the config so it knows how to use it.
Example: Donk Carpets (Big Pocket)
If you want to make the smoothed icon animated, add another row of states below your first one. Each new row is a new frame, you define delays inside the config file as deciseconds.
Example: Lava (Animated, 4 Frames)