3.1 KiB
3.1 KiB
(WIP)
Weapon structure
weapon_type
: (string) can be"gun"
,"melee"
,"snipe"
or"support"
. A gun can have melee functions, but not viceversaaction1
: (table) action on left clickaction2
: (table) action on right clickaction1_hold
: (table, melee only) action on left click if kept pressed for 0.3s. NOT YET IMPLEMENTEDaction2_hold
: (table, melee only) action on right click if kept pressed for 0.3s. NOT YET IMPLEMENTEDaction1_air
: (table, melee only) action on left click whilst in the airaction2_air
: (table, melee only) action on right click whilst in the airmagazine
: (int, no melee) how many bullets the magazine containsreload_time
: (int, no melee) how much time it takes to reload the weaponsound_reload
: (string, no melee) the sound the weapon does when reloading, without the format at the end
Actions structure
type
: (string) can be"raycast"
,"bullet"
,"zoom"
,"install"
,"melee"
,"parry"
or"custom"
description
: (string) what the action does. Displayed in formspecsdamage
: (float) how much damage dealsrange
: (float, no punch) range of the weapondelay
: (float) how much time it should pass between being able to rerun the actionloading_time
: (float) how much time before actually running the action. NOT YET IMPLEMENTEDknockback
: (int) how much knockback the weapon should haveammo_per_use
: (int, no punch) how much ammo is needed to run the actionphysics_override
: (table or string) how the player physics should change when running the action. It takes either a Minetest phyiscs table or the string "FREEZE", which will block the player. Physics is restored when the action endsdecrease_damage_with_distance
: (bool) whether damage should decrease as the distance from the target increases. Default isfalse
continuous_fire
: (bool, no punch) whether it should keep firing when holding down the action key (waitingdelay
seconds between a shot and another). Default isfalse
attack_on_release
: (bool) whether it should attack when the action key is released. NOT YET IMPLEMENTEDpierce
: (bool) whether the hit should stop on the first person or continue. Default isfalse
sound
: (string) the sound to play when the action is runtrail
: (table) the trail the action should leave. Fields are:image
: (string) the particle to spawnamount
: (int) how many particles to draw along the line
on_use
: (function(player, weapon, action, pointed_thing), custom only) the behaviour of the custom action
Notes
*_hold
actions are not implemented due to wielditem animations not being customisable. People would be confused. See: https://github.com/minetest/minetest/issues/2811- same applies for
loading_time
attack_on_release
needs https://github.com/minetest/minetest/issues/13581 to run properly (I only need it for the pixelgun at the moment)bl_weapon_state
metadata communicates the state of the weapon:0
: free1
: loading, NOT YET IMPLEMENTED2
: shooting3
: recovering4
: reloading5
: parrying, NOT YET IMPLEMENTED