Fix things

This commit is contained in:
jordan4ibanez 2023-11-12 17:58:25 -05:00
parent 1aca118ce9
commit 64159afd4c
5 changed files with 11 additions and 12 deletions

View File

@ -120,7 +120,7 @@ global record minetest
get_meta: function(Vec3): MetaData
get_node_timer: function(Vec3): NodeTimerObject
add_entity: function(Vec3, string, string): ObjectRef | nil
add_item: function(Vec3, ItemStackObject | string): ObjectRef | nil
add_item: function(Vec3, ItemStackObject | string): ObjectRef
get_player_by_name: function(string): ObjectRef
get_objects_inside_radius: function(Vec3, number): {ObjectRef}
get_objects_in_area: function(Vec3, Vec3): {ObjectRef}

View File

@ -16,13 +16,15 @@ function minetest.handle_node_drops(pos, drops, _digger)
for _, drop in ipairs(drops) do
local item = minetest.add_item(pos, drop)
if item then
(item):add_velocity(
item:add_velocity(
vector.random(
-1, 1,
1, 2,
-1, 1))
local entity = (item:get_luaentity())
entity.age = 1
end
end
end

View File

@ -16,13 +16,15 @@ function minetest.handle_node_drops(pos: Vec3, drops: {string}, _digger: ObjectR
for _,drop in ipairs(drops) do
local item: ObjectRef = minetest.add_item(pos, drop)
if item then
(item as ObjectRef):add_velocity(
item:add_velocity(
vector.random(
-1,1,
1,2,
-1,1
)
)
local entity = (item:get_luaentity() as table)
entity.age = 1
end
end
end

View File

@ -288,12 +288,7 @@ end
function entity:poll_players(pos)
if (self.collected) then return end
if (not self.age) then return end
if (self.age < 0.55) then return end
if (self.age < 1.5) then return end
local solved = false
for _, player in ipairs(minetest.get_connected_players()) do
@ -306,9 +301,9 @@ function entity:poll_players(pos)
if (not inv) then goto continue end
if (not inv:room_for_item("main", self.itemstring)) then return end
inv:add_item("main", self.itemstring)
player_pos.y = player_pos.y + 0.8
self:disable_physics()
self.object:set_velocity(vector.multiply(vector.direction(pos, player_pos), 10))
self.object:move_to(player_pos, true)

View File

@ -288,7 +288,7 @@ end
function entity:poll_players(pos: Vec3)
if (self.collected) then return end
if (not self.age) then return end
if (self.age < 0.55) then return end
if (self.age < 1.5) then return end
local solved = false
for _,player in ipairs(minetest.get_connected_players()) do