forked from VoxeLibre/VoxeLibre
Some shield fixes
This commit is contained in:
parent
7879be078c
commit
381b02b917
|
@ -83,7 +83,7 @@ local ARROW_ENTITY={
|
|||
local function spawn_item(self, pos)
|
||||
if not minetest.is_creative_enabled("") then
|
||||
local item = minetest.add_item(pos, "mcl_bows:arrow")
|
||||
item:set_velocity({x=0, y=0, z=0})
|
||||
item:set_velocity(vector.new(0, 0, 0))
|
||||
item:set_yaw(self.object:get_yaw())
|
||||
end
|
||||
mcl_burning.extinguish(self.object)
|
||||
|
@ -95,12 +95,10 @@ local function damage_particles(pos, is_critical)
|
|||
minetest.add_particlespawner({
|
||||
amount = 15,
|
||||
time = 0.1,
|
||||
minpos = {x=pos.x-0.5, y=pos.y-0.5, z=pos.z-0.5},
|
||||
maxpos = {x=pos.x+0.5, y=pos.y+0.5, z=pos.z+0.5},
|
||||
minvel = {x=-0.1, y=-0.1, z=-0.1},
|
||||
maxvel = {x=0.1, y=0.1, z=0.1},
|
||||
minacc = {x=0, y=0, z=0},
|
||||
maxacc = {x=0, y=0, z=0},
|
||||
minpos = vector.offset(pos, -0.5, -0.5, -0.5),
|
||||
maxpos = vector.offset(pos, 0.5, 0.5, 0.5),
|
||||
minvel = vector.new(-0.1, -0.1, -0.1),
|
||||
maxvel = vector.new(0.1, 0.1, 0.1),
|
||||
minexptime = 1,
|
||||
maxexptime = 2,
|
||||
minsize = 1.5,
|
||||
|
@ -293,7 +291,11 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
end
|
||||
self._z_rotation = math.random(-30, 30)
|
||||
self._y_rotation = math.random( -30, 30)
|
||||
self.object:set_attach(obj, self._attach_parent, {x=self._x_position,y=self._y_position,z=random_arrow_positions("z", placement)}, {x=0,y=self._rotation_station + self._y_rotation,z=self._z_rotation})
|
||||
self.object:set_attach(
|
||||
obj, self._attach_parent,
|
||||
vector.new(self._x_position, self._y_position, random_arrow_positions("z", placement)),
|
||||
vector.new(0, self._rotation_station + self._y_rotation, self._z_rotation)
|
||||
)
|
||||
else
|
||||
self._blocked = true
|
||||
self.object:set_velocity(vector.multiply(self.object:get_velocity(), -0.25))
|
||||
|
@ -351,9 +353,9 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
local dir
|
||||
if math.abs(vel.y) < 0.00001 then
|
||||
if self._lastpos.y < pos.y then
|
||||
dir = {x=0, y=1, z=0}
|
||||
dir = vector.new(0, 1, 0)
|
||||
else
|
||||
dir = {x=0, y=-1, z=0}
|
||||
dir = vector.new(0, -1, 0)
|
||||
end
|
||||
else
|
||||
dir = minetest.facedir_to_dir(minetest.dir_to_facedir(minetest.yaw_to_dir(self.object:get_yaw()-YAW_OFFSET)))
|
||||
|
@ -381,8 +383,8 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
self._stucktimer = 0
|
||||
self._stuckrechecktimer = 0
|
||||
|
||||
self.object:set_velocity({x=0, y=0, z=0})
|
||||
self.object:set_acceleration({x=0, y=0, z=0})
|
||||
self.object:set_velocity(vector.new(0, 0, 0))
|
||||
self.object:set_acceleration(vector.new(0, 0, 0))
|
||||
|
||||
minetest.sound_play({name="mcl_bows_hit_other", gain=0.3}, {pos=self.object:get_pos(), max_hear_distance=16}, true)
|
||||
|
||||
|
@ -427,7 +429,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
end
|
||||
|
||||
-- Update internal variable
|
||||
self._lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
self._lastpos = pos
|
||||
end
|
||||
|
||||
-- Force recheck of stuck arrows when punched.
|
||||
|
|
|
@ -42,7 +42,7 @@ local function wielding_shield(obj)
|
|||
end
|
||||
|
||||
local function shield_is_enchanted(obj)
|
||||
return wielding_shield(obj) and wielded_item(obj):find("_enchanted")
|
||||
return mcl_enchanting.is_enchanted(wielded_item(obj))
|
||||
end
|
||||
|
||||
minetest.register_entity("mcl_shields:shield_entity", {
|
||||
|
@ -128,7 +128,7 @@ end
|
|||
|
||||
local function set_shield(player, block)
|
||||
if block then
|
||||
modify_shield(player, vector.new(-8, 4, -3), vector.new(80, 80, 0))
|
||||
modify_shield(player, vector.new(-8, 4, -2.5), vector.new(80, 80, 0))
|
||||
else
|
||||
modify_shield(player, vector.new(3, -5, 0), vector.new(0, 0, 0))
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue