Fix accuracy, no more weird acceleration
This commit is contained in:
parent
0870636171
commit
900ae63ce5
13
init.lua
13
init.lua
@ -693,12 +693,7 @@ end
|
||||
|
||||
projectiles = projNum or 1
|
||||
for i=1,projectiles do
|
||||
rndacc = (100 - accuracy) or 0
|
||||
local spawnpos_x = pos.x + (math.random(-rndacc,rndacc)/100)
|
||||
local spawnpos_y = pos.y + (math.random(-rndacc,rndacc)/100)
|
||||
local spawnpos_z = pos.z + (math.random(-rndacc,rndacc)/100)
|
||||
|
||||
local obj = minetest.add_entity({x=spawnpos_x,y=spawnpos_y,z=spawnpos_z}, projEnt)
|
||||
local obj = minetest.add_entity(pos, projEnt)
|
||||
local ent = obj:get_luaentity()
|
||||
|
||||
obj:set_properties(
|
||||
@ -725,9 +720,9 @@ glow = proj_glow,}
|
||||
ent.size = size
|
||||
ent.timer = 0 + (combined_velocity/2000)
|
||||
ent.wear = proj_wear
|
||||
obj:set_velocity({x=dir.x * combined_velocity, y=dir.y * combined_velocity, z=dir.z * combined_velocity})
|
||||
acc = ((( 100 - accuracy ) / 10) / skill_value ) or 0
|
||||
obj:set_acceleration({x=math.random(-acc,acc), y=math.random(-acc,acc)-gravity, z=math.random(-acc,acc)})
|
||||
acc = ((( 100 - accuracy ) / 10) / skill_value ) or 0
|
||||
obj:set_velocity({x=dir.x * combined_velocity + math.random(-acc,acc), y=dir.y * combined_velocity + math.random(-acc,acc), z=dir.z * combined_velocity + math.random(-acc,acc)})
|
||||
obj:set_acceleration({x=0, y=-gravity, z=0})
|
||||
obj:set_rotation({x=0,y=yaw + math.pi,z=-svertical})
|
||||
end end end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user