Merge pull request 'Arrows check if PVP is enabled by @pepebotella' (#2438) from arrow-pvp into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2438
This commit is contained in:
commit
2da4962835
|
@ -1,6 +1,7 @@
|
|||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local mod_target = minetest.get_modpath("mcl_target")
|
||||
local enable_pvp = minetest.settings:get_bool("enable_pvp")
|
||||
|
||||
local math = math
|
||||
local vector = vector
|
||||
|
@ -204,9 +205,9 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
if hitpoint.type == "object" then
|
||||
-- find the closest object that is in the way of the arrow
|
||||
local ok = false
|
||||
if hitpoint.ref:is_player() then
|
||||
if hitpoint.ref:is_player() and enable_pvp then
|
||||
ok = true
|
||||
elseif hitpoint.ref:get_luaentity() then
|
||||
elseif not hitpoint.ref:is_player() and hitpoint.ref:get_luaentity() then
|
||||
if (hitpoint.ref:get_luaentity().is_mob or hitpoint.ref:get_luaentity()._hittable_by_projectile) then
|
||||
ok = true
|
||||
end
|
||||
|
|
|
@ -231,6 +231,7 @@ end
|
|||
local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements")
|
||||
local mod_button = minetest.get_modpath("mesecons_button")
|
||||
local mod_target = minetest.get_modpath("mcl_target")
|
||||
local enable_pvp = minetest.settings:get_bool("enable_pvp")
|
||||
|
||||
minetest.register_craftitem("mcl_bows:rocket", {
|
||||
description = S("Arrow"),
|
||||
|
@ -417,9 +418,9 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
if hitpoint.type == "object" then
|
||||
-- find the closest object that is in the way of the arrow
|
||||
local ok = false
|
||||
if hitpoint.ref:is_player() then
|
||||
if hitpoint.ref:is_player() and enable_pvp then
|
||||
ok = true
|
||||
elseif hitpoint.ref:get_luaentity() then
|
||||
elseif not hitpoint.ref:is_player() and hitpoint.ref:get_luaentity() then
|
||||
if (hitpoint.ref:get_luaentity().is_mob or hitpoint.ref:get_luaentity()._hittable_by_projectile) then
|
||||
ok = true
|
||||
end
|
||||
|
|
|
@ -30,6 +30,7 @@ local how_to_shoot = minetest.registered_items["mcl_bows:arrow"]._doc_items_usag
|
|||
|
||||
local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements")
|
||||
local mod_button = minetest.get_modpath("mesecons_button")
|
||||
local enable_pvp = minetest.settings:get_bool("enable_pvp")
|
||||
|
||||
local arrow_longdesc = minetest.registered_items["mcl_bows:arrow"]._doc_items_longdesc or ""
|
||||
local arrow_tt = minetest.registered_items["mcl_bows:arrow"]._tt_help or ""
|
||||
|
@ -217,9 +218,9 @@ function mcl_potions.register_arrow(name, desc, color, def)
|
|||
if hitpoint.type == "object" then
|
||||
-- find the closest object that is in the way of the arrow
|
||||
local ok = false
|
||||
if hitpoint.ref:is_player() then
|
||||
if hitpoint.ref:is_player() and enable_pvp then
|
||||
ok = true
|
||||
elseif hitpoint.ref:get_luaentity() then
|
||||
elseif not hitpoint.ref:is_player() and hitpoint.ref:get_luaentity() then
|
||||
if (hitpoint.ref:get_luaentity().is_mob or hitpoint.ref:get_luaentity()._hittable_by_projectile) then
|
||||
ok = true
|
||||
end
|
||||
|
@ -283,7 +284,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
|
|||
if is_player then
|
||||
if self._shooter and self._shooter:is_player() then
|
||||
-- “Ding” sound for hitting another player
|
||||
minetest.sound_play({name="mcl_bows_hit_player", gain=0.1}, {to_player=self._shooter}, true)
|
||||
minetest.sound_play({name="mcl_bows_hit_player", gain=0.1}, {to_player=self._shooter:get_player_name()}, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user