From a6455236d6d19694307716f89d5c6658559a0519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Geyelin?= Date: Thu, 10 Oct 2024 18:06:56 +0200 Subject: [PATCH] Roll new documentation --- docs/APIs/PewPew.md | 185 +++++++++++++++++++++++- raw_documentation.json | 318 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 497 insertions(+), 6 deletions(-) diff --git a/docs/APIs/PewPew.md b/docs/APIs/PewPew.md index a539883..5c34202 100644 --- a/docs/APIs/PewPew.md +++ b/docs/APIs/PewPew.md @@ -30,13 +30,18 @@ The `pewpew` library contains all the functions for configuring levels and manag * BAF_RED * WARY_MISSILE * UFO_BULLET + * SPINY + * SUPER_MOTHERSHIP * PLAYER_BULLET * BOMB_EXPLOSION * PLAYER_EXPLOSION * BONUS * FLOATING_MESSAGE * POINTONIUM + * KAMIKAZE * BONUS_IMPLOSION + * MACE + * PLASMA_FIELD ### MothershipType * THREE_CORNERS * FOUR_CORNERS @@ -51,6 +56,8 @@ The `pewpew` library contains all the functions for configuring levels and manag * FOUR_DIRECTIONS * DOUBLE_SWIPE * HEMISPHERE + * SHOTGUN + * LASER ### CannonFrequency * FREQ_30 * FREQ_15 @@ -67,16 +74,23 @@ The `pewpew` library contains all the functions for configuring levels and manag * ATOMIZE * SMALL_ATOMIZE * SMALL_FREEZE +### MaceType + * DAMAGE_PLAYERS + * DAMAGE_ENTITIES ### BonusType * REINSTANTIATION * SHIELD * SPEED * WEAPON + * MACE ### WeaponType * BULLET * FREEZE_EXPLOSION * REPULSIVE_EXPLOSION * ATOMIZE_EXPLOSION + * PLASMA_FIELD + * WALL_TRAIL_LASSO + * MACE ### AsteroidSize * SMALL * MEDIUM @@ -315,6 +329,36 @@ Configures the weapon of the ship identified with `ship_id` using `configuration > pewpew.configure_player_ship_weapon(ship_id, weapon_config) > ``` +--- +### `configure_player_ship_wall_trail()` +```tsx +pewpew.configure_player_ship_wall_trail( + ship_id: EntityId, + configuration: table { + wall_length: int + } +) +``` +Configures a wall trail that kills everything inside when the ship it is attached to creates a loop with it. `wall_length` is clamped to [100, 4000]. In symbiosis, the length is 2000. If `wall_length` is not specified, the trail is removed. + +> Example: +> ```lua +> pewpew.configure_player_ship_wall_trail(ship, {wall_length = 2000}) +> ``` + +--- +### `configure_player_ship()` +```tsx +pewpew.configure_player_ship( + ship_id: EntityId, + configuration: table { + swap_inputs: bool + } +) +``` +Configures various properties of the player ship identified by`id` + + --- ### `add_damage_to_player_ship()` ```tsx @@ -482,6 +526,27 @@ Creates an explosion of particles at the location `x`,`y`. `color` specifies the > pewpew.create_explosion(300fx, 100fx, 0xffffffff, 3fx, 50) -- large red explosion > ``` +--- +### `add_particle()` +```tsx +pewpew.add_particle( + x: FixedPoint, + y: FixedPoint, + z: FixedPoint, + dx: FixedPoint, + dy: FixedPoint, + dz: FixedPoint, + color: int, + duration: int +) +``` +Adds a particle at the given position, that moves at the given speed, with the given color and duration. The engine may not spawn all particles if are already a lot of particles alive already spawned (e.g. more than 1000) + +> Example: +> ```lua +> pewpew.add_particle(10fx, 10fx, 0fx, 4fx, 0fx, 0fx, 0xffffffff, 40) +> ``` + --- ### `new_asteroid()` ```tsx @@ -615,6 +680,7 @@ pewpew.new_floating_message( str: string, config: table { scale: FixedPoint, + dz: FixedPoint, ticks_before_fade: int, is_optional: bool } @@ -653,6 +719,18 @@ pewpew.new_inertiac( Creates a new Inertiac at the location `x`,`y`, and returns its entityId. The inertiac will accelerate according to `acceleration`. It spawns with a random velocity in a direction specified by `angle`. +--- +### `new_kamikaze()` +```tsx +pewpew.new_kamikaze( + x: FixedPoint, + y: FixedPoint, + angle: FixedPoint +): EntityId +``` +Creates a new Kamikaze at the location `x`,`y` that starts moving in the direction specified by `angle`. + + --- ### `new_mothership()` ```tsx @@ -670,6 +748,21 @@ Creates a new Mothership at the location `x`,`y`, and returns its entityId. > pewpew.new_mothership(50fx, 50fx, pewpew.MothershipType.THREE_CORNERS, fmath.tau() / 4fx) > ``` +--- +### `new_mothership_bullet()` +```tsx +pewpew.new_mothership_bullet( + x: FixedPoint, + y: FixedPoint, + angle: FixedPoint, + speed: FixedPoint, + color: int, + large: bool +): EntityId +``` +Creates a new mothership bullet. + + --- ### `new_pointonium()` ```tsx @@ -682,6 +775,20 @@ pewpew.new_pointonium( Creates a new Pointonium at the location `x`,`y`. Value must be 64, 128, or 256. +--- +### `new_plasma_field()` +```tsx +pewpew.new_plasma_field( + ship_a_id: EntityId, + ship_b_id: EntityId, + config: table { + length: FixedPoint + } +): EntityId +``` +Creates a new plasma field between `ship_a` and `ship_b`, and returns its entityId. If `ship_a` or `ship_b` is destroyed, the plasma field is destroyed as well. + + --- ### `new_player_ship()` ```tsx @@ -731,6 +838,36 @@ pewpew.new_rolling_sphere( Creates a new Rolling Sphere at the location `x`,`y`, and returns its entityId. +--- +### `new_spiny()` +```tsx +pewpew.new_spiny( + x: FixedPoint, + y: FixedPoint, + angle: FixedPoint, + attractivity: FixedPoint +): EntityId +``` +Creates a new Spiny at the location `x`,`y` that starts moving in the direction specified by `angle`. `attractivity` specifies how much the Spiny is attracted to the closest player: 1fx is normal attractivity. + + +--- +### `new_super_mothership()` +```tsx +pewpew.new_super_mothership( + x: FixedPoint, + y: FixedPoint, + type: int, + angle: FixedPoint +): EntityId +``` +Creates a new Super Mothership at the location `x`,`y`, and returns its entityId. + +> Example: +> ```lua +> pewpew.new_super_mothership(50fx, 50fx, pewpew.MothershipType.THREE_CORNERS, fmath.tau() / 4fx) +> ``` + --- ### `new_wary()` ```tsx @@ -878,6 +1015,22 @@ pewpew.entity_react_to_weapon( Makes the entity identified by `id` react to the weapon described in `weapon_description`. Returns whether the entity reacted to the weapon. The returned value is typically used to decide whether the weapon should continue to exist or not. In the case of an explosion, `x` and `y` should store the origin of the explosion. In the case of a bullet, `x` and `y` should store the vector of the bullet. The player identified by `player_index` will be assigned points. If `player_index` is invalid, no player will be assigned points. +--- +### `entity_add_mace()` +```tsx +pewpew.entity_add_mace( + target_id: EntityId, + config: table { + distance: FixedPoint, + angle: FixedPoint, + rotation_speed: FixedPoint, + type: int + } +): EntityId +``` +Adds a mace to the entity identified with `entity_id`. If `rotation_speed` exists, the mace will have a natural rotation, otherwise it will move due to inertia. + + --- ### `customizable_entity_set_position_interpolation()` ```tsx @@ -886,7 +1039,18 @@ pewpew.customizable_entity_set_position_interpolation( enable: bool ) ``` -Sets whether the position of the mesh wil be interpolated when rendering. In general, this should be set to true if the entity will be moving smoothly. +Sets whether the position of the mesh wil be interpolated when rendering. In general, this should be set to true if the entity will be moving. + + +--- +### `customizable_entity_set_angle_interpolation()` +```tsx +pewpew.customizable_entity_set_angle_interpolation( + entity_id: EntityId, + enable: bool +) +``` +Sets whether the angle of the mesh wil be interpolated when rendering. Angle interpolation is enabled by default. --- @@ -1160,3 +1324,22 @@ pewpew.customizable_entity_start_exploding( ``` Makes the customizable entity identified by `id` explode for a duration of `explosion_duration` game ticks. After the explosion, the entity is destroyed. `explosion_duration` must be less than 255. Any scale applied to the entity is also applied to the explosion. + +--- +### `customizable_entity_set_tag()` +```tsx +pewpew.customizable_entity_set_tag( + entity_id: EntityId, + tag: int +) +``` +Sets a tag on customizable entities. The tag can be read back with `customizable_entity_get_tag`. + + +--- +### `customizable_entity_get_tag()` +```tsx +pewpew.customizable_entity_get_tag(entity_id: EntityId): int +``` +Returns the tag that was set, or 0 if no tag was set. + diff --git a/raw_documentation.json b/raw_documentation.json index f73bbe5..7b43b2f 100644 --- a/raw_documentation.json +++ b/raw_documentation.json @@ -22,13 +22,18 @@ "BAF_RED", "WARY_MISSILE", "UFO_BULLET", +"SPINY", +"SUPER_MOTHERSHIP", "PLAYER_BULLET", "BOMB_EXPLOSION", "PLAYER_EXPLOSION", "BONUS", "FLOATING_MESSAGE", "POINTONIUM", -"BONUS_IMPLOSION"] +"KAMIKAZE", +"BONUS_IMPLOSION", +"MACE", +"PLASMA_FIELD"] }, { "name":"MothershipType", @@ -48,7 +53,9 @@ "TRIPLE", "FOUR_DIRECTIONS", "DOUBLE_SWIPE", -"HEMISPHERE"] +"HEMISPHERE", +"SHOTGUN", +"LASER"] }, { "name":"CannonFrequency", @@ -73,12 +80,19 @@ "SMALL_FREEZE"] }, { +"name":"MaceType", +"values": [ +"DAMAGE_PLAYERS", +"DAMAGE_ENTITIES"] +}, +{ "name":"BonusType", "values": [ "REINSTANTIATION", "SHIELD", "SPEED", -"WEAPON"] +"WEAPON", +"MACE"] }, { "name":"WeaponType", @@ -86,7 +100,10 @@ "BULLET", "FREEZE_EXPLOSION", "REPULSIVE_EXPLOSION", -"ATOMIZE_EXPLOSION"] +"ATOMIZE_EXPLOSION", +"PLASMA_FIELD", +"WALL_TRAIL_LASSO", +"MACE"] }, { "name":"AsteroidSize", @@ -394,6 +411,48 @@ { "return_types": [ ], +"func_name":"configure_player_ship_wall_trail", +"comment":"Configures a wall trail that kills everything inside when the ship it is attached to creates a loop with it. `wall_length` is clamped to [100, 4000]. In symbiosis, the length is 2000. If `wall_length` is not specified, the trail is removed.", +"parameters": [ +{ +"name":"ship_id", +"type":"EntityId"} +, +{ +"name":"configuration", +"type":"Map", +"map_entries": [ +{ +"name":"wall_length", +"type":"Int32"} +] +} +] +}, +{ +"return_types": [ +], +"func_name":"configure_player_ship", +"comment":"Configures various properties of the player ship identified by`id`", +"parameters": [ +{ +"name":"ship_id", +"type":"EntityId"} +, +{ +"name":"configuration", +"type":"Map", +"map_entries": [ +{ +"name":"swap_inputs", +"type":"Boolean"} +] +} +] +}, +{ +"return_types": [ +], "func_name":"add_damage_to_player_ship", "comment":"Reduces the amount of shield of the player that owns the ship by `damage` points. If the player receives damage while having 0 shields left, the player loses.", "parameters": [ @@ -602,6 +661,45 @@ }, { "return_types": [ +], +"func_name":"add_particle", +"comment":"Adds a particle at the given position, that moves at the given speed, with the given color and duration. The engine may not spawn all particles if are already a lot of particles alive already spawned (e.g. more than 1000)", +"parameters": [ +{ +"name":"x", +"type":"FixedPoint"} +, +{ +"name":"y", +"type":"FixedPoint"} +, +{ +"name":"z", +"type":"FixedPoint"} +, +{ +"name":"dx", +"type":"FixedPoint"} +, +{ +"name":"dy", +"type":"FixedPoint"} +, +{ +"name":"dz", +"type":"FixedPoint"} +, +{ +"name":"color", +"type":"Int32"} +, +{ +"name":"duration", +"type":"Int32"} +] +}, +{ +"return_types": [ { "type":"EntityId"}], "func_name":"new_asteroid", @@ -856,6 +954,10 @@ "type":"FixedPoint"} , { +"name":"dz", +"type":"FixedPoint"} +, +{ "name":"ticks_before_fade", "type":"Int32"} , @@ -910,6 +1012,26 @@ "return_types": [ { "type":"EntityId"}], +"func_name":"new_kamikaze", +"comment":"Creates a new Kamikaze at the location `x`,`y` that starts moving in the direction specified by `angle`.", +"parameters": [ +{ +"name":"x", +"type":"FixedPoint"} +, +{ +"name":"y", +"type":"FixedPoint"} +, +{ +"name":"angle", +"type":"FixedPoint"} +] +}, +{ +"return_types": [ +{ +"type":"EntityId"}], "func_name":"new_mothership", "comment":"Creates a new Mothership at the location `x`,`y`, and returns its entityId.", "parameters": [ @@ -936,6 +1058,38 @@ "return_types": [ { "type":"EntityId"}], +"func_name":"new_mothership_bullet", +"comment":"Creates a new mothership bullet.", +"parameters": [ +{ +"name":"x", +"type":"FixedPoint"} +, +{ +"name":"y", +"type":"FixedPoint"} +, +{ +"name":"angle", +"type":"FixedPoint"} +, +{ +"name":"speed", +"type":"FixedPoint"} +, +{ +"name":"color", +"type":"Int32"} +, +{ +"name":"large", +"type":"Boolean"} +] +}, +{ +"return_types": [ +{ +"type":"EntityId"}], "func_name":"new_pointonium", "comment":"Creates a new Pointonium at the location `x`,`y`. Value must be 64, 128, or 256.", "parameters": [ @@ -956,6 +1110,32 @@ "return_types": [ { "type":"EntityId"}], +"func_name":"new_plasma_field", +"comment":"Creates a new plasma field between `ship_a` and `ship_b`, and returns its entityId. If `ship_a` or `ship_b` is destroyed, the plasma field is destroyed as well.", +"parameters": [ +{ +"name":"ship_a_id", +"type":"EntityId"} +, +{ +"name":"ship_b_id", +"type":"EntityId"} +, +{ +"name":"config", +"type":"Map", +"map_entries": [ +{ +"name":"length", +"type":"FixedPoint"} +] +} +] +}, +{ +"return_types": [ +{ +"type":"EntityId"}], "func_name":"new_player_ship", "comment":"Creates a new Player Ship at the location `x`,`y` for the player identified by `player_index`, and returns its entityId.", "parameters": [ @@ -1040,6 +1220,56 @@ "return_types": [ { "type":"EntityId"}], +"func_name":"new_spiny", +"comment":"Creates a new Spiny at the location `x`,`y` that starts moving in the direction specified by `angle`. `attractivity` specifies how much the Spiny is attracted to the closest player: 1fx is normal attractivity.", +"parameters": [ +{ +"name":"x", +"type":"FixedPoint"} +, +{ +"name":"y", +"type":"FixedPoint"} +, +{ +"name":"angle", +"type":"FixedPoint"} +, +{ +"name":"attractivity", +"type":"FixedPoint"} +] +}, +{ +"return_types": [ +{ +"type":"EntityId"}], +"func_name":"new_super_mothership", +"comment":"Creates a new Super Mothership at the location `x`,`y`, and returns its entityId.", +"parameters": [ +{ +"name":"x", +"type":"FixedPoint"} +, +{ +"name":"y", +"type":"FixedPoint"} +, +{ +"name":"type", +"type":"Int32", +"enum": "MothershipType" +} +, +{ +"name":"angle", +"type":"FixedPoint"} +] +}, +{ +"return_types": [ +{ +"type":"EntityId"}], "func_name":"new_wary", "comment":"Creates a new Wary at the location `x`,`y`.", "parameters": [ @@ -1238,9 +1468,60 @@ }, { "return_types": [ +{ +"type":"EntityId"}], +"func_name":"entity_add_mace", +"comment":"Adds a mace to the entity identified with `entity_id`. If `rotation_speed` exists, the mace will have a natural rotation, otherwise it will move due to inertia.", +"parameters": [ +{ +"name":"target_id", +"type":"EntityId"} +, +{ +"name":"config", +"type":"Map", +"map_entries": [ +{ +"name":"distance", +"type":"FixedPoint"} +, +{ +"name":"angle", +"type":"FixedPoint"} +, +{ +"name":"rotation_speed", +"type":"FixedPoint"} +, +{ +"name":"type", +"type":"Int32", +"enum": "MaceType" +} +] +} +] +}, +{ +"return_types": [ ], "func_name":"customizable_entity_set_position_interpolation", -"comment":"Sets whether the position of the mesh wil be interpolated when rendering. In general, this should be set to true if the entity will be moving smoothly.", +"comment":"Sets whether the position of the mesh wil be interpolated when rendering. In general, this should be set to true if the entity will be moving.", +"parameters": [ +{ +"name":"entity_id", +"type":"EntityId"} +, +{ +"name":"enable", +"type":"Boolean"} +] +}, +{ +"return_types": [ +], +"func_name":"customizable_entity_set_angle_interpolation", +"comment":"Sets whether the angle of the mesh wil be interpolated when rendering. Angle interpolation is enabled by default.", "parameters": [ { "name":"entity_id", @@ -1606,6 +1887,33 @@ "name":"explosion_duration", "type":"Int32"} ] +}, +{ +"return_types": [ +], +"func_name":"customizable_entity_set_tag", +"comment":"Sets a tag on customizable entities. The tag can be read back with `customizable_entity_get_tag`.", +"parameters": [ +{ +"name":"entity_id", +"type":"EntityId"} +, +{ +"name":"tag", +"type":"Int32"} +] +}, +{ +"return_types": [ +{ +"type":"Int32"}], +"func_name":"customizable_entity_get_tag", +"comment":"Returns the tag that was set, or 0 if no tag was set.", +"parameters": [ +{ +"name":"entity_id", +"type":"EntityId"} +] }] } ,