π£ Grenade
Grenades are Pickables which Characters can grab and throw. It explodes after X seconds after thrown, causing damage around.
π Examplesβ
local new_grenade = Grenade(
Vector(-900, 185, 215),
Rotator(0, 90, 90),
"nanos-world::SM_Grenade_G67",
"nanos-world::P_Grenade_Special",
"nanos-world::A_Explosion_Large"
)
π Constructorsβ
Default Constructor
No description provided
local my_grenade = Grenade(location, rotation, static_mesh_asset?, explosion_particles?, explosion_sound?, collision_type?, gravity_enabled?)
Type | Name | Default | Description |
---|---|---|---|
Vector | location | Required parameter | No description provided |
Rotator | rotation | Required parameter | No description provided |
StaticMesh Reference | static_mesh_asset | nanos-world::SM_Grenade_G67 | No description provided |
Particle Reference | explosion_particles | nanos-world::P_Grenade_Special | No description provided |
Sound Reference | explosion_sound | nanos-world::A_Explosion_Large | No description provided |
CollisionType | collision_type | CollisionType.Auto | No description provided |
boolean | gravity_enabled | true | No description provided |
nanos world provides a special Particle* called nanos-world::P_Grenade_Special
which spawns different particles depending on the surface it explodes, and also if is underwater.
*This "Particle" is just a special identifier which can only be used on Grenades!
πΏ Static Functionsβ
Inherited Entity Static Functions
This class doesn't have own static functions.
π¦ Functionsβ
Inherited Entity Functions
Inherited Actor Functions
Inherited Paintable Functions
Inherited Pickable Functions
Returns | Name | Description | |
---|---|---|---|
Explode | Forces this grenade to Explode | ||
![]() | float | GetBaseDamage | Damage at Inner Radius |
![]() | float | GetDamageFalloff | Radius which BaseDamage will apply proportionally |
![]() | float | GetDamageInnerRadius | Radius which MinimumDamage will apply |
![]() | float | GetDamageOuterRadius | Radius which BaseDamage will apply |
![]() | float | GetMinimumDamage | Damage at Outer Radius |
![]() | float | GetThrowForce | Impulse applied when throwing |
![]() | float | GetTimeToExplode | Time until Explosion |
SetDamage | Sets Damage parameters of this Grenade | ||
SetThrowForce | Set Impulse applied when throwing | ||
SetTimeToExplode | Set Time until Explosion after thrown |

Explode
Forces this grenade to Explode
my_grenade:Explode()
See also Explode.

GetBaseDamage
Damage at Inner Radius
β Returns float.
local ret = my_grenade:GetBaseDamage()
See also SetDamage.

GetDamageFalloff
Radius which BaseDamage will apply proportionally
β Returns float.
local ret = my_grenade:GetDamageFalloff()
See also SetDamage.

GetDamageInnerRadius
Radius which MinimumDamage will apply
β Returns float.
local ret = my_grenade:GetDamageInnerRadius()
See also SetDamage.

GetDamageOuterRadius
Radius which BaseDamage will apply
β Returns float.
local ret = my_grenade:GetDamageOuterRadius()
See also SetDamage.

GetMinimumDamage
Damage at Outer Radius
β Returns float.
local ret = my_grenade:GetMinimumDamage()
See also SetDamage.

GetThrowForce
Impulse applied when throwing
β Returns float.
local ret = my_grenade:GetThrowForce()
See also SetThrowForce.

GetTimeToExplode
Time until Explosion
β Returns float.
local ret = my_grenade:GetTimeToExplode()
See also SetTimeToExplode.

SetDamage
Sets Damage parameters of this Grenade
my_grenade:SetDamage(base_damage?, minimum_damage?, damage_inner_radius?, damage_outer_radius?, damage_falloff?)
Type | Parameter | Default | Description |
---|---|---|---|
integer | base_damage? | 90 | Max damage when inner radius |
integer | minimum_damage? | 0 | Min damage when outer radius |
integer | damage_inner_radius? | 200 | Radius which damage will be 100% |
integer | damage_outer_radius? | 1000 | Radius which damage will be interpoled through falloff |
float | damage_falloff? | 1 | Lerp function between Max and Min damage |
See also GetBaseDamage, GetDamageFalloff, GetDamageInnerRadius, GetDamageOuterRadius, GetMinimumDamage.

SetThrowForce
Set Impulse applied when throwing
my_grenade:SetThrowForce(throw_force)
Type | Parameter | Default | Description |
---|---|---|---|
integer | throw_force | Required parameter | No description provided |
See also GetThrowForce.

SetTimeToExplode
Set Time until Explosion after thrown
my_grenade:SetTimeToExplode(time)
Type | Parameter | Default | Description |
---|---|---|---|
float | time | Required parameter | Time in seconds |
See also GetTimeToExplode.
π Eventsβ
Inherited Entity Events
Inherited Actor Events
Inherited Pickable Events
Name | Description | |
---|---|---|
![]() | Explode | Triggered when the grenade has exploded |
![]() | Throw | Triggered when the grenade has been thrown |

Explode
Triggered when the grenade has exploded
Grenade.Subscribe("Explode", function(self)
-- Explode was called
end)
Type | Argument | Description |
---|---|---|
Grenade | self | The grenade which exploded |
See also Explode.

Throw
Triggered when the grenade has been thrown
Grenade.Subscribe("Throw", function(self, handler)
-- Throw was called
end)