diff --git a/DOCS.md b/DOCS.md index 601de3f..d2a64b4 100644 --- a/DOCS.md +++ b/DOCS.md @@ -55,45 +55,43 @@ Then there are the built-in weapons_lib parameters: Custom parameters are supported as well. It's recommended putting a `_` at the beginning of the parameter so to avoid conflicts with upcoming official ones ### Actions structure -Actions are tables containing info about how they should work. Actions also support custom parameters: it's recommended putting a `_` at the beginning of the parameter so to avoid conflicts with upcoming official ones +Actions are tables containing info about how they should work. Actions also support custom parameters: it's recommended putting a `_` at the beginning of the parameter so to avoid conflicts with upcoming official ones. -#### All types -* `type`: (string) mandatory. It can be `"raycast"`, `"bullet"`, `"zoom"`, `"punch"` or `"custom"` (TODO: `"install"`?, `"parry"`) -* `damage`: (float) how much damage deals -* `range`: (float, no punch) range of the weapon -* `delay`: (float) how much time it should pass between being able to rerun the action -* `loading_time`: (float) how much time before actually running the action. NOT YET IMPLEMENTED -* `knockback`: (int) how much knockback the action should inflict -* `physics_override`: (table or string) how the player physics should change when running the action. Physics is restored when the recovery phase ends +* `type`: (string) mandatory. It can be `"raycast"` (โšก๏ธ), `"bullet"` (๐Ÿฅ), `"zoom"` (๐Ÿ”Ž), `"punch"` (๐Ÿ‘Š) or `"custom"` (TODO: `"install"`?, `"parry"`) +* `damage` (float) โšก๏ธ๐Ÿฅ๐Ÿ‘Š how much damage deals +* `delay`: (float) โšก๏ธ๐Ÿฅ๐Ÿ‘Š how much time it should pass between being able to rerun the action +* `range`: (float) โšก๏ธ range of the action +* `bullet`: (table) ๐Ÿฅ the properties of the physical bullet shot with this action. See the Bullets structure section down below. +* `loading_time`: (float) โšก๏ธ๐Ÿฅ๐Ÿ‘Š how much time before actually running the action. NOT YET IMPLEMENTED +* `attack_on_release`: (bool) โšก๏ธ๐Ÿฅ๐Ÿ‘Š๐Ÿ”Ž whether it should attack when the action key is released. NOT YET IMPLEMENTED, [waiting for MT](https://gitlab.com/zughy-friends-minetest/weapons_lib/-/issues/5) +* `knockback`: (int) โšก๏ธ๐Ÿฅ๐Ÿ‘Š how much knockback the action should inflict +* `ammo_per_use`: (int) โšก๏ธ๐Ÿฅ how much ammo is needed to run the action +* `continuous_fire`: (bool) โšก๏ธ๐Ÿฅ whether it should keep firing when holding down the action key (waiting `delay` seconds between a shot and another). Default is `false` +* `decrease_damage_with_distance`: (bool) โšก๏ธ๐Ÿ‘Š whether damage should decrease as the distance from the target increases. Default is `false` +* `pierce`: (bool) โšก๏ธ๐Ÿฅ๐Ÿ‘Š whether the hit should stop on the first person or continue. Default is `false` +* `physics_override`: (table or string) โšก๏ธ๐Ÿฅ๐Ÿ‘Š๐Ÿ”Ž how the player physics should change when running the action. Physics is restored when the recovery phase ends * It takes either a Minetest physics table or the string `"FREEZE"`, which will block the player * If this parameter is declared, `slow_down_user` won't get called -* `attack_on_release`: (bool) whether it should attack when the action key is released. NOT YET IMPLEMENTED, [waiting for MT](https://gitlab.com/zughy-friends-minetest/weapons_lib/-/issues/5) -* `pierce`: (bool) whether the hit should stop on the first person or continue. Default is `false` -* `sound`: (string) the sound to play when the action is run -* `trail`: (table) the trail the action should leave. Fields are: +* `sound`: (string) โšก๏ธ๐Ÿฅ๐Ÿ‘Š the sound to play when the action is run +* `trail`: (table) โšก๏ธ๐Ÿฅ๐Ÿ‘Š the trail the action should leave. Fields are: * `image`: (string) the particle to spawn * `amount`: (int) how many particles to draw along the line -* `on_use`: (function(player, weapon, action, \)) additional behaviour when the action is successfully run +* `on_use`: (function(player, weapon, action, \)) โšก๏ธ๐Ÿฅ๐Ÿ‘Š additional behaviour when the action is successfully run * `pointed_thing` is only passed with custom and punch action types * if `continuous_fire` is on, the callback is run repeatedly * a must for `"custom"` type to actually do something -* `on_hit`: (function(hitter, target, weapon, action, hit_point, damage, knockback)) additional behaviour when hitting a player or an entity +* `on_hit`: (function(hitter, target, weapon, action, hit_point, damage, knockback)) โšก๏ธ๐Ÿฅ๐Ÿ‘Š additional behaviour when hitting a player or an entity * It must return the damage that will be inflicted (int) and the knockback (int or `nil`) * `hit_point` only works with type `"raycast"` at the moment, [waiting for MT](https://gitlab.com/zughy-friends-minetest/weapons_lib/-/issues/6) -* `on_end`: (function(player, weapon, action)) additional behaviour for when the action reaches its end -* `on_recovery_end`: (function(player, weapon, action)) additional behaviour for when the weapon is ready to be used again +* `on_end`: (function(player, weapon, action)) โšก๏ธ๐Ÿฅ๐Ÿ‘Š additional behaviour for when the action reaches its end +* `on_recovery_end`: (function(player, weapon, action)) โšก๏ธ๐Ÿฅ๐Ÿ‘Š additional behaviour for when the weapon is ready to be used again -#### Except for "punch" -* `ammo_per_use`: (int) how much ammo is needed to run the action -* `continuous_fire`: (bool, no punch) whether it should keep firing when holding down the action key (waiting `delay` seconds between a shot and another). Default is `false` +TODO: `fov` +TODO: physics_override con zoom al momento prob dร  problemi -#### Except for "bullet" -* `decrease_damage_with_distance`: (bool) whether damage should decrease as the distance from the target increases. Default is `false` - -#### Bullet type -* `bullet`: (table, "bullet" type only) the properties of the physical bullet shot with this action. +#### Bullets structure +TODO * `remove_on_contact`: (boolean) whether the bullet should cause an explosion when hitting something. It needs `explosion` - * TODO ### Metadata Weapons communicate their state through players metadata: diff --git a/src/tests/test3.lua b/src/tests/test3.lua index 70848fc..5d74d3c 100644 --- a/src/tests/test3.lua +++ b/src/tests/test3.lua @@ -45,7 +45,7 @@ weapons_lib.register_weapon("weapons_lib:test3", { texture = "test1_trail2.png", }, - remove_on_contact = true, -- TODO: considera rinominare in remove_on_contact (l'esplosione avviene se c'รจ explosion) + remove_on_contact = true, gravity = false, -- TODO particelle per quando svanisce? Tipo effetto fumo