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

Random stuff, again #349

Merged
merged 33 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d991bc9
one pattern less
Mr-Auto Oct 20, 2023
6c1673c
4 pattern less
Mr-Auto Oct 20, 2023
5cfba4a
another one
Mr-Auto Oct 20, 2023
9438478
just rename
Mr-Auto Oct 20, 2023
4b92f05
Merge remote-tracking branch 'origin/main' into stuff
Mr-Auto Oct 21, 2023
704d9b9
make it big letters
Mr-Auto Oct 21, 2023
ff9b1da
screen level thing
Mr-Auto Oct 21, 2023
56e3813
super small optimisation in `get_entities_by`
Mr-Auto Oct 21, 2023
8432219
comment out unused stuff
Mr-Auto Oct 21, 2023
31c9628
fix some super rare bug
Mr-Auto Oct 21, 2023
b256fda
if layer() and layer_local() do the same thing, just use one, so ever…
Mr-Auto Oct 21, 2023
e649a77
use advantages of map and initializer list for `worn_backitem` functi…
Mr-Auto Oct 21, 2023
f6ab87e
one more pattern gone
Mr-Auto Oct 21, 2023
7c357f2
add `set_camera_layer_control_enabled`
Mr-Auto Oct 22, 2023
7965a6f
this idea is as dead as it can be
Mr-Auto Oct 22, 2023
824380a
use local, why not
Mr-Auto Oct 22, 2023
cf4745e
move illumination to separate file, expose the full version of the fu…
Mr-Auto Oct 28, 2023
a01e9f4
Merge remote-tracking branch 'origin/main' into stuff
Mr-Auto Oct 28, 2023
837cd4a
fix and update doc
Mr-Auto Oct 28, 2023
b64d34c
some more doc stuff
Mr-Auto Oct 28, 2023
1c425b4
game api stuff
Mr-Auto Oct 29, 2023
de66eaa
fix example
Mr-Auto Oct 29, 2023
33b6df2
why this is fine locally but not on remote?
Mr-Auto Oct 29, 2023
78546ae
bring back zoom hack
Mr-Auto Oct 29, 2023
b8ad3f0
fix ui flags
Mr-Auto Oct 30, 2023
91c3c2e
improve flags in UI
Mr-Auto Oct 31, 2023
be56a7d
small random stuff
Mr-Auto Oct 31, 2023
4c5c4f6
add more `:set()` functions, unless there is some lua alternative?
Mr-Auto Nov 1, 2023
4881181
wtf
Mr-Auto Nov 1, 2023
5b317b8
some non important changes
Mr-Auto Nov 1, 2023
c99216a
particle stuff, move the particle functions from rpc, expose some mor…
Mr-Auto Nov 1, 2023
07e37a3
update doc
Mr-Auto Nov 1, 2023
4efa404
write our some more obvious stuff
Mr-Auto Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/examples/set_camera_layer_control_enabled.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
set_camera_layer_control_enabled(false)

g_current_timer = nil
-- default load_time 36
function change_layer(layer_to, load_time)

if state.camera_layer == layer_to then
return
end
if g_current_timer ~= nil then
clear_callback(g_current_timer)
g_current_timer = nil
end
-- if we don't want the load time, we can just change the actual layer
if load_time == nil or load_time == 0 then
state.camera_layer = layer_to
return
end

