sniper_rifles: Prioritize on un-scoping when right-clicking (#661)
This commit is contained in:
parent
7793e76890
commit
77c9f9d21b
1 changed files with 6 additions and 3 deletions
|
@ -54,11 +54,13 @@ local function on_use(stack, user, pointed)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_rclick(item, placer, pointed_thing)
|
local function on_rclick(item, placer, pointed_thing)
|
||||||
if pointed_thing.type == "object" then
|
local name = placer:get_player_name()
|
||||||
return
|
|
||||||
|
-- Prioritize on "un-scoping", if player is using the scope
|
||||||
|
if not scoped[name] and pointed_thing.type == "node" then
|
||||||
|
return minetest.item_place(item, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
local name = placer:get_player_name()
|
|
||||||
if scoped[name] then
|
if scoped[name] then
|
||||||
hide_scope(name)
|
hide_scope(name)
|
||||||
else
|
else
|
||||||
|
@ -114,6 +116,7 @@ function sniper_rifles.register_rifle(name, def)
|
||||||
-- Manually add extra fields to itemdef that shooter doesn't allow
|
-- Manually add extra fields to itemdef that shooter doesn't allow
|
||||||
-- Also modify the _loaded variant
|
-- Also modify the _loaded variant
|
||||||
local overrides = {
|
local overrides = {
|
||||||
|
on_place = on_rclick,
|
||||||
on_secondary_use = on_rclick,
|
on_secondary_use = on_rclick,
|
||||||
wield_scale = vector.new(2, 2, 1.5)
|
wield_scale = vector.new(2, 2, 1.5)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue