Restored OOB death + De-sorted fields + Read-Only marked as protected (#921)
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run

* De-sort fields + Add `protected`

This fixes the atrocious ordering in autocomplete (a,b,g,r 😭)
also adds the protected scope for read-only fields

_ReadOnlyTable revision

* Restored OOB death (when alone)

also bubbles the player

* Rerun autogen

* Peachy Review

* kill goto

* Curly Brace
This commit is contained in:
Cooliokid956 2025-08-28 11:06:55 -05:00 committed by GitHub
parent 5f1a2d0b42
commit 85ab20357d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 2327 additions and 2319 deletions

View file

@ -283,7 +283,7 @@ def table_to_string(table):
############################################################################
def parse_struct(struct_str, sortFields = True):
def parse_struct(struct_str, sortFields = False):
struct = {}
struct_str = strip_anonymous_blocks(struct_str) # Allow unions and sub-structs to be accessed
match = re.match(r"struct\s*(\w+)?\s*{(.*?)}\s*(\w+)?\s*", struct_str.replace("typedef ", ""), re.DOTALL)
@ -335,7 +335,7 @@ def parse_struct(struct_str, sortFields = True):
return struct
def parse_structs(extracted, sortFields = True):
def parse_structs(extracted, sortFields = False):
structs = []
for e in extracted:
for struct in e['structs']:
@ -582,7 +582,10 @@ def build_structs(structs):
for struct in structs:
if struct['identifier'] in exclude_structs:
continue
oldFields = struct['fields']
struct['fields'] = sorted(struct['fields'], key=lambda d: d['identifier'])
s += build_struct(struct) + '\n'
struct['fields'] = oldFields
return s
def build_body(parsed):
@ -765,8 +768,10 @@ def def_struct(struct):
ftype = translate_to_def(ftype)
if ftype.startswith('Pointer_') and ftype not in def_pointers:
def_pointers.append(ftype)
fscope = "protected" if fimmutable == "true" else "public"
s += '--- @field public %s %s\n' % (fid, ftype)
s += '--- @field %s %s %s\n' % (fscope, fid, ftype)
return s

View file

@ -17,8 +17,8 @@ _ReadOnlyTable = {
local _table = rawget(t, '_table')
return _table[k]
end,
__newindex = function (t,k,v)
end
__newindex = function (_,k,_) error('Attempting to modify key `' .. k .. '` of read-only table') end,
__metatable = false
}
-----------

View file

@ -19,8 +19,8 @@ _ReadOnlyTable = {
local _table = rawget(t, '_table')
return _table[k]
end,
__newindex = function (t,k,v)
end
__newindex = function (_,k,_) error('Attempting to modify key `' .. k .. '` of read-only table') end,
__metatable = false
}
-----------

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1517,7 +1517,6 @@ void update_mario_joystick_inputs(struct MarioState *m) {
*/
void update_mario_geometry_inputs(struct MarioState *m) {
if (!m) { return; }
resetGoto:;
f32 gasLevel;
f32 ceilToFloorDist;
@ -1573,15 +1572,19 @@ resetGoto:;
m->input |= INPUT_IN_POISON_GAS;
}
} else if (!is_other_player_active()) {
level_trigger_warp(m, WARP_OP_DEATH);
} else {
vec3f_set(m->pos, m->spawnInfo->startPos[0], m->spawnInfo->startPos[1], m->spawnInfo->startPos[2]);
vec3s_to_vec3f(m->pos, m->spawnInfo->startPos);
m->faceAngle[1] = m->spawnInfo->startAngle[1];
if (mario_can_bubble(m)) { mario_set_bubbled(m); }
struct Surface* floor = NULL;
find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
if (floor == NULL) {
level_trigger_warp(m, WARP_OP_DEATH);
} else {
goto resetGoto;
update_mario_geometry_inputs(m);
return;
}
}
}

View file

@ -16,8 +16,8 @@ char gSmluaConstants[] = ""
"local _table = rawget(t, '_table')\n"
"return _table[k]\n"
"end,\n"
"__newindex = function (t,k,v)\n"
"end\n"
"__newindex = function (_,k,_) error('Attempting to modify key `' .. k .. '` of read-only table') end,\n"
"__metatable = false\n"
"}\n"
"-----------\n"
"-- table --\n"