Open superfloh247 opened 3 years ago
I got it to work (somewhat) with these changes:
diff --git a/gravityuse.lua b/gravityuse.lua
index 53ce6a9..8e02a99 100644
--- a/gravityuse.lua
+++ b/gravityuse.lua
@@ -62,7 +62,7 @@ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
if self.target and self.target:get_attach() then
self.target:set_detach()
self.target:set_hp(0)
- self.target:punch(self.object, {full_punch_interval=1.0,damage_groups={fleshy=4}}, "default:bronze_pick", nil)
+ self.target:punch(self.object, nil, {full_punch_interval=1.0,damage_groups={fleshy=4}}, nil)
end
end,
@@ -72,7 +72,7 @@ on_step= function(self, dtime)
self.timer=0
if self.target==nil or (not self.target:get_attach()) then
self.object:set_hp(0)
- self.object:punch(self.object, {full_punch_interval=1.0,damage_groups={fleshy=4}}, "default:bronze_pick", nil)
+ self.object:punch(self.object, nil, {full_punch_interval=1.0,damage_groups={fleshy=4}}, nil)
if self.sound then minetest.sound_stop(self.sound) end
end
if self.player then
@@ -152,7 +152,7 @@ on_step= function(self, dtime)
if self.target==nil or (not self.target:get_attach()) then
self.object:set_hp(0)
- self.object:punch(self.object, {full_punch_interval=1.0,damage_groups={fleshy=4}}, "default:bronze_pick", nil)
+ self.object:punch(self.object, nil, {full_punch_interval=1.0,damage_groups={fleshy=4}}, nil)
return self
end
return self
diff --git a/init.lua b/init.lua
index 7b33acd..9645086 100644
--- a/init.lua
+++ b/init.lua
@@ -58,7 +58,7 @@ function portal_delete(name,n) -- using set_hp & :punch instand of :remove ... n
end
portalgun_portal[name].portal1_active=false
portalgun_portal[name].portal1:set_hp(0)
- portalgun_portal[name].portal1:punch(portalgun_portal[name].portal1, {full_punch_interval=1.0,damage_groups={fleshy=9000}}, "default:bronze_pick", nil)
+ portalgun_portal[name].portal1:punch(portalgun_portal[name].portal1, nil, {full_punch_interval=1.0,damage_groups={fleshy=9000}}, nil)
end
if (n==2 or n==0) and portalgun_portal[name].portal2~=nil then
if n==0 then
@@ -67,7 +67,7 @@ function portal_delete(name,n) -- using set_hp & :punch instand of :remove ... n
end
portalgun_portal[name].portal2_active=false
portalgun_portal[name].portal2:set_hp(0)
- portalgun_portal[name].portal2:punch(portalgun_portal[name].portal2, {full_punch_interval=1.0,damage_groups={fleshy=9000}}, "default:bronze_pick", nil)
+ portalgun_portal[name].portal2:punch(portalgun_portal[name].portal2, nil, {full_punch_interval=1.0,damage_groups={fleshy=9000}}, nil)
end
if n==0 then portalgun_portal[name]=nil end
end
seems to work, thanks :)
with patch from post 2 applied: next crash
2021-05-20 16:06:55: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'portalgun' in callback item_OnUse(): /opt/minetest/bin/../mods/portalgun/init.lua:70: attempt to index field 'portal1' (a nil value) 2021-05-20 16:06:55: ERROR[Main]: stack traceback: 2021-05-20 16:06:55: ERROR[Main]: /opt/minetest/bin/../mods/portalgun/init.lua:70: in function 'portal_delete' 2021-05-20 16:06:55: ERROR[Main]: /opt/minetest/bin/../mods/portalgun/init.lua:689: in function 'portalgun_setportal' 2021-05-20 16:06:55: ERROR[Main]: /opt/minetest/bin/../mods/portalgun/init.lua:596: in function 'portalgun_onuse' 2021-05-20 16:06:55: ERROR[Main]: /opt/minetest/bin/../mods/portalgun/init.lua:391: in function </opt/minetest/bin/../mods/portalgun/init.lua:390>
My son loves this mod and we've got it sort of working on MT 5.7 / MTG. Portals work as expected most of the time, but once in a while it crashes minetestserver. Wanted to check if anyone is still running this fantastic mod ?
steps to reproduce:
2021-04-17 18:18:32: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'portalgun' in callback item_OnUse(): /opt/minetest/bin/../mods/portalgun/init.lua:70: bad argument #2 to 'punch' (number expected, got table) 2021-04-17 18:18:32: ERROR[Main]: stack traceback: 2021-04-17 18:18:32: ERROR[Main]: [C]: in function 'punch' 2021-04-17 18:18:32: ERROR[Main]: /opt/minetest/bin/../mods/portalgun/init.lua:70: in function 'portal_delete' 2021-04-17 18:18:32: ERROR[Main]: /opt/minetest/bin/../mods/portalgun/init.lua:689: in function 'portalgun_setportal' 2021-04-17 18:18:32: ERROR[Main]: /opt/minetest/bin/../mods/portalgun/init.lua:590: in function 'portalgun_onuse' 2021-04-17 18:18:32: ERROR[Main]: /opt/minetest/bin/../mods/portalgun/init.lua:391: in function </opt/minetest/bin/../mods/portalgun/init.lua:390>