Fix getpos, setvelocity, and setacceleration
This commit is contained in:
parent
369c5c647c
commit
64c94310ef
@ -36,7 +36,7 @@ local rangedweapons_rocket = {
|
||||
rangedweapons_rocket.on_step = function(self, dtime, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
local node = minetest.get_node(pos)
|
||||
if self.timer >= 0.002 then
|
||||
minetest.add_particle({
|
||||
@ -102,7 +102,7 @@ local rangedweapons_he_grenade = {
|
||||
rangedweapons_he_grenade.on_step = function(self, dtime, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local pos = self.object:get_pos()
|
||||
local node = minetest.get_node(pos)
|
||||
if self.timer >= 0.002 then
|
||||
minetest.add_particle({
|
||||
|
@ -65,8 +65,8 @@ if pinEnt then
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
local svertical = user:get_look_vertical()
|
||||
pinEnt:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
pinEnt:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
pinEnt:set_velocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
pinEnt:set_acceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
pinEnt:set_rotation({x=0,y=yaw + math.pi,z=-svertical})
|
||||
end
|
||||
return itemstack end,
|
||||
|
10
init.lua
10
init.lua
@ -257,7 +257,7 @@ end
|
||||
|
||||
rangedweapons_yeet = function(itemstack, player)
|
||||
|
||||
if minetest.find_node_near(player:getpos(), 10,"rangedweapons:antigun_block")
|
||||
if minetest.find_node_near(player:get_pos(), 10,"rangedweapons:antigun_block")
|
||||
then
|
||||
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","throwable weapons are prohibited in this area!"))
|
||||
else
|
||||
@ -353,7 +353,7 @@ end
|
||||
|
||||
rangedweapons_shoot_gun = function(itemstack, player)
|
||||
|
||||
if minetest.find_node_near(player:getpos(), 10,"rangedweapons:antigun_block")
|
||||
if minetest.find_node_near(player:get_pos(), 10,"rangedweapons:antigun_block")
|
||||
then
|
||||
minetest.sound_play("rangedweapons_empty", {pos = player:get_pos()})
|
||||
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Guns are prohibited in this area!"))
|
||||
@ -548,7 +548,7 @@ end end
|
||||
|
||||
rangedweapons_shoot_powergun = function(itemstack, player)
|
||||
|
||||
if minetest.find_node_near(player:getpos(), 10,"rangedweapons:antigun_block")
|
||||
if minetest.find_node_near(player:get_pos(), 10,"rangedweapons:antigun_block")
|
||||
then
|
||||
minetest.sound_play("rangedweapons_empty", {pos = player:get_pos()})
|
||||
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Guns are prohibited in this area!"))
|
||||
@ -669,8 +669,8 @@ rangedweapons_launch_projectile = function(player,projNum,projDmg,projEnt,visual
|
||||
|
||||
if has_shell > 0 then
|
||||
local shl = minetest.add_entity(pos, shellEnt)
|
||||
shl:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
shl:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
shl:set_velocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
shl:set_acceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
shl:set_rotation({x=0,y=yaw + math.pi,z=-svertical})
|
||||
shl:set_properties({
|
||||
textures = {shellTexture},
|
||||
|
Loading…
Reference in New Issue
Block a user