Skip to content

Commit

Permalink
[MISSED MIRROR] Icon Autoslicing (#79659) (#25485)
Browse files Browse the repository at this point in the history
* Icon Autoslicing (#79659)

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](tgstation/tgstation@52143d2)

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](tgstation/tgstation@21eeab9)

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](tgstation/tgstation@a730e0c)

This is required because the cutter cannot output named icon states,
only the actual cut icon

[Does something similar to
walls](tgstation/tgstation@40780e9)

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)](tgstation/tgstation@9a3da3b)

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](tgstation/tgstation@1bd8920)

Not much to report here, outside of I changed the prefix for bamboo
walls to bamboo_wall so it works with false_walls

![image](https://github.com/tgstation/tgstation/assets/58055496/7c3ac7fb-873c-481b-8667-082e39432876)

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!

:cl:
refactor: (Almost) all smoothed icons can now be edited in their pre cut
forms
/:cl:

* Update false_walls.dm

* Modular

* Fixes override for reinforced walls, removals skyrat edits in favor of overrides

---------

Co-authored-by: LemonInTheDark <[email protected]>
  • Loading branch information
vinylspiders and LemonInTheDark authored Dec 8, 2023
1 parent 877ff44 commit 6c823ee
Show file tree
Hide file tree
Showing 377 changed files with 1,116 additions and 87 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ci_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ jobs:
with:
path: ~/.cargo
key: ${{ runner.os }}-rust
- name: Restore Cutter cache
uses: actions/cache@v3
with:
path: tools/icon_cutter/cache
key: ${{ runner.os }}-cutter-${{ hashFiles('dependencies.sh') }}
- name: Install Tools
run: |
pip3 install setuptools
Expand Down Expand Up @@ -90,6 +95,9 @@ jobs:
run: |
tools/bootstrap/python -m mapmerge2.dmm_test
tools/bootstrap/python -m tools.maplint.source
- name: Check Cutter
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: tools/bootstrap/python -m tools.icon_cutter.check
- name: Run DMI Tests
if: steps.linter-setup.conclusion == 'success' && !cancelled()
run: tools/bootstrap/python -m dmi.test
Expand All @@ -110,7 +118,7 @@ jobs:
if: ( !contains(github.event.head_commit.message, '[ci skip]') )
name: Compile Maps
needs: [collect_data]
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
concurrency:
group: compile_all_maps-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand All @@ -135,7 +143,7 @@ jobs:
collect_data:
if: ( !contains(github.event.head_commit.message, '[ci skip]') )
name: Collect data for other tasks
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
maps: ${{ steps.map_finder.outputs.maps }}
alternate_tests: ${{ steps.alternate_test_finder.outputs.alternate_tests }}
Expand Down Expand Up @@ -201,15 +209,15 @@ jobs:
if: ( !contains(github.event.head_commit.message, '[ci skip]') && needs.find_all_maps.outputs.alternate_tests != '[]' )
name: Check Alternate Tests
needs: [run_alternate_tests]
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- run: echo Alternate tests passed.

compare_screenshots:
if: ( !contains(github.event.head_commit.message, '[ci skip]') && (success() || failure()) )
needs: [run_all_tests, run_alternate_tests]
name: Compare Screenshot Tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
# If we ever add more artifacts, this is going to break, but it'll be obvious.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compile_changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
compile:
name: "Compile changelogs"
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: "Check for ACTION_ENABLER secret and pass true to output if it exists to be checked by later steps"
id: value_holder
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
permissions:
contents: write # for JamesIves/github-pages-deploy-action to push changes in repo
if: ( !contains(github.event.head_commit.message, '[ci skip]') )
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
concurrency: gen-docs
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_emoji.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:

jobs:
title_and_changelog:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: Wayland-Smithy/emoji-stripper-action@de0c1d158edee50700583d6454aa5f5117337599
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/round_id_linker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
link_rounds:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: tgstation/round_linker@master
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/show_screenshot_test_results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
show_screenshot_test_results:
if: ( !contains(github.event.head_commit.message, '[ci skip]') && github.event.workflow_run.run_attempt == 1 )
name: Show Screenshot Test Results
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: "Check for ARTIFACTS_FILE_HOUSE_KEY"
id: secrets_set
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
permissions:
issues: write # for actions/stale to close stale issues
pull-requests: write # for actions/stale to close stale PRs
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/stale@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_merge_bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
test_merge_bot:
name: Test Merge Detector
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Check for GET_TEST_MERGES_URL
id: secrets_set
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_tgs_dmapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
update-dmapi:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: Update the TGS DMAPI
steps:
- name: Clone
Expand Down
4 changes: 2 additions & 2 deletions _maps/map_files/Mafia/mafia_spiderclan.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
name = "Station Night Shutters"
},
/turf/closed/indestructible/fakeglass{
icon = 'icons/obj/smooth_structures/paperframes.dmi';
icon_state = "paper"
icon = 'icons/obj/smooth_structures/structure_variations.dmi';
icon_state = "paper-whole"
},
/area/centcom/mafia)
"q" = (
Expand Down
80 changes: 44 additions & 36 deletions code/game/objects/structures/false_walls.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
name = "wall"
desc = "A huge chunk of metal used to separate rooms."
anchored = TRUE
//icon = 'icons/turf/walls/wall.dmi' //ORIGINAL
icon = 'modular_skyrat/modules/aesthetics/walls/icons/wall.dmi' //SKYRAT EDIT CHANGE - AESTHETICS
icon_state = "wall-0"
icon = 'icons/turf/walls/false_walls.dmi'
icon_state = "wall-open"
base_icon_state = "wall"
layer = LOW_OBJ_LAYER
density = TRUE
Expand All @@ -20,6 +19,8 @@
can_atmos_pass = ATMOS_PASS_DENSITY
rad_insulation = RAD_MEDIUM_INSULATION
material_flags = MATERIAL_EFFECTS
/// The icon this falsewall is faking being. we'll switch out our icon with this when we're in fake mode
var/fake_icon = 'icons/turf/walls/wall.dmi'
var/mineral = /obj/item/stack/sheet/iron
var/mineral_amount = 2
var/walltype = /turf/closed/wall
Expand Down Expand Up @@ -72,9 +73,15 @@

/obj/structure/falsewall/update_icon_state()
if(opening)
icon_state = "fwall_[density ? "opening" : "closing"]"
icon = fake_icon
icon_state = "[base_icon_state]-[density ? "opening" : "closing"]"
return ..()
icon_state = density ? "[base_icon_state]-[smoothing_junction]" : "fwall_open"
if(density)
icon = initial(icon)
icon_state = "[base_icon_state]-[smoothing_junction]"
else
icon = fake_icon
icon_state = "[base_icon_state]-open"
return ..()

/obj/structure/falsewall/proc/ChangeToWall(delete = 1)
Expand Down Expand Up @@ -149,9 +156,8 @@
/obj/structure/falsewall/reinforced
name = "reinforced wall"
desc = "A huge chunk of reinforced metal used to separate rooms."
//icon = 'icons/turf/walls/reinforced_wall.dmi'
icon = 'modular_skyrat/modules/aesthetics/walls/icons/reinforced_wall.dmi' //SKYRAT EDIT CHANGE - AESTHETICS
icon_state = "reinforced_wall-0"
fake_icon = 'icons/turf/walls/reinforced_wall.dmi'
icon_state = "reinforced_wall-open"
base_icon_state = "reinforced_wall"
walltype = /turf/closed/wall/r_wall
mineral = /obj/item/stack/sheet/plasteel
Expand All @@ -173,8 +179,8 @@
/obj/structure/falsewall/uranium
name = "uranium wall"
desc = "A wall with uranium plating. This is probably a bad idea."
icon = 'icons/turf/walls/uranium_wall.dmi'
icon_state = "uranium_wall-0"
fake_icon = 'icons/turf/walls/uranium_wall.dmi'
icon_state = "uranium_wall-open"
base_icon_state = "uranium_wall"
mineral = /obj/item/stack/sheet/mineral/uranium
walltype = /turf/closed/wall/mineral/uranium
Expand Down Expand Up @@ -224,8 +230,8 @@
/obj/structure/falsewall/gold
name = "gold wall"
desc = "A wall with gold plating. Swag!"
icon = 'icons/turf/walls/gold_wall.dmi'
icon_state = "gold_wall-0"
fake_icon = 'icons/turf/walls/gold_wall.dmi'
icon_state = "gold_wall-open"
base_icon_state = "gold_wall"
mineral = /obj/item/stack/sheet/mineral/gold
walltype = /turf/closed/wall/mineral/gold
Expand All @@ -236,8 +242,8 @@
/obj/structure/falsewall/silver
name = "silver wall"
desc = "A wall with silver plating. Shiny."
icon = 'icons/turf/walls/silver_wall.dmi'
icon_state = "silver_wall-0"
fake_icon = 'icons/turf/walls/silver_wall.dmi'
icon_state = "silver_wall-open"
base_icon_state = "silver_wall"
mineral = /obj/item/stack/sheet/mineral/silver
walltype = /turf/closed/wall/mineral/silver
Expand All @@ -248,8 +254,8 @@
/obj/structure/falsewall/diamond
name = "diamond wall"
desc = "A wall with diamond plating. You monster."
icon = 'icons/turf/walls/diamond_wall.dmi'
icon_state = "diamond_wall-0"
fake_icon = 'icons/turf/walls/diamond_wall.dmi'
icon_state = "diamond_wall-open"
base_icon_state = "diamond_wall"
mineral = /obj/item/stack/sheet/mineral/diamond
walltype = /turf/closed/wall/mineral/diamond
Expand All @@ -261,8 +267,8 @@
/obj/structure/falsewall/plasma
name = "plasma wall"
desc = "A wall with plasma plating. This is definitely a bad idea."
icon = 'icons/turf/walls/plasma_wall.dmi'
icon_state = "plasma_wall-0"
fake_icon = 'icons/turf/walls/plasma_wall.dmi'
icon_state = "plasma_wall-open"
base_icon_state = "plasma_wall"
mineral = /obj/item/stack/sheet/mineral/plasma
walltype = /turf/closed/wall/mineral/plasma
Expand All @@ -273,8 +279,8 @@
/obj/structure/falsewall/bananium
name = "bananium wall"
desc = "A wall with bananium plating. Honk!"
icon = 'icons/turf/walls/bananium_wall.dmi'
icon_state = "bananium_wall-0"
fake_icon = 'icons/turf/walls/bananium_wall.dmi'
icon_state = "bananium_wall-open"
base_icon_state = "bananium_wall"
mineral = /obj/item/stack/sheet/mineral/bananium
walltype = /turf/closed/wall/mineral/bananium
Expand All @@ -286,8 +292,8 @@
/obj/structure/falsewall/sandstone
name = "sandstone wall"
desc = "A wall with sandstone plating. Rough."
icon = 'icons/turf/walls/sandstone_wall.dmi'
icon_state = "sandstone_wall-0"
fake_icon = 'icons/turf/walls/sandstone_wall.dmi'
icon_state = "sandstone_wall-open"
base_icon_state = "sandstone_wall"
mineral = /obj/item/stack/sheet/mineral/sandstone
walltype = /turf/closed/wall/mineral/sandstone
Expand All @@ -298,8 +304,8 @@
/obj/structure/falsewall/wood
name = "wooden wall"
desc = "A wall with wooden plating. Stiff."
icon = 'icons/turf/walls/wood_wall.dmi'
icon_state = "wood_wall-0"
fake_icon = 'icons/turf/walls/wood_wall.dmi'
icon_state = "wood_wall-open"
base_icon_state = "wood_wall"
mineral = /obj/item/stack/sheet/mineral/wood
walltype = /turf/closed/wall/mineral/wood
Expand All @@ -310,7 +316,9 @@
/obj/structure/falsewall/bamboo
name = "bamboo wall"
desc = "A wall with bamboo finish. Zen."
icon = 'icons/turf/walls/bamboo_wall.dmi'
fake_icon = 'icons/turf/walls/bamboo_wall.dmi'
icon_state = "bamboo_wall-open"
base_icon_state = "bamboo_wall"
mineral = /obj/item/stack/sheet/mineral/bamboo
walltype = /turf/closed/wall/mineral/bamboo
smoothing_flags = SMOOTH_BITMASK
Expand All @@ -320,8 +328,8 @@
/obj/structure/falsewall/iron
name = "rough iron wall"
desc = "A wall with rough metal plating."
icon = 'icons/turf/walls/iron_wall.dmi'
icon_state = "iron_wall-0"
fake_icon = 'icons/turf/walls/iron_wall.dmi'
icon_state = "iron_wall-open"
base_icon_state = "iron_wall"
mineral = /obj/item/stack/rods
mineral_amount = 5
Expand All @@ -334,8 +342,8 @@
/obj/structure/falsewall/abductor
name = "alien wall"
desc = "A wall with alien alloy plating."
icon = 'icons/turf/walls/abductor_wall.dmi'
icon_state = "abductor_wall-0"
fake_icon = 'icons/turf/walls/abductor_wall.dmi'
icon_state = "abductor_wall-open"
base_icon_state = "abductor_wall"
mineral = /obj/item/stack/sheet/mineral/abductor
walltype = /turf/closed/wall/mineral/abductor
Expand All @@ -346,8 +354,8 @@
/obj/structure/falsewall/titanium
name = "wall"
desc = "A light-weight titanium wall used in shuttles."
icon = 'icons/turf/walls/shuttle_wall.dmi'
icon_state = "shuttle_wall-0"
fake_icon = 'icons/turf/walls/shuttle_wall.dmi'
icon_state = "shuttle_wall-open"
base_icon_state = "shuttle_wall"
mineral = /obj/item/stack/sheet/mineral/titanium
walltype = /turf/closed/wall/mineral/titanium
Expand All @@ -358,8 +366,8 @@
/obj/structure/falsewall/plastitanium
name = "wall"
desc = "An evil wall of plasma and titanium."
icon = 'icons/turf/walls/plastitanium_wall.dmi'
icon_state = "plastitanium_wall-0"
fake_icon = 'icons/turf/walls/plastitanium_wall.dmi'
icon_state = "plastitanium_wall-open"
base_icon_state = "plastitanium_wall"
mineral = /obj/item/stack/sheet/mineral/plastitanium
walltype = /turf/closed/wall/mineral/plastitanium
Expand All @@ -370,9 +378,9 @@
/obj/structure/falsewall/material
name = "wall"
desc = "A huge chunk of material used to separate rooms."
icon = 'icons/turf/walls/materialwall.dmi'
icon_state = "materialwall-0"
base_icon_state = "materialwall"
fake_icon = 'icons/turf/walls/material_wall.dmi'
icon_state = "material_wall-open"
base_icon_state = "material_wall"
walltype = /turf/closed/wall/material
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = SMOOTH_GROUP_WALLS + SMOOTH_GROUP_CLOSED_TURFS + SMOOTH_GROUP_MATERIAL_WALLS
Expand Down
9 changes: 5 additions & 4 deletions code/game/objects/structures/window.dm
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,8 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/window/reinforced/tinted/frosted/spaw
bash_sound = 'sound/weapons/slashmiss.ogg'
break_sound = 'sound/items/poster_ripped.ogg'
hit_sound = 'sound/weapons/slashmiss.ogg'
var/static/mutable_appearance/torn = mutable_appearance('icons/obj/smooth_structures/paperframes.dmi',icon_state = "torn", layer = ABOVE_OBJ_LAYER - 0.1)
var/static/mutable_appearance/paper = mutable_appearance('icons/obj/smooth_structures/paperframes.dmi',icon_state = "paper", layer = ABOVE_OBJ_LAYER - 0.1)
var/static/mutable_appearance/torn = mutable_appearance('icons/obj/smooth_structures/structure_variations.dmi',icon_state = "paper-torn", layer = ABOVE_OBJ_LAYER - 0.1)
var/static/mutable_appearance/paper = mutable_appearance('icons/obj/smooth_structures/structure_variations.dmi',icon_state = "paper-whole", layer = ABOVE_OBJ_LAYER - 0.1)

/obj/structure/window/paperframe/Initialize(mapload)
. = ..()
Expand Down Expand Up @@ -927,14 +927,15 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/window/reinforced/tinted/frosted/spaw
/obj/structure/window/bronze
name = "brass window"
desc = "A paper-thin pane of translucent yet reinforced brass. Nevermind, this is just weak bronze!"
icon = 'icons/obj/smooth_structures/clockwork_window.dmi'
icon_state = "clockwork_window_single"
icon = 'icons/obj/smooth_structures/structure_variations.dmi'
icon_state = "clockwork_window-single"
glass_type = /obj/item/stack/sheet/bronze

/obj/structure/window/bronze/unanchored
anchored = FALSE

/obj/structure/window/bronze/fulltile
icon = 'icons/obj/smooth_structures/clockwork_window.dmi'
icon_state = "clockwork_window-0"
base_icon_state = "clockwork_window"
smoothing_flags = SMOOTH_BITMASK
Expand Down
Loading

0 comments on commit 6c823ee

Please sign in to comment.