From 8e89c148be60733180cda55fa638626b4d623ced Mon Sep 17 00:00:00 2001 From: tacotexmex Date: Tue, 12 Feb 2019 01:12:59 +0100 Subject: [PATCH] Add setting for disabling manual item pickups by mouse --- README.md | 2 ++ init.lua | 5 +++++ settingtypes.txt | 3 +++ 3 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 5771250..821d3f5 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ developed by [PilzAdam](https://github.com/PilzAdam/item_drop). items between these radii are flying to the player for `item_drop.magnet_time` seconds, after this time, they're picked or stop flying. + * Enable manual item pickups by mouse only if `item_drop.mouse_pickup` is + `true` (true by default) * Plays a sound when the items are picked up with the gain level set to `item_drop.pickup_sound_gain` (default 0.2) * Requires a key to be pressed in order to pick items if diff --git a/init.lua b/init.lua index e437f34..3e96094 100644 --- a/init.lua +++ b/init.lua @@ -54,6 +54,11 @@ minetest.settings:get_bool("enable_item_pickup") ~= false then pickup_age = math.min(pickup_age, 0) end end + local mouse_pickup = minetest.settings:get_bool( + "item_drop.mouse_pickup") ~= false + if not mouse_pickup then + minetest.registered_entities["__builtin:item"].pointable = false + end local magnet_mode = magnet_radius > pickup_radius local zero_velocity_mode = pickup_age == -1 diff --git a/settingtypes.txt b/settingtypes.txt index 0bf3684..4896788 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -33,3 +33,6 @@ item_drop.magnet_time (Magnet time) float 5.0 #Time delay in seconds after autopicking an item if it's dropped by a player item_drop.pickup_age (Pickup age) float 0.5 + +#Enable manual item pickups by mouse +item_drop.mouse_pickup (Mouse pickup) bool true