theFox6 / working_villages

A mod for minetest that adds villagers performing work
https://content.minetest.net/packages/theFox/working_villages/
MIT License
13 stars 10 forks source link

Not understanding error code #59

Open Alatarius opened 10 months ago

Alatarius commented 10 months ago

Describe the bug Not sure if it's a bug or not

I often get this error pop up in my chat area when WV is active:

ERROR[Server]: [working_villages] error in job_thread D:\Games\Minetest\bin..\mods\leads/internal.lua:40: attempt to call method 'get_player_control' (a nil value): stack traceback: D:\Games\Minetest\bin..\mods\leads/internal.lua: in function 'on_place' ...ods\working_villages\working_villagers/async_actions.lua:233: in function 'place' ...s\working_villages\working_villagers/jobs/woodcutter.lua:90: in function <...s\working_villages\working_villagers/jobs/woodcutter.lua:69>

I'm not sure if this is a bug or just a simple glitch. It doesn't stop the game or anything and the NPCs still do their job so I'm not understanding this one.

lmaddox commented 10 months ago

The leads mod is not written with any sort of fake player awareness. The line 40 in question:

if placer and not placer:get_player_control().sneak then

My pull request contains a patch for this, but I'm a n00b (ie this is my first pull request), and it contains unreasonably many bug patches and additional features, having touched nearly every single line in the codebase (not too much of a hyperbole).

In the meantime, you can go into your working_villagers/api.lua and add something like:

function working_villages.villager:get_player_control()
  return self.object:get_player_control()
end

which I copied from feed_buckets, which appears to have great fake_player support (I haven't actually used the mod, but it's code looks good).