daviddoesminetest / rangedweapons

a mod that adds ranged weapons to minetest.
6 stars 4 forks source link

Server crash on firing gun #2

Open Beanzilla opened 3 years ago

Beanzilla commented 3 years ago

I have a rangedweapons:beretta loaded with it's ammo type.

I shoot, server crashes and I get this dumped into the server logs:

2021-03-18 17:38:05: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'rangedweapons' in callback luaentity_Step(): /minetest/bin/../mods/rangedweapons/ammo.lua:112: bad argument #2 to 'random' (interval is empty)
2021-03-18 17:38:05: ERROR[Main]: stack traceback:
2021-03-18 17:38:05: ERROR[Main]:   [C]: in function 'random'
2021-03-18 17:38:05: ERROR[Main]:   /minetest/bin/../mods/rangedweapons/ammo.lua:112: in function </minetest/bin/../mods/rangedweapons/ammo.lua:31>

Version of mod: 0.4 Minetest-server version: 5.4.0 Minetest-client version: 5.4.0

daviddoesminetest commented 3 years ago

what did you shoot?

daviddoesminetest commented 3 years ago

Aight... Absolute 0 clue why would it crash, as there's only a math.random() function in that line and it has it's own values that should always be present and not influenced by Anything else.

Beanzilla commented 3 years ago

I shot air... was aiming at nothing.

Beanzilla commented 3 years ago

Perhaps this will add more to the debug of what is going on...

2021-04-02 21:57:31: WARNING[Server]: Assignment to undeclared global "GunCaps" inside a function at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:59.
2021-04-02 21:57:31: WARNING[Server]: Assignment to undeclared global "gun_unload_sound" inside a function at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:62.
2021-04-02 21:57:31: WARNING[Server]: Deprecated call to get_look_yaw, use get_look_horizontal instead (at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:143)
2021-04-02 21:57:31: WARNING[Server]: Assignment to undeclared global "gunMeta" inside a function at ...illa/.minetest/mods/rangedweapons/cooldown_stuff.lua:93.
2021-04-02 21:57:36: WARNING[Server]: Call to deprecated function 'getpos', please use 'get_pos' at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:352
2021-04-02 21:57:36: WARNING[Server]: Assignment to undeclared global "AmmoCaps" inside a function at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:391.
2021-04-02 21:57:36: WARNING[Server]: Assignment to undeclared global "gun_projectiles" inside a function at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:443.
2021-04-02 21:57:36: WARNING[Server]: Assignment to undeclared global "skill_value" inside a function at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:527.
2021-04-02 21:57:36: WARNING[Server]: Deprecated call to get_look_yaw, use get_look_horizontal instead (at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:660)
2021-04-02 21:57:36: WARNING[Server]: Call to deprecated function 'setvelocity', please use 'set_velocity' at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:669
2021-04-02 21:57:36: WARNING[Server]: Call to deprecated function 'setacceleration', please use 'set_acceleration' at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:670
2021-04-02 21:57:36: WARNING[Server]: Assignment to undeclared global "projectiles" inside a function at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:690.
2021-04-02 21:57:36: WARNING[Server]: Assignment to undeclared global "rndacc" inside a function at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:692.
2021-04-02 21:57:36: WARNING[Server]: Assignment to undeclared global "acc" inside a function at ...home/beanzilla/.minetest/mods/rangedweapons/init.lua:725.
2021-04-02 21:57:37: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'rangedweapons' in callback luaentity_Step(): ...home/beanzilla/.minetest/mods/rangedweapons/ammo.lua:112: bad argument #2 to 'random' (interval is empty)
2021-04-02 21:57:37: ERROR[Main]: stack traceback:
2021-04-02 21:57:37: ERROR[Main]:   [C]: in function 'random'
2021-04-02 21:57:37: ERROR[Main]:   ...home/beanzilla/.minetest/mods/rangedweapons/ammo.lua:112: in function <...home/beanzilla/.minetest/mods/rangedweapons/ammo.lua:31>

A. This was using the mod in a local world (client instead of the original which was a server) B. I used a rangedweapons:mp5 with the 10mm auto rounds. C. The client didn't crash until it hit something. (Or to be precise I shoot, get a puff of smoke, then maybe 1/2 a second later... crash)

I see a lot of warnings about using deprecated API calls... maybe that is really the issue... I might go ahead and see if I can't update some of these calls for you... (Though I also will break the .zips into their own seperated branches with each "version" applied manually.)

(I will add another comment with a link to my github repo for the other branches... and I might also submit a PR so you can also get your repo updated easily)

Beanzilla commented 3 years ago

My repo Beanzilla/rangedweapons-1

Each version as a release:

Version 0.1

Version 0.2

Version 0.3

Version 0.4 (Latest)