Skip to content

Commit

Permalink
fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Oct 5, 2023
1 parent ae5241f commit 1b9ea22
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 53 deletions.
9 changes: 8 additions & 1 deletion docs/game_data/spel2.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion docs/src/includes/_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,9 @@ Type | Name | Description
[Logic](#Logic) | [arena_3](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arena_3) | Handles time end death
[LogicArenaAlienBlast](#LogicArenaAlienBlast) | [arena_alien_blast](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arena_alien_blast) |
[LogicArenaLooseBombs](#LogicArenaLooseBombs) | [arena_loose_bombs](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arena_loose_bombs) |
| [start_logic](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=start_logic) |
[Logic](#Logic) | [start_logic(LOGIC idx)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=start_logic) | This only properly constructs the base class<br/>you may still need to initialise the parameters correctly
nil | [stop_logic(LOGIC idx)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=stop_logic) |
nil | [stop_logic(Logic log)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=stop_logic) |

### LogicMagmamanSpawn

Expand Down
104 changes: 53 additions & 51 deletions src/game_api/script/usertypes/logic_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,58 @@ void register_usertypes(sol::state& lua)
"ARENA_LOOSE_BOMBS",
LOGIC::ARENA_LOOSE_BOMBS);

auto start_logic = [&lua](LogicList& l, LOGIC idx) -> sol::object
{
auto return_logic = l.start_logic(idx);
switch (idx)
{
case LOGIC::TUTORIAL:
return sol::make_object(lua, (LogicTutorial*)return_logic);
case LOGIC::OUROBOROS:
return sol::make_object(lua, (LogicOuroboros*)return_logic);
case LOGIC::SPEEDRUN:
return sol::make_object(lua, (LogicBasecampSpeedrun*)return_logic);
case LOGIC::GHOST_TOAST:
return sol::make_object(lua, (LogicGhostToast*)return_logic);
case LOGIC::DICESHOP:
return sol::make_object(lua, (LogicDiceShop*)return_logic);
case LOGIC::PRE_CHALLENGE:
return sol::make_object(lua, (LogicTunPreChallenge*)return_logic);
case LOGIC::MOON_CHALLENGE:
return sol::make_object(lua, (LogicMoonChallenge*)return_logic);
case LOGIC::STAR_CHALLENGE:
return sol::make_object(lua, (LogicStarChallenge*)return_logic);
case LOGIC::SUN_CHALLENGE:
return sol::make_object(lua, (LogicSunChallenge*)return_logic);
case LOGIC::MAGMAN_SPAWN:
return sol::make_object(lua, (LogicMagmamanSpawn*)return_logic);
case LOGIC::WATER_BUBBLES:
return sol::make_object(lua, (LogicUnderwaterBubbles*)return_logic);
case LOGIC::OLMEC_CUTSCENE:
return sol::make_object(lua, (LogicOlmecCutscene*)return_logic);
case LOGIC::TIAMAT_CUTSCENE:
return sol::make_object(lua, (LogicTiamatCutscene*)return_logic);
case LOGIC::APEP:
return sol::make_object(lua, (LogicApepTrigger*)return_logic);
case LOGIC::COG_SACRIFICE:
return sol::make_object(lua, (LogicCOGAnkhSacrifice*)return_logic);
case LOGIC::BUBBLER:
return sol::make_object(lua, (LogicTiamatBubbles*)return_logic);
case LOGIC::PLEASURE_PALACE:
return sol::make_object(lua, (LogicTuskPleasurePalace*)return_logic);
case LOGIC::ARENA_1:
return sol::make_object(lua, (LogicArena1*)return_logic);
// case LOGIC::ARENA_2:
// return sol::make_object(lua, () return_logic);
case LOGIC::ARENA_ALIEN_BLAST:
return sol::make_object(lua, (LogicArenaAlienBlast*)return_logic);
case LOGIC::ARENA_LOOSE_BOMBS:
return sol::make_object(lua, (LogicArenaLooseBombs*)return_logic);
default:
return sol::make_object(lua, return_logic);
}
};

/// Used in StateMemory
lua.new_usertype<LogicList>(
"LogicList",
Expand Down Expand Up @@ -136,57 +188,7 @@ void register_usertypes(sol::state& lua)
"arena_loose_bombs",
&LogicList::arena_loose_bombs,
"start_logic",
[&lua](LogicList& l, LOGIC idx) -> sol::object // -> mixed*
{
auto return_logic = l.start_logic(idx);
switch (idx)
{
case LOGIC::TUTORIAL:
return sol::make_object(lua, (LogicTutorial*)return_logic);
case LOGIC::OUROBOROS:
return sol::make_object(lua, (LogicOuroboros*)return_logic);
case LOGIC::SPEEDRUN:
return sol::make_object(lua, (LogicBasecampSpeedrun*)return_logic);
case LOGIC::GHOST_TOAST:
return sol::make_object(lua, (LogicGhostToast*)return_logic);
case LOGIC::DICESHOP:
return sol::make_object(lua, (LogicDiceShop*)return_logic);
case LOGIC::PRE_CHALLENGE:
return sol::make_object(lua, (LogicTunPreChallenge*)return_logic);
case LOGIC::MOON_CHALLENGE:
return sol::make_object(lua, (LogicMoonChallenge*)return_logic);
case LOGIC::STAR_CHALLENGE:
return sol::make_object(lua, (LogicStarChallenge*)return_logic);
case LOGIC::SUN_CHALLENGE:
return sol::make_object(lua, (LogicSunChallenge*)return_logic);
case LOGIC::MAGMAN_SPAWN:
return sol::make_object(lua, (LogicMagmamanSpawn*)return_logic);
case LOGIC::WATER_BUBBLES:
return sol::make_object(lua, (LogicUnderwaterBubbles*)return_logic);
case LOGIC::OLMEC_CUTSCENE:
return sol::make_object(lua, (LogicOlmecCutscene*)return_logic);
case LOGIC::TIAMAT_CUTSCENE:
return sol::make_object(lua, (LogicTiamatCutscene*)return_logic);
case LOGIC::APEP:
return sol::make_object(lua, (LogicApepTrigger*)return_logic);
case LOGIC::COG_SACRIFICE:
return sol::make_object(lua, (LogicCOGAnkhSacrifice*)return_logic);
case LOGIC::BUBBLER:
return sol::make_object(lua, (LogicTiamatBubbles*)return_logic);
case LOGIC::PLEASURE_PALACE:
return sol::make_object(lua, (LogicTuskPleasurePalace*)return_logic);
case LOGIC::ARENA_1:
return sol::make_object(lua, (LogicArena1*)return_logic);
// case LOGIC::ARENA_2:
// return sol::make_object(lua, () return_logic);
case LOGIC::ARENA_ALIEN_BLAST:
return sol::make_object(lua, (LogicArenaAlienBlast*)return_logic);
case LOGIC::ARENA_LOOSE_BOMBS:
return sol::make_object(lua, (LogicArenaLooseBombs*)return_logic);
default:
return sol::make_object(lua, return_logic);
}
},
start_logic,
"stop_logic",
stop_logic);
/// Used in LogicList
Expand Down

0 comments on commit 1b9ea22

Please sign in to comment.