From 103e184270ccb6af4912c1afefd10ba0db4d9ddc Mon Sep 17 00:00:00 2001 From: MysterD Date: Sat, 1 Apr 2023 17:16:18 -0700 Subject: [PATCH] Make gMarioStates->controller immutable in Lua --- autogen/convert_structs.py | 2 +- docs/lua/structs.md | 2 +- src/pc/lua/smlua_cobject_autogen.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index 48399509..391c8f40 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -78,7 +78,7 @@ override_field_invisible = { } override_field_immutable = { - "MarioState": [ "playerIndex" ], + "MarioState": [ "playerIndex", "controller" ], "Character": [ "*" ], "NetworkPlayer": [ "*" ], "TextureInfo": [ "*" ], diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 519e8ccd..828074fe 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -1042,7 +1042,7 @@ | ceilHeight | `number` | | | character | [Character](structs.md#Character) | | | collidedObjInteractTypes | `integer` | | -| controller | [Controller](structs.md#Controller) | | +| controller | [Controller](structs.md#Controller) | read-only | | curAnimOffset | `number` | | | currentRoom | `integer` | | | doubleJumpTimer | `integer` | | diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 751a7907..ff015aab 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -827,7 +827,7 @@ static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = { { "ceilHeight", LVT_F32, offsetof(struct MarioState, ceilHeight), false, LOT_NONE }, { "character", LVT_COBJECT_P, offsetof(struct MarioState, character), false, LOT_CHARACTER }, { "collidedObjInteractTypes", LVT_U32, offsetof(struct MarioState, collidedObjInteractTypes), false, LOT_NONE }, - { "controller", LVT_COBJECT_P, offsetof(struct MarioState, controller), false, LOT_CONTROLLER }, + { "controller", LVT_COBJECT_P, offsetof(struct MarioState, controller), true, LOT_CONTROLLER }, { "curAnimOffset", LVT_F32, offsetof(struct MarioState, curAnimOffset), false, LOT_NONE }, { "currentRoom", LVT_S16, offsetof(struct MarioState, currentRoom), false, LOT_NONE }, { "doubleJumpTimer", LVT_U8, offsetof(struct MarioState, doubleJumpTimer), false, LOT_NONE },