state.layer_transition_timer = load_time
state.transition_to_layer = layer_to
state.camera_layer = layer_to
end
72 changes: 54 additions & 18 deletions docs/game_data/spel2.lua

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def print_lf(lf):
---- | ---- | -----------"""
)
print("bool | all:empty() | Returns true if container is empty, false otherwise")
print("int | aLL:size() | Same as `#container`")
print("int | all:size() | Same as `#container`")

print("any | vector:at(int index) | Same as `vector[index]`")
print("any | span:at(int index) | Same as `span[index]`")
Expand Down
1 change: 1 addition & 0 deletions docs/parse_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"../src/game_api/game_manager.hpp",
"../src/game_api/state.hpp",
"../src/game_api/state_structs.hpp",
"../src/game_api/illumination.hpp",
"../src/game_api/prng.hpp",
"../src/game_api/entities_floors.hpp",
"../src/game_api/entities_activefloors.hpp",
Expand Down
14 changes: 14 additions & 0 deletions docs/src/includes/_enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,20 @@ Name | Data | Description
[MAX_LIQUID_PARTICLES](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=LEVEL_CONFIG.MAX_LIQUID_PARTICLES) | 15 |
[FLAGGED_LIQUID_ROOMS](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=LEVEL_CONFIG.FLAGGED_LIQUID_ROOMS) | 16 |

## LIGHT_TYPE


> Search script examples for [LIGHT_TYPE](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=LIGHT_TYPE)



Name | Data | Description
---- | ---- | -----------
[NONE](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=LIGHT_TYPE.NONE) | LIGHT_TYPE::NONE | Normal static light, position can be edited to move it around<br/>
[FOLLOW_CAMERA](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=LIGHT_TYPE.FOLLOW_CAMERA) | LIGHT_TYPE::FOLLOW_CAMERA | Position is updated to the camera position, can be moved around via offset<br/>
[FOLLOW_ENTITY](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=LIGHT_TYPE.FOLLOW_ENTITY) | LIGHT_TYPE::FOLLOW_ENTITY | Position is updated to the entity position (from the uid field), if the uid is not found it will behave as [LIGHT_TYPE](#LIGHT_TYPE).NONE, can be moved around via offset<br/>
[ROOM_LIGHT](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=LIGHT_TYPE.ROOM_LIGHT) | LIGHT_TYPE::ROOM_LIGHT | Rectangle, full brightness always uses light1, disabling light1 does nothing<br/>

## LIQUID_POOL


Expand Down
57 changes: 49 additions & 8 deletions docs/src/includes/_globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ They come with some extra functionality:
Type | Name | Description
---- | ---- | -----------
bool | all:empty() | Returns true if container is empty, false otherwise
int | aLL:size() | Same as `#container`
int | all:size() | Same as `#container`
any | vector:at(int index) | Same as `vector[index]`
any | span:at(int index) | Same as `span[index]`
any | set:at(int order) | Returns elements in order, it's not an index as sets don't have one
Expand Down Expand Up @@ -1710,6 +1710,45 @@ Seed the game prng.

Set the current adventure seed pair

### set_camera_layer_control_enabled


```lua
set_camera_layer_control_enabled(false)

g_current_timer = nil
-- default load_time 36
function change_layer(layer_to, load_time)

if state.camera_layer == layer_to then
return
end
if g_current_timer ~= nil then
clear_callback(g_current_timer)
g_current_timer = nil
end
-- if we don't want the load time, we can just change the actual layer
if load_time == nil or load_time == 0 then
state.camera_layer = layer_to
return
end

state.layer_transition_timer = load_time
state.transition_to_layer = layer_to
state.camera_layer = layer_to
end

```


> Search script examples for [set_camera_layer_control_enabled](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_camera_layer_control_enabled)

#### nil set_camera_layer_control_enabled(bool enable)

This disables the `state.camera_layer` to be forced to the `(leader player).layer` and setting of the `state.layer_transition_timer` & `state.transition_to_layer` when player enters layer door.
Letting you control those manually.
Look at the example on how to mimic game layer switching behavior

### set_character_heart_color


Expand Down Expand Up @@ -2042,11 +2081,13 @@ Steal input from a [Player](#Player), HiredHand or [PlayerGhost](#PlayerGhost)

> Search script examples for [create_illumination](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=create_illumination)

#### [Illumination](#Illumination) create_illumination([Vec2](#Vec2) pos, [Color](#Color) color, [LIGHT_TYPE](#LIGHT_TYPE) type, float size, int flags, int uid, [LAYER](#LAYER) layer)

#### [Illumination](#Illumination) create_illumination([Color](#Color) color, float size, float x, float y)

#### [Illumination](#Illumination) create_illumination([Color](#Color) color, float size, int uid)

Creates a new [Illumination](#Illumination). Don't forget to continuously call [refresh_illumination](#refresh_illumination), otherwise your light emitter fades out! Check out the [illumination.lua](https://github.com/spelunky-fyi/overlunky/blob/main/examples/illumination.lua) script for an example
Creates a new [Illumination](#Illumination). Don't forget to continuously call [refresh_illumination](#refresh_illumination), otherwise your light emitter fades out! Check out the [illumination.lua](https://github.com/spelunky-fyi/overlunky/blob/main/examples/illumination.lua) script for an example.

### refresh_illumination

Expand All @@ -2055,7 +2096,7 @@ Creates a new [Illumination](#Illumination). Don't forget to continuously call [

#### nil refresh_illumination([Illumination](#Illumination) illumination)

Refreshes an [Illumination](#Illumination), keeps it from fading out
Refreshes an [Illumination](#Illumination), keeps it from fading out (updates the timer, keeping it in sync with the game render)

## Message functions

Expand Down Expand Up @@ -2376,7 +2417,7 @@ Extinguish a particle emitter (use the return value of `generate_world_particles

> Search script examples for [generate_screen_particles](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=generate_screen_particles)

#### [ParticleEmitterInfo](#ParticleEmitterInfo) generate_screen_particles(int particle_emitter_id, float x, float y)
#### [ParticleEmitterInfo](#ParticleEmitterInfo) generate_screen_particles([PARTICLEEMITTER](#PARTICLEEMITTER) particle_emitter_id, float x, float y)

Generate particles of the specified type at a certain screen coordinate (use e.g. `local emitter = generate_screen_particles(PARTICLEEMITTER.CHARSELECTOR_TORCHFLAME_FLAMES, 0.0, 0.0)`). See the `particles.lua` example script for more details.

Expand All @@ -2385,7 +2426,7 @@ Generate particles of the specified type at a certain screen coordinate (use e.g

> Search script examples for [generate_world_particles](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=generate_world_particles)

#### [ParticleEmitterInfo](#ParticleEmitterInfo) generate_world_particles(int particle_emitter_id, int uid)
#### [ParticleEmitterInfo](#ParticleEmitterInfo) generate_world_particles([PARTICLEEMITTER](#PARTICLEEMITTER) particle_emitter_id, int uid)

Generate particles of the specified type around the specified entity uid (use e.g. `local emitter = generate_world_particles(PARTICLEEMITTER.PETTING_PET, players[1].uid)`). You can then decouple the emitter from the entity with `emitter.entity_uid = -1` and freely move it around. See the `particles.lua` example script for more details.

Expand All @@ -2394,7 +2435,7 @@ Generate particles of the specified type around the specified entity uid (use e.

> Search script examples for [get_particle_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_particle_type)

#### [ParticleDB](#ParticleDB) get_particle_type(int id)
#### [ParticleDB](#ParticleDB) get_particle_type([PARTICLEEMITTER](#PARTICLEEMITTER) id)

Get the [ParticleDB](#ParticleDB) details of the specified ID

Expand Down Expand Up @@ -3634,7 +3675,7 @@ Use `get_entities_overlapping_hitbox` instead

#### int get_entity_ai_state(int uid)

As the name is misleading. use entity `move_state` field instead
As the name is misleading. use [Movable](#Movable).`move_state` field instead

### set_arrowtrap_projectile

Expand Down Expand Up @@ -3905,7 +3946,7 @@ Use this only when no other approach works, this call can be expensive if overus

> Search script examples for [generate_particles](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=generate_particles)

#### [ParticleEmitterInfo](#ParticleEmitterInfo) generate_particles(int particle_emitter_id, int uid)
#### [ParticleEmitterInfo](#ParticleEmitterInfo) generate_particles([PARTICLEEMITTER](#PARTICLEEMITTER) particle_emitter_id, int uid)

Use `generate_world_particles`

Expand Down
Loading
Loading