Fix set lua textures with numbers#4867
Merged
Loobinex merged 4 commits intoJun 3, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates Lua-facing texture selection to support numeric IDs (0-based) alongside named texture packs, and aligns internal storage/index conversions for player textures and map default textures.
Changes:
- Add numeric/negative handling in Lua
Set_textureandMAP.default_texturesetter. - Convert between 0-based (Lua numeric) and 1-based (internal/enum) texture IDs.
- Adjust slab texture reset behavior to use negative IDs as “reset”.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/slab_data.c | Changes reset conditions and normalization for player texture selection. |
| src/lua_api_player.c | Allows numeric texture IDs in Lua player texture API; maps indices/reset values. |
| src/lua_api_map.c | Adjusts MAP.default_texture get/set to support 0-based numeric IDs and internal 1-based storage. |
Comments suppressed due to low confidence (1)
src/lua_api_map.c:1
- If
get_conf_parameter_text()returns an empty string andgame.texture_idis0, this will push-1to Lua. That’s likely unintended for a getter. Consider guarding the subtraction (eg. only subtract whengame.texture_id > 0, otherwise return0or a sentinel likenil), or ensuregame.texture_idcannot be0in the “custom/empty name” case.
#include "pre_inc.h"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PieterVdc
reviewed
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #4813.
This change introduces a consistent texture ID scheme for both PLAYER:set_texture() and Map.default_texture:
Integer IDs are now 0-based (0 = tmapa000.dat).
-1 is used as the reset value for set_texture.
Named texture strings continue to work as before.
Integer and string inputs are handled separately to avoid ID translation issues.