mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
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
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:
parent
5f1a2d0b42
commit
85ab20357d
7 changed files with 2327 additions and 2319 deletions
|
|
@ -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 = {}
|
||||||
struct_str = strip_anonymous_blocks(struct_str) # Allow unions and sub-structs to be accessed
|
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)
|
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
|
return struct
|
||||||
|
|
||||||
def parse_structs(extracted, sortFields = True):
|
def parse_structs(extracted, sortFields = False):
|
||||||
structs = []
|
structs = []
|
||||||
for e in extracted:
|
for e in extracted:
|
||||||
for struct in e['structs']:
|
for struct in e['structs']:
|
||||||
|
|
@ -582,7 +582,10 @@ def build_structs(structs):
|
||||||
for struct in structs:
|
for struct in structs:
|
||||||
if struct['identifier'] in exclude_structs:
|
if struct['identifier'] in exclude_structs:
|
||||||
continue
|
continue
|
||||||
|
oldFields = struct['fields']
|
||||||
|
struct['fields'] = sorted(struct['fields'], key=lambda d: d['identifier'])
|
||||||
s += build_struct(struct) + '\n'
|
s += build_struct(struct) + '\n'
|
||||||
|
struct['fields'] = oldFields
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def build_body(parsed):
|
def build_body(parsed):
|
||||||
|
|
@ -765,8 +768,10 @@ def def_struct(struct):
|
||||||
ftype = translate_to_def(ftype)
|
ftype = translate_to_def(ftype)
|
||||||
if ftype.startswith('Pointer_') and ftype not in def_pointers:
|
if ftype.startswith('Pointer_') and ftype not in def_pointers:
|
||||||
def_pointers.append(ftype)
|
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
|
return s
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ _ReadOnlyTable = {
|
||||||
local _table = rawget(t, '_table')
|
local _table = rawget(t, '_table')
|
||||||
return _table[k]
|
return _table[k]
|
||||||
end,
|
end,
|
||||||
__newindex = function (t,k,v)
|
__newindex = function (_,k,_) error('Attempting to modify key `' .. k .. '` of read-only table') end,
|
||||||
end
|
__metatable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ _ReadOnlyTable = {
|
||||||
local _table = rawget(t, '_table')
|
local _table = rawget(t, '_table')
|
||||||
return _table[k]
|
return _table[k]
|
||||||
end,
|
end,
|
||||||
__newindex = function (t,k,v)
|
__newindex = function (_,k,_) error('Attempting to modify key `' .. k .. '` of read-only table') end,
|
||||||
end
|
__metatable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
1638
docs/lua/structs.md
1638
docs/lua/structs.md
File diff suppressed because it is too large
Load diff
|
|
@ -1517,7 +1517,6 @@ void update_mario_joystick_inputs(struct MarioState *m) {
|
||||||
*/
|
*/
|
||||||
void update_mario_geometry_inputs(struct MarioState *m) {
|
void update_mario_geometry_inputs(struct MarioState *m) {
|
||||||
if (!m) { return; }
|
if (!m) { return; }
|
||||||
resetGoto:;
|
|
||||||
|
|
||||||
f32 gasLevel;
|
f32 gasLevel;
|
||||||
f32 ceilToFloorDist;
|
f32 ceilToFloorDist;
|
||||||
|
|
@ -1573,15 +1572,19 @@ resetGoto:;
|
||||||
m->input |= INPUT_IN_POISON_GAS;
|
m->input |= INPUT_IN_POISON_GAS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (!is_other_player_active()) {
|
||||||
|
level_trigger_warp(m, WARP_OP_DEATH);
|
||||||
} else {
|
} 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];
|
m->faceAngle[1] = m->spawnInfo->startAngle[1];
|
||||||
|
if (mario_can_bubble(m)) { mario_set_bubbled(m); }
|
||||||
struct Surface* floor = NULL;
|
struct Surface* floor = NULL;
|
||||||
find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
|
find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
|
||||||
if (floor == NULL) {
|
if (floor == NULL) {
|
||||||
level_trigger_warp(m, WARP_OP_DEATH);
|
level_trigger_warp(m, WARP_OP_DEATH);
|
||||||
} else {
|
} else {
|
||||||
goto resetGoto;
|
update_mario_geometry_inputs(m);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ char gSmluaConstants[] = ""
|
||||||
"local _table = rawget(t, '_table')\n"
|
"local _table = rawget(t, '_table')\n"
|
||||||
"return _table[k]\n"
|
"return _table[k]\n"
|
||||||
"end,\n"
|
"end,\n"
|
||||||
"__newindex = function (t,k,v)\n"
|
"__newindex = function (_,k,_) error('Attempting to modify key `' .. k .. '` of read-only table') end,\n"
|
||||||
"end\n"
|
"__metatable = false\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"-----------\n"
|
"-----------\n"
|
||||||
"-- table --\n"
|
"-- table --\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue