Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua API features and goals #28

Open
Tracked by #13
Dregu opened this issue Feb 4, 2021 · 16 comments
Open
Tracked by #13

Lua API features and goals #28

Dregu opened this issue Feb 4, 2021 · 16 comments
Labels
lua Issues with the Lua api

Comments

@Dregu
Copy link
Collaborator

Dregu commented Feb 4, 2021

Feel free to dump your ideas and required functions for the Lua scripting API here.

@Dregu Dregu added the lua Issues with the Lua api label Feb 4, 2021
@sjtower
Copy link

sjtower commented Feb 9, 2021

Thank you for all your work, Dregu!

I don't know anything about Lua scripts, what kinds of things could we use them for in Spelunky2?
Just off the bat, it would be cool if we could load in enemies and traps that are not in the level editor. This would require integrating more tightly with the editor.

@d11z
Copy link
Contributor

d11z commented Feb 9, 2021

I think the Lua API should allow access to primitive drawing using imgui (line, text, etc). Or maybe even simpler, just a boolean to toggle showing an entity's hitbox.

@0novo
Copy link

0novo commented Mar 30, 2021

An enum for search flags would be a great addition, especially since it's entirely reliant on your memorization skills right now

@Mr-Auto
Copy link
Contributor

Mr-Auto commented Apr 23, 2021

Can we also get event's on_entity_spawn with uid as argument (ideally run before the item is drawn on screen), on_entity_kill or before_entity_kill with uid, actually why events never have arguments? can they have them even? like on_level giving you a level number, on_win giving info what win it is etc.

@SuperNinjaFat
Copy link

Currently, spawning LIQUID_* entities with spawn_entity() results in a crash. A fix for this or a workaround would be appreciated.

Another related topic; having increased liquid pools for areas in which liquid is problematic would be useful.
For instance, currently on olmec, any liquid other than LIQUID_STAGNANT_LAVA won't work.

@0novo
Copy link

0novo commented Jun 9, 2021

Some things that would be nice to have:

  1. Expand BUTTON enum to include movement (e.g. left = 0x100, right = 0x200, up, down), also maybe change the numbers to hex on the script doc (currently it goes 1, 2, 4, 8, 16, 32 instead of 0x1, 0x2, 0x4, 0x8, 0x10, 0x20) [Edit: now that I think about it, don't_ expand the enum or else people will get confused]
  2. PLAYER_STATE (CHAR_STATE?) enum (e.g. number = STANDING, otherNumber = HANGING, etc.)
  3. AI_STATE enum (e.g. number = IDLING, etc.) <-- not sure if this one would work, i'm assuming that every entity uses the same values for their ai_states

hopefully shouldn't be too hard to implement :p

@Mr-Auto
Copy link
Contributor

Mr-Auto commented Jun 10, 2021

@0novo for the ai_state aka move_state there are different numbers used in different ways, some are common like idle, attack, but other like 11 is caveman sleep and 5 when he blinks the eyes + even some between for a split second, i would be hard to name them properly

@SuperNinjaFat
Copy link

Allow us to redefine level entrance and exit specific variables.

There may be certain scripting scenarios involving entrances and exits that are more elaborate than simply manipulating the LOGIC_DOOR entities created from level generation. For instance, entities spawned upon starting a level (spelunkers, the starting torch on dark levels, the skull/pot that spawns by the entrance) do not spawn during the set_post_tile_code_callback() phase while LOGIC_DOOR and its associated entities do. Since this is the case, we are unable to define a spelunker's spawn location at this stage of level generation.
Below are some exit/entrance related requested variables:

  • Upon death with the Ankh equipped, you respawn at the entrance door (with the exception of Hundun's Hideaway, where it's the exit)

  • When wanted by an npc, it spawns in an aggroed state at the exit doors (or Tun's specific cases, such as the entrance door 30 seconds into a level and the Sunken City ship door).

  • When the compass is equipped, the arrow points towards the exit door(s) (or the mothership entrance when the alien compass is equipped)

@Mr-Auto
Copy link
Contributor

Mr-Auto commented Jun 13, 2021

* When the compass is equipped, the arrow points towards the exit door(s) (or the mothership entrance when the alien compass is equipped)

compass works by attaching ENT_TYPE_FX_COMPASS to the LOGIC_DOOR, you can just kill it and attach it to whatever you want, same with alien compass = ENT_TYPE_FX_SPECIALCOMPASS

About the player spawn, ankh and tun, there is spawn_x/spawn_y in the plugin in LevelGen, you just need someone to expose them to lua. Oh also the hundun ankh spawn is door1_x/door1_y in exit_door_locations in the same place as the spawn

@Mr-Auto
Copy link
Contributor

Mr-Auto commented Jul 7, 2021

Order of options
can we get some way to manipulate order of options made with register_option ?

@Dregu
Copy link
Collaborator Author

Dregu commented Jul 8, 2021

can we get some way to manipulate order of options made with register_option ?

They are in alphabetical order based on the key. Might not be the ideal way to order them, but at least it is a way to do it.

@SuperNinjaFat

This comment was marked as resolved.

@SuperNinjaFat

This comment was marked as resolved.

@MstrVLT
Copy link

MstrVLT commented Apr 1, 2023

Overlunky has an udp sockets feature - I think it's a good idea to add support for tcpsocket

@SuperNinjaFat
Copy link

Allow us to define magmar spawn spots via scripting

According to JayTheBusinessGoose, state.logic_volcana has something to do with how magmar spawns are set. Expose this to the API so we can define the spots that magmars can spawn from.

A bonus would be allowing magmar spawns to be set and work in other themes, such as Temple, the City Of Gold, or Olmec.

@SuperNinjaFat
Copy link

Allow us to apply custom normal maps to textures via the scripting API

Our mod changes textures via script that need to be normal mapped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lua Issues with the Lua api
Projects
None yet
Development

No branches or pull requests

7 participants