mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 11:53:46 +01:00
Merge pull request 'fix_xp_reload_bug' (#4226) from teknomunk/MineClone2:fix_xp_reload_bug into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4226 Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
This commit is contained in:
commit
0f20e18e53
@ -177,7 +177,6 @@ minetest.register_entity("mcl_experience:orb", {
|
|||||||
delete_timer = 0,
|
delete_timer = 0,
|
||||||
radius = 4,
|
radius = 4,
|
||||||
|
|
||||||
|
|
||||||
on_activate = function(self, staticdata, dtime_s)
|
on_activate = function(self, staticdata, dtime_s)
|
||||||
self.object:set_velocity(vector.new(
|
self.object:set_velocity(vector.new(
|
||||||
math.random(-2,2)*math.random(),
|
math.random(-2,2)*math.random(),
|
||||||
@ -187,9 +186,13 @@ minetest.register_entity("mcl_experience:orb", {
|
|||||||
self.object:set_armor_groups({immortal = 1})
|
self.object:set_armor_groups({immortal = 1})
|
||||||
self.object:set_velocity({x = 0, y = 2, z = 0})
|
self.object:set_velocity({x = 0, y = 2, z = 0})
|
||||||
self.object:set_acceleration(gravity)
|
self.object:set_acceleration(gravity)
|
||||||
local xp = tonumber(staticdata)
|
|
||||||
|
-- Assign 0 xp in case the entity was persisted even though it should not have been (static_save = false)
|
||||||
|
-- This was a minetest bug for a while: https://github.com/minetest/minetest/issues/14420
|
||||||
|
local xp = tonumber(staticdata) or 0
|
||||||
self._xp = xp
|
self._xp = xp
|
||||||
size = xp_to_size(xp)
|
size = xp_to_size(xp)
|
||||||
|
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
visual_size = {x = size, y = size},
|
visual_size = {x = size, y = size},
|
||||||
glow = 14,
|
glow = 14,
|
||||||
|
Loading…
Reference in New Issue
Block a user