From 0d58b85a6677f5be8b9af51f9bc4ff89d09a9ed6 Mon Sep 17 00:00:00 2001 From: stujones11 Date: Sun, 24 Mar 2019 15:22:34 +0000 Subject: [PATCH] Minor fixes, add optional node drops --- shooter/README.md | 7 +++++++ shooter/api.lua | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/shooter/README.md b/shooter/README.md index 5f0caf6..c6d7f07 100644 --- a/shooter/README.md +++ b/shooter/README.md @@ -74,6 +74,13 @@ Defaults to `false` in singleplayer mode `shooter_allow_players = true` +### Node Drops + +Drops the node item when hit, requires `shooter_allow_nodes` to be `true` +Currently excludes 'blasting' + +`shooter_node_drops = false` + ### Round update time Maximum round 'step' processing interval, will inversely effect the long-range velocity of the virtual projectiles. This should always be greater than the dedicated server step time diff --git a/shooter/api.lua b/shooter/api.lua index f99cb94..7045f48 100644 --- a/shooter/api.lua +++ b/shooter/api.lua @@ -29,6 +29,7 @@ shooter.config = { enable_protection = false, enable_crafting = true, explosion_texture = "shooter_hit.png", + node_drops = false, allow_nodes = true, allow_entities = false, allow_players = true, @@ -199,6 +200,16 @@ shooter.punch_node = function(pos, spec) shooter.spawn_particles(pos, {texture=item.tiles[1]}) end end + if config.node_drops then + local object = minetest.add_item(pos, item) + if object then + object:set_velocity({ + x = math.random(-1, 1), + y = 4, + z = math.random(-1, 1) + }) + end + end return true end end