forked from mtcontrib/mobs_redo
		
	getpos to get_pos
This commit is contained in:
		
							
								
								
									
										82
									
								
								api.lua
									
									
									
									
									
								
							
							
						
						
									
										82
									
								
								api.lua
									
									
									
									
									
								
							| @@ -360,7 +360,7 @@ local item_drop = function(self, cooked) | |||||||
| 	if self.child then return end | 	if self.child then return end | ||||||
|  |  | ||||||
| 	local obj, item, num | 	local obj, item, num | ||||||
| 	local pos = self.object:getpos() | 	local pos = self.object:get_pos() | ||||||
|  |  | ||||||
| 	self.drops = self.drops or {} -- nil check | 	self.drops = self.drops or {} -- nil check | ||||||
|  |  | ||||||
| @@ -446,7 +446,7 @@ local check_for_death = function(self, cause, cmi_cause) | |||||||
|  |  | ||||||
| 	mob_sound(self, self.sounds.death) | 	mob_sound(self, self.sounds.death) | ||||||
|  |  | ||||||
| 	local pos = self.object:getpos() | 	local pos = self.object:get_pos() | ||||||
|  |  | ||||||
| 	-- execute custom death function | 	-- execute custom death function | ||||||
| 	if self.on_die then | 	if self.on_die then | ||||||
| @@ -529,7 +529,7 @@ local is_at_cliff = function(self) | |||||||
| 	local yaw = self.object:get_yaw() | 	local yaw = self.object:get_yaw() | ||||||
| 	local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5) | 	local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5) | ||||||
| 	local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) | 	local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) | ||||||
| 	local pos = self.object:getpos() | 	local pos = self.object:get_pos() | ||||||
| 	local ypos = pos.y + self.collisionbox[2] -- just above floor | 	local ypos = pos.y + self.collisionbox[2] -- just above floor | ||||||
|  |  | ||||||
| 	if minetest.line_of_sight( | 	if minetest.line_of_sight( | ||||||
| @@ -576,7 +576,7 @@ local do_env_damage = function(self) | |||||||
| 		update_tag(self) | 		update_tag(self) | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	local pos = self.object:getpos() | 	local pos = self.object:get_pos() | ||||||
|  |  | ||||||
| 	self.time_of_day = minetest.get_timeofday() | 	self.time_of_day = minetest.get_timeofday() | ||||||
|  |  | ||||||
| @@ -696,7 +696,7 @@ self.facing_fence = false | |||||||
| 		return false | 		return false | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	local pos = self.object:getpos() | 	local pos = self.object:get_pos() | ||||||
| 	local yaw = self.object:get_yaw() | 	local yaw = self.object:get_yaw() | ||||||
|  |  | ||||||
| 	-- what is mob standing on? | 	-- what is mob standing on? | ||||||
| @@ -764,7 +764,7 @@ local entity_physics = function(pos, radius) | |||||||
|  |  | ||||||
| 	for n = 1, #objs do | 	for n = 1, #objs do | ||||||
|  |  | ||||||
| 		obj_pos = objs[n]:getpos() | 		obj_pos = objs[n]:get_pos() | ||||||
|  |  | ||||||
| 		dist = get_distance(pos, obj_pos) | 		dist = get_distance(pos, obj_pos) | ||||||
| 		if dist < 1 then dist = 1 end | 		if dist < 1 then dist = 1 end | ||||||
| @@ -864,7 +864,7 @@ local breed = function(self) | |||||||
| 	if self.horny == true | 	if self.horny == true | ||||||
| 	and self.hornytimer <= 40 then | 	and self.hornytimer <= 40 then | ||||||
|  |  | ||||||
| 		local pos = self.object:getpos() | 		local pos = self.object:get_pos() | ||||||
|  |  | ||||||
| 		effect({x = pos.x, y = pos.y + 1, z = pos.z}, 8, "heart.png", 3, 4, 1, 0.1) | 		effect({x = pos.x, y = pos.y + 1, z = pos.z}, 8, "heart.png", 3, 4, 1, 0.1) | ||||||
|  |  | ||||||
| @@ -1073,7 +1073,7 @@ local smart_mobs = function(self, s, p, dist, dtime) | |||||||
| 			s.y = sground.y + 1 | 			s.y = sground.y + 1 | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		local p1 = self.attack:getpos() | 		local p1 = self.attack:get_pos() | ||||||
|  |  | ||||||
| 		p1.x = floor(p1.x + 0.5) | 		p1.x = floor(p1.x + 0.5) | ||||||
| 		p1.y = floor(p1.y + 0.5) | 		p1.y = floor(p1.y + 0.5) | ||||||
| @@ -1237,7 +1237,7 @@ local monster_attack = function(self) | |||||||
| 		return | 		return | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	local s = self.object:getpos() | 	local s = self.object:get_pos() | ||||||
| 	local p, sp, dist | 	local p, sp, dist | ||||||
| 	local player, obj, min_player | 	local player, obj, min_player | ||||||
| 	local type, name = "", "" | 	local type, name = "", "" | ||||||
| @@ -1271,8 +1271,8 @@ local monster_attack = function(self) | |||||||
| 		and (type == "player" or type == "npc" | 		and (type == "player" or type == "npc" | ||||||
| 			or (type == "animal" and self.attack_animals == true)) then | 			or (type == "animal" and self.attack_animals == true)) then | ||||||
|  |  | ||||||
| 			s = self.object:getpos() | 			s = self.object:get_pos() | ||||||
| 			p = player:getpos() | 			p = player:get_pos() | ||||||
| 			sp = s | 			sp = s | ||||||
|  |  | ||||||
| 			-- aim higher to make looking up hills more realistic | 			-- aim higher to make looking up hills more realistic | ||||||
| @@ -1311,7 +1311,7 @@ local npc_attack = function(self) | |||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	local p, sp, obj, min_player | 	local p, sp, obj, min_player | ||||||
| 	local s = self.object:getpos() | 	local s = self.object:get_pos() | ||||||
| 	local min_dist = self.view_range + 1 | 	local min_dist = self.view_range + 1 | ||||||
| 	local objs = minetest.get_objects_inside_radius(s, self.view_range) | 	local objs = minetest.get_objects_inside_radius(s, self.view_range) | ||||||
|  |  | ||||||
| @@ -1321,7 +1321,7 @@ local npc_attack = function(self) | |||||||
|  |  | ||||||
| 		if obj and obj.type == "monster" then | 		if obj and obj.type == "monster" then | ||||||
|  |  | ||||||
| 			p = obj.object:getpos() | 			p = obj.object:get_pos() | ||||||
|  |  | ||||||
| 			dist = get_distance(p, s) | 			dist = get_distance(p, s) | ||||||
|  |  | ||||||
| @@ -1348,12 +1348,12 @@ local follow_flop = function(self) | |||||||
| 	and self.state ~= "attack" | 	and self.state ~= "attack" | ||||||
| 	and self.state ~= "runaway" then | 	and self.state ~= "runaway" then | ||||||
|  |  | ||||||
| 		local s = self.object:getpos() | 		local s = self.object:get_pos() | ||||||
| 		local players = minetest.get_connected_players() | 		local players = minetest.get_connected_players() | ||||||
|  |  | ||||||
| 		for n = 1, #players do | 		for n = 1, #players do | ||||||
|  |  | ||||||
| 			if get_distance(players[n]:getpos(), s) < self.view_range | 			if get_distance(players[n]:get_pos(), s) < self.view_range | ||||||
| 			and not mobs.invis[ players[n]:get_player_name() ] then | 			and not mobs.invis[ players[n]:get_player_name() ] then | ||||||
|  |  | ||||||
| 				self.following = players[n] | 				self.following = players[n] | ||||||
| @@ -1387,16 +1387,16 @@ local follow_flop = function(self) | |||||||
| 	-- follow that thing | 	-- follow that thing | ||||||
| 	if self.following then | 	if self.following then | ||||||
|  |  | ||||||
| 		local s = self.object:getpos() | 		local s = self.object:get_pos() | ||||||
| 		local p | 		local p | ||||||
|  |  | ||||||
| 		if self.following:is_player() then | 		if self.following:is_player() then | ||||||
|  |  | ||||||
| 			p = self.following:getpos() | 			p = self.following:get_pos() | ||||||
|  |  | ||||||
| 		elseif self.following.object then | 		elseif self.following.object then | ||||||
|  |  | ||||||
| 			p = self.following.object:getpos() | 			p = self.following.object:get_pos() | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		if p then | 		if p then | ||||||
| @@ -1439,7 +1439,7 @@ local follow_flop = function(self) | |||||||
|  |  | ||||||
| 	-- swimmers flop when out of their element, and swim again when back in | 	-- swimmers flop when out of their element, and swim again when back in | ||||||
| 	if self.fly then | 	if self.fly then | ||||||
| 		local s = self.object:getpos() | 		local s = self.object:get_pos() | ||||||
| 		if not flight_check(self, s) then | 		if not flight_check(self, s) then | ||||||
|  |  | ||||||
| 			self.state = "flop" | 			self.state = "flop" | ||||||
| @@ -1494,13 +1494,13 @@ local do_states = function(self, dtime) | |||||||
| 		if random(1, 4) == 1 then | 		if random(1, 4) == 1 then | ||||||
|  |  | ||||||
| 			local lp = nil | 			local lp = nil | ||||||
| 			local s = self.object:getpos() | 			local s = self.object:get_pos() | ||||||
| 			local objs = minetest.get_objects_inside_radius(s, 3) | 			local objs = minetest.get_objects_inside_radius(s, 3) | ||||||
|  |  | ||||||
| 			for n = 1, #objs do | 			for n = 1, #objs do | ||||||
|  |  | ||||||
| 				if objs[n]:is_player() then | 				if objs[n]:is_player() then | ||||||
| 					lp = objs[n]:getpos() | 					lp = objs[n]:get_pos() | ||||||
| 					break | 					break | ||||||
| 				end | 				end | ||||||
| 			end | 			end | ||||||
| @@ -1554,7 +1554,7 @@ local do_states = function(self, dtime) | |||||||
|  |  | ||||||
| 	elseif self.state == "walk" then | 	elseif self.state == "walk" then | ||||||
|  |  | ||||||
| 		local s = self.object:getpos() | 		local s = self.object:get_pos() | ||||||
| 		local lp = nil | 		local lp = nil | ||||||
|  |  | ||||||
| 		-- is there something I need to avoid? | 		-- is there something I need to avoid? | ||||||
| @@ -1674,14 +1674,14 @@ local do_states = function(self, dtime) | |||||||
| 	elseif self.state == "attack" then | 	elseif self.state == "attack" then | ||||||
|  |  | ||||||
| 		-- calculate distance from mob and enemy | 		-- calculate distance from mob and enemy | ||||||
| 		local s = self.object:getpos() | 		local s = self.object:get_pos() | ||||||
| 		local p = self.attack:getpos() or s | 		local p = self.attack:get_pos() or s | ||||||
| 		local dist = get_distance(p, s) | 		local dist = get_distance(p, s) | ||||||
|  |  | ||||||
| 		-- stop attacking if player or out of range | 		-- stop attacking if player or out of range | ||||||
| 		if dist > self.view_range | 		if dist > self.view_range | ||||||
| 		or not self.attack | 		or not self.attack | ||||||
| 		or not self.attack:getpos() | 		or not self.attack:get_pos() | ||||||
| 		or self.attack:get_hp() <= 0 | 		or self.attack:get_hp() <= 0 | ||||||
| 		or (self.attack:is_player() and mobs.invis[ self.attack:get_player_name() ]) then | 		or (self.attack:is_player() and mobs.invis[ self.attack:get_player_name() ]) then | ||||||
|  |  | ||||||
| @@ -1752,7 +1752,7 @@ local do_states = function(self, dtime) | |||||||
|  |  | ||||||
| 				if self.timer > 3 then | 				if self.timer > 3 then | ||||||
|  |  | ||||||
| 					local pos = self.object:getpos() | 					local pos = self.object:get_pos() | ||||||
| 					local radius = self.explosion_radius or 1 | 					local radius = self.explosion_radius or 1 | ||||||
| 					local damage_radius = radius | 					local damage_radius = radius | ||||||
|  |  | ||||||
| @@ -1995,7 +1995,7 @@ local do_states = function(self, dtime) | |||||||
| 				-- play shoot attack sound | 				-- play shoot attack sound | ||||||
| 				mob_sound(self, self.sounds.shoot_attack) | 				mob_sound(self, self.sounds.shoot_attack) | ||||||
|  |  | ||||||
| 				local p = self.object:getpos() | 				local p = self.object:get_pos() | ||||||
|  |  | ||||||
| 				p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2 | 				p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2 | ||||||
|  |  | ||||||
| @@ -2073,7 +2073,7 @@ local falling = function(self, pos) | |||||||
| 		if self.fall_damage == 1 | 		if self.fall_damage == 1 | ||||||
| 		and self.object:getvelocity().y == 0 then | 		and self.object:getvelocity().y == 0 then | ||||||
|  |  | ||||||
| 			local d = (self.old_y or 0) - self.object:getpos().y | 			local d = (self.old_y or 0) - self.object:get_pos().y | ||||||
|  |  | ||||||
| 			if d > 5 then | 			if d > 5 then | ||||||
|  |  | ||||||
| @@ -2086,7 +2086,7 @@ local falling = function(self, pos) | |||||||
| 				end | 				end | ||||||
| 			end | 			end | ||||||
|  |  | ||||||
| 			self.old_y = self.object:getpos().y | 			self.old_y = self.object:get_pos().y | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
| @@ -2117,7 +2117,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) | |||||||
|  |  | ||||||
| 	-- is mob protected? | 	-- is mob protected? | ||||||
| 	if self.protected and hitter:is_player() | 	if self.protected and hitter:is_player() | ||||||
| 	and minetest.is_protected(self.object:getpos(), hitter:get_player_name()) then | 	and minetest.is_protected(self.object:get_pos(), hitter:get_player_name()) then | ||||||
| 		minetest.chat_send_player(hitter:get_player_name(), S("Mob has been protected!")) | 		minetest.chat_send_player(hitter:get_player_name(), S("Mob has been protected!")) | ||||||
| 		return | 		return | ||||||
| 	end | 	end | ||||||
| @@ -2216,7 +2216,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) | |||||||
| 		if self.blood_amount > 0 | 		if self.blood_amount > 0 | ||||||
| 		and not disable_blood then | 		and not disable_blood then | ||||||
|  |  | ||||||
| 			local pos = self.object:getpos() | 			local pos = self.object:get_pos() | ||||||
|  |  | ||||||
| 			pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) * .5 | 			pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) * .5 | ||||||
|  |  | ||||||
| @@ -2286,8 +2286,8 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) | |||||||
| 	-- if skittish then run away | 	-- if skittish then run away | ||||||
| 	if self.runaway == true then | 	if self.runaway == true then | ||||||
|  |  | ||||||
| 		local lp = hitter:getpos() | 		local lp = hitter:get_pos() | ||||||
| 		local s = self.object:getpos() | 		local s = self.object:get_pos() | ||||||
| 		local vec = { | 		local vec = { | ||||||
| 			x = lp.x - s.x, | 			x = lp.x - s.x, | ||||||
| 			y = lp.y - s.y, | 			y = lp.y - s.y, | ||||||
| @@ -2320,7 +2320,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) | |||||||
| 		do_attack(self, hitter) | 		do_attack(self, hitter) | ||||||
|  |  | ||||||
| 		-- alert others to the attack | 		-- alert others to the attack | ||||||
| 		local objs = minetest.get_objects_inside_radius(hitter:getpos(), self.view_range) | 		local objs = minetest.get_objects_inside_radius(hitter:get_pos(), self.view_range) | ||||||
| 		local obj = nil | 		local obj = nil | ||||||
|  |  | ||||||
| 		for n = 1, #objs do | 		for n = 1, #objs do | ||||||
| @@ -2485,7 +2485,7 @@ local mob_activate = function(self, staticdata, def, dtime) | |||||||
| 	-- end init | 	-- end init | ||||||
|  |  | ||||||
| 	self.object:set_armor_groups({immortal = 1, fleshy = self.armor}) | 	self.object:set_armor_groups({immortal = 1, fleshy = self.armor}) | ||||||
| 	self.old_y = self.object:getpos().y | 	self.old_y = self.object:get_pos().y | ||||||
| 	self.old_health = self.health | 	self.old_health = self.health | ||||||
| 	self.sounds.distance = self.sounds.distance or 10 | 	self.sounds.distance = self.sounds.distance or 10 | ||||||
| 	self.textures = textures | 	self.textures = textures | ||||||
| @@ -2526,7 +2526,7 @@ local mob_step = function(self, dtime) | |||||||
| 		cmi.notify_step(self.object, dtime) | 		cmi.notify_step(self.object, dtime) | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	local pos = self.object:getpos() | 	local pos = self.object:get_pos() | ||||||
| 	local yaw = 0 | 	local yaw = 0 | ||||||
|  |  | ||||||
| 	-- when lifetimer expires remove mob (except npc and tamed) | 	-- when lifetimer expires remove mob (except npc and tamed) | ||||||
| @@ -3006,7 +3006,7 @@ function mobs:register_arrow(name, def) | |||||||
|  |  | ||||||
| 			self.timer = self.timer + 1 | 			self.timer = self.timer + 1 | ||||||
|  |  | ||||||
| 			local pos = self.object:getpos() | 			local pos = self.object:get_pos() | ||||||
|  |  | ||||||
| 			if self.switch == 0 | 			if self.switch == 0 | ||||||
| 			or self.timer > 150 | 			or self.timer > 150 | ||||||
| @@ -3349,7 +3349,7 @@ function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, | |||||||
| 			if inv:room_for_item("main", new_stack) then | 			if inv:room_for_item("main", new_stack) then | ||||||
| 				inv:add_item("main", new_stack) | 				inv:add_item("main", new_stack) | ||||||
| 			else | 			else | ||||||
| 				minetest.add_item(clicker:getpos(), new_stack) | 				minetest.add_item(clicker:get_pos(), new_stack) | ||||||
| 			end | 			end | ||||||
|  |  | ||||||
| 			self.object:remove() | 			self.object:remove() | ||||||
| @@ -3396,10 +3396,10 @@ function mobs:protect(self, clicker) | |||||||
| 	self.protected = true | 	self.protected = true | ||||||
| --	minetest.chat_send_player(name, S("Protected!")) | --	minetest.chat_send_player(name, S("Protected!")) | ||||||
|  |  | ||||||
| 	local pos = self.object:getpos() | 	local pos = self.object:get_pos() | ||||||
| 	pos.y = pos.y + self.collisionbox[2] + 0.5 | 	pos.y = pos.y + self.collisionbox[2] + 0.5 | ||||||
|  |  | ||||||
| 	effect(self.object:getpos(), 25, "mobs_protect_particle.png", 0.5, 4, 2, 15) | 	effect(self.object:get_pos(), 25, "mobs_protect_particle.png", 0.5, 4, 2, 15) | ||||||
|  |  | ||||||
| 	mob_sound(self, "mobs_spell") | 	mob_sound(self, "mobs_spell") | ||||||
|  |  | ||||||
| @@ -3574,7 +3574,7 @@ function mobs:alias_mob(old_name, new_name) | |||||||
|  |  | ||||||
| 		on_step = function(self) | 		on_step = function(self) | ||||||
|  |  | ||||||
| 			local pos = self.object:getpos() | 			local pos = self.object:get_pos() | ||||||
|  |  | ||||||
| 			if minetest.registered_entities[new_name] then | 			if minetest.registered_entities[new_name] then | ||||||
| 				minetest.add_entity(pos, new_name) | 				minetest.add_entity(pos, new_name) | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								mount.lua
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								mount.lua
									
									
									
									
									
								
							| @@ -166,7 +166,7 @@ function mobs.detach(player, offset) | |||||||
|  |  | ||||||
| 	default.player_set_animation(player, "stand" , 30) | 	default.player_set_animation(player, "stand" , 30) | ||||||
|  |  | ||||||
| 	local pos = player:getpos() | 	local pos = player:get_pos() | ||||||
|  |  | ||||||
| 	pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z} | 	pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z} | ||||||
|  |  | ||||||
| @@ -212,7 +212,6 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) | |||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		-- fix mob rotation | 		-- fix mob rotation | ||||||
| --		entity.object:setyaw(entity.driver:get_look_yaw() - entity.rotate) |  | ||||||
| 		entity.object:setyaw(entity.driver:get_look_horizontal() - entity.rotate) | 		entity.object:setyaw(entity.driver:get_look_horizontal() - entity.rotate) | ||||||
|  |  | ||||||
| 		if can_fly then | 		if can_fly then | ||||||
| @@ -290,7 +289,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) | |||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	-- Set position, velocity and acceleration | 	-- Set position, velocity and acceleration | ||||||
| 	local p = entity.object:getpos() | 	local p = entity.object:get_pos() | ||||||
| 	local new_velo = {x = 0, y = 0, z = 0} | 	local new_velo = {x = 0, y = 0, z = 0} | ||||||
| 	local new_acce = {x = 0, y = -9.8, z = 0} | 	local new_acce = {x = 0, y = -9.8, z = 0} | ||||||
|  |  | ||||||
| @@ -344,7 +343,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) | |||||||
| 				end | 				end | ||||||
| 			else | 			else | ||||||
| 				if math.abs(velo.y) < 1 then | 				if math.abs(velo.y) < 1 then | ||||||
| 					local pos = entity.object:getpos() | 					local pos = entity.object:get_pos() | ||||||
| 					pos.y = math.floor(pos.y) + 0.5 | 					pos.y = math.floor(pos.y) + 0.5 | ||||||
| 					entity.object:setpos(pos) | 					entity.object:setpos(pos) | ||||||
| 					velo.y = 0 | 					velo.y = 0 | ||||||
| @@ -389,7 +388,6 @@ function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim) | |||||||
| 	local ctrl = entity.driver:get_player_control() | 	local ctrl = entity.driver:get_player_control() | ||||||
| 	local velo = entity.object:getvelocity() | 	local velo = entity.object:getvelocity() | ||||||
| 	local dir = entity.driver:get_look_dir() | 	local dir = entity.driver:get_look_dir() | ||||||
| --	local yaw = entity.driver:get_look_yaw() |  | ||||||
| 	local yaw = entity.driver:get_look_horizontal() + 1.57 -- offset fix between old and new commands | 	local yaw = entity.driver:get_look_horizontal() + 1.57 -- offset fix between old and new commands | ||||||
| 	local rot_steer, rot_view = math.pi / 2, 0 | 	local rot_steer, rot_view = math.pi / 2, 0 | ||||||
|  |  | ||||||
| @@ -420,7 +418,7 @@ function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim) | |||||||
| 	-- firing arrows | 	-- firing arrows | ||||||
| 	if ctrl.LMB and ctrl.sneak and shoots then | 	if ctrl.LMB and ctrl.sneak and shoots then | ||||||
|  |  | ||||||
| 		local pos = entity.object:getpos() | 		local pos = entity.object:get_pos() | ||||||
| 		local obj = minetest.add_entity({ | 		local obj = minetest.add_entity({ | ||||||
| 			x = pos.x + 0 + dir.x * 2.5, | 			x = pos.x + 0 + dir.x * 2.5, | ||||||
| 			y = pos.y + 1.5 + dir.y, | 			y = pos.y + 1.5 + dir.y, | ||||||
| @@ -431,7 +429,6 @@ function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim) | |||||||
| 			ent.switch = 1 -- for mob specific arrows | 			ent.switch = 1 -- for mob specific arrows | ||||||
| 			ent.owner_id = tostring(entity.object) -- so arrows dont hurt entity you are riding | 			ent.owner_id = tostring(entity.object) -- so arrows dont hurt entity you are riding | ||||||
| 			local vec = {x = dir.x * 6, y = dir.y * 6, z = dir.z * 6} | 			local vec = {x = dir.x * 6, y = dir.y * 6, z = dir.z * 6} | ||||||
| --			local yaw = entity.driver:get_look_yaw() |  | ||||||
| 			local yaw = entity.driver:get_look_horizontal() | 			local yaw = entity.driver:get_look_horizontal() | ||||||
| 			obj:setyaw(yaw + math.pi / 2) | 			obj:setyaw(yaw + math.pi / 2) | ||||||
| 			obj:setvelocity(vec) | 			obj:setvelocity(vec) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user