Skip to content

Commit

Permalink
Merge pull request #349 from Mr-Auto/stuff
Browse files Browse the repository at this point in the history
Random stuff, again
  • Loading branch information
Dregu authored Nov 2, 2023
2 parents dc23045 + 4efa404 commit a2b3641
Show file tree
Hide file tree
Showing 60 changed files with 1,399 additions and 1,450 deletions.
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

0 comments on commit a2b3641

Please sign in to comment.