Skip to content

Add graphics support for building-hacks #4380

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

Open
wants to merge 38 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9a7370f
Add graphics support for building-hacks
warmist Mar 17, 2024
c4266c5
Update to new structures and simplify api a bit
warmist Mar 18, 2024
6ade67e
Fix bugs and refactor lua c api to use indexed access
warmist Mar 18, 2024
b295d57
Update plugin lua module
warmist Mar 18, 2024
c67d685
whitespace fixes
warmist Mar 19, 2024
fe0bc2f
Fix uint32_t getting set to -1
warmist Mar 19, 2024
2cdeee8
Add event to vmethod interpose setTriggerState for lever/trap plate l…
warmist Mar 20, 2024
010928c
big refactor and api cleanup
warmist Mar 24, 2024
3138d3a
Doc update
warmist Mar 24, 2024
cd59595
Fix bad string compare
warmist Mar 24, 2024
16bc0b6
whitespace fixes
warmist Mar 24, 2024
bd09cb5
Add error on failing to find gears for auto-machines and auto-animate
warmist Mar 25, 2024
60e21b9
Add a way to change graphics tiles when auto generating connection po…
warmist Mar 29, 2024
796f480
Fix repeated calling animation creating more and more frames
warmist Mar 29, 2024
11ef74a
Fix graphics bug
warmist Mar 29, 2024
61920e3
Update docs/dev/Lua API.rst
warmist Apr 1, 2024
73f2d23
Switch map to unordered map
warmist Apr 2, 2024
3cd0bc8
Just use 0 as invalid tile marker. It's used in df code like that
warmist Apr 2, 2024
6ce0bcc
Redo the categorize to prevent issue that scripts run after world has…
warmist Apr 2, 2024
6a48246
Redo plugin to auto-enable on first use and expose enabled state to d…
warmist Apr 2, 2024
2a1db17
Fix graphics tile types
warmist Apr 2, 2024
1e68060
docs: add correct tags to the plugin docs
warmist Apr 2, 2024
6faacc0
docs: add note about workshop ids
warmist Apr 5, 2024
aaf3f9c
remove boolean arg from fixImpassible and setOwnableBuilding and doc …
warmist Apr 5, 2024
a975fd9
Allow passing numeric id to auto functions. Tidy up docs api some more.
warmist Apr 5, 2024
e462846
docs: more info about animation tiles
warmist Apr 5, 2024
1439fcb
fix lua syntax error and whitespaces
warmist Apr 5, 2024
9e14ac4
update to new structures
warmist Jun 7, 2024
e8763fe
docs: use bhacks instead of bld in examples
warmist Dec 30, 2024
41a0df5
Don't hold the CoreSuspend over INTERPOSE_NEXT
warmist Dec 30, 2024
5360b98
swap getPower returns to be same as setPower
warmist Dec 30, 2024
b27a61a
docs: change wording on many thingies
warmist Dec 30, 2024
d43fb3a
change how frames are loaded
warmist Dec 30, 2024
3355f6b
saner frameskip logic
warmist Dec 30, 2024
f49d203
docs: update frame doc
warmist Dec 30, 2024
92fa5cf
building-hacks.lua update
warmist Dec 30, 2024
7a79fab
docs: yet another day, yet another doc update. Also improved optional…
warmist Dec 31, 2024
f2c038d
remove coresuspend from vmethod interpose
warmist Jan 1, 2025
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
Prev Previous commit
Next Next commit
Just use 0 as invalid tile marker. It's used in df code like that
  • Loading branch information
warmist committed Jan 1, 2025
commit 3cd0bc89f503da25e35b161da8fcd09e76181b1d
10 changes: 5 additions & 5 deletions plugins/building-hacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using namespace df::enums;
DFHACK_PLUGIN("building-hacks");
REQUIRE_GLOBAL(world);

constexpr uint32_t invalid_tile = std::numeric_limits<uint32_t>::max();
constexpr uint32_t invalid_tile = 0;
struct graphic_tile //could do just 31x31 and be done, but it's nicer to have flexible imho.
{
int16_t tile=-1; //originally uint8_t but we need to indicate non-animated tiles
Expand Down Expand Up @@ -419,19 +419,19 @@ static void loadFrames(lua_State* L,workshop_hack_data& def,int stack_pos)
lua_pop(L,1);

lua_geti(L, -1, 5);
t.graphics_tile = luaL_optinteger(L, -1,-1);
t.graphics_tile = luaL_optinteger(L, -1,invalid_tile);
lua_pop(L, 1);

lua_geti(L, -1, 6);
t.overlay_tile = luaL_optinteger(L, -1, -1);
t.overlay_tile = luaL_optinteger(L, -1, invalid_tile);
lua_pop(L, 1);

lua_geti(L, -1, 7);
t.signpost_tile = luaL_optinteger(L, -1, -1);
t.signpost_tile = luaL_optinteger(L, -1, invalid_tile);
lua_pop(L, 1);

lua_geti(L, -1, 8);
t.item_tile = luaL_optinteger(L, -1, -1);
t.item_tile = luaL_optinteger(L, -1, invalid_tile);
lua_pop(L, 1);

lua_pop(L, 1); //pop current tile
Expand Down