Extex101 / motorbike

Motorbike mod for Minetest
Other
4 stars 8 forks source link

Crash when right click a motorbike #9

Closed Backlund closed 1 year ago

Backlund commented 2 years ago

Fedora 35 MineTest 5.5.0

2022-04-04 23:56:40: ACTION[Server]: singleplayer right-clicks object 2: LuaEntitySAO "motorbike:bike_green" at (211,11,-281) 2022-04-04 23:56:40: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'motorbike' in callback luaentity_run_simple_callback(): <.minetest/mods/motorbike/functions.lua:206: attempt to index a nil value 2022-04-04 23:56:40: ERROR[Main]: stack traceback: 2022-04-04 23:56:40: ERROR[Main]: <.minetest/mods/motorbike/functions.lua:206: in function 'attach' 2022-04-04 23:56:40: ERROR[Main]: <.minetest/mods/motorbike/init.lua:91: in function <.minetest/mods/motorbike/init.lua:89> 2022-04-04 23:56:40: ACTION[Server]: singleplayer leaves game. List of players:

It works on Android and Ubuntu, but not on my Fedora computer.

Extex101 commented 2 years ago

Have you got player_api installed in your game? Only newer Minetest Game versions that have player_api will work

Backlund commented 2 years ago

I installed all dependencies.

I commented out line 206 in functions.lua just for test, then I could ride the motorbike, but the player model became a green pixel model without animations when I got off.

Extex101 commented 2 years ago

Ok.. What did you look like before you got on? Just regular player model?

Backlund commented 2 years ago

Yes, just regular player model.

Extex101 commented 2 years ago

Ok well it's saying that player_api is a nil value. If you've got player_api installed as you say, I can't imagine what the problem could be.

Backlund commented 2 years ago

I think I fixed it. I noticed you already put the player properties in a local variable in that function. local props = player:get_properties() so i changed entity.info.model = player_api.get_animation(player).model to entity.info.model = props.mesh

No need to call the api to get the model again when you already had it in a local variable.

dragonfly-ai commented 2 years ago

I just commented out that line and that seemed to fix it. Much cooler mod when it doesn't crash the game. :)

Extex101 commented 2 years ago

Ah, it seems there have been some changes to player_api that I was not aware of. I'll take a look on Monday.

Backlund commented 2 years ago

I just commented out that line and that seemed to fix it. Much cooler mod when it doesn't crash the game. :)

What does your player model look like when you get off the bike?

dragonfly-ai commented 2 years ago

When it gets on the bike it assumes the correct pose, but armor disappears. When it gets off, the armor reappears. Yesterday after multiple rides, I switched to chase camera mode and saw the player model standing upright in the center of the bike, fully armored, but I haven't been able to reproduce today.

My kid is very excited to try your mod. Do you have plans to add a motocross track to world generator?

Extex101 commented 2 years ago

Oops my finger slipped

My kid is very excited to try your mod. Do you have plans to add a motocross track to world generator?

I'd recommended The Low Road. It's what I used when I was testing. You'd need to use it on a fresh world though.

Extex101 commented 2 years ago

Ok this whole mod is a mess, I have a load of refactoring to do. I just want you to know that I am working on it, though it may take some time.

dragonfly-ai commented 2 years ago

"I have a load of refactoring to do" not easy in Lua, so far as I know. Do you have to restart the game between every change? I haven't noticed any tooling for minetest mods. Is there anything that the community could do to help?

Thanks for building and maintaining the mod, though. My son and I dug out a neat underground race track with jumps and obstacles. We're having a lot of fun even with the semi-functional version.

Extex101 commented 2 years ago

I apologize I've been having some trouble recently and haven't been able to work on this.

dragonfly-ai commented 2 years ago

For what we're paying you, we can't complain. Well wishes for you, though, through any hard times.

If you could suggest a direction or general approach to the problem, I could try to pitch in with a pull request. LMK. :)

depascalis commented 1 year ago

How's it going with this issue? The kids are driving me nuts about this mod 😂

Extex101 commented 1 year ago

I did some more work on it recently, the code is rather only and messy so I started a rewrite. I haven't had much time recently so I haven't been able to do much.

All that's left to is reimplement the crafting recipes, the colours of bikes, reimplement skidding and fix braking. As well as some minor refactoring

Extex101 commented 1 year ago

Ok I've got it working, just need to re-implement the sound effect code and clean up a tiny bit then it's ready for release. Should be ready sometime later today

Extex101 commented 1 year ago

Finally done. #11 Merged, let me know if you've got any further issues. Sorry for the delay.