[Mod] Villages for Minetest [mg_villages]

Sokomine
Member
Posts: 4127
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

Big update with quite a lot of changes. Plaese update handle_schematics, mg_villages, mob_world_interaction, cottages and the diffrent village_* mods in order to get it running.

In short:
Click on "Who lives here" on a plotmarker and have a look at the new formspecs and options.
Go to a bed or to a place where you'd expect a worker to stand and see the infotext.

New/changed:
* pathfinding (bed/workplace to front door) is done when a blueprint of a building is loaded and mob_world_interaction is installed
* these paths are all cached for faster access at startup
* coordinats of beds, places next to beds for standing, doors, workplaces and front doors can be calculated from the positions found in the building's blueprint
* code cleanup: nodes.lua and protection.lua contain only what belongs there; formspec handling has been put into other files
* beds are no longer determined when actually placing the blueprint; the bed positions are determined at init time and later calculated using offsets and transformations; may lead to some incompatibility with older mob data that got beds assinged in a diffrent order
* chateau: now contains the landlord and his family plus servants and housemaids instead of just one servant family
* castle: may contain multiple soldiers (found i.e. in village_towntest)
* villages of type ruins ought to contain no inhabitants (they have neither beds nor workplaces)
* additional water sources below fields where removed. Fields simulate soil. This leads to some speedup in the game. If you dig a soil node, place the dirt again, hoe it and it doesn't turn into wet soil - then you know that the villagers are more capable farmers than you :-)
* water used in buildings (i.e. fountains) got turned into river water (less salty & tastes better)
* added workplace markers; they indicate where the mob working at this building ought to stand most of the time
* paths from workplaces to front doors are calculated and stored
* several buildings have been updated; if you encounter any inconsistency, please report!
* added a list of inhabitants in a formspec behind the "Who lives here" button on the plotmarker formspec
* that formspec also shows if there's no one living but just working there, or if the plot is owned by someone (a mob - not a player)
* a list of entrances (front doors or front gates) is shown
* /villages command now shows how lage the population is (errornull had that idea)
* added formspec that lists all plots of a village
* added back, next and prev(ious) buttons to the villages, plots, inhabitants and mob data formspecs
* added "Visit" button for plots (useful if you got there through clicking through the plotlist)
* mapgen got slightly smarter when recognizing possible ground types; i.e. plantlike drawtypes no longer ought to be mistaken for possible (biome) grounds
* fixed bug where mobs got the wrong job assigned (i.e. works at church but is a furnituremaker)
* grandparents are now old enough to actually be the parents of their child (the male worker)
* mob data is no longer assigned in part_of_village_spawned; as it is based on data gathered from the original blueprint of the building, all mobs and jobs can be assigned at once once the village has been created
* introduced version number for mob data (= .beds and .worker)
* added /village_mob_repopulate <village_nr> command for creating new inhabitants (will only affect mob data); needs protection_bypass priv and will delete all stored mob data for the village and create new data (useful for debugging)
* beds (head+foot part) get infotext about who sleeps in that bed
* workplace markers get likewise info in their infotext

Known bugs:
1. Updating lighting may lead to crashes. Just load the world anew until the crashes disappear. The only real workaround would be to have strange shadows and utter darkness in large parts of the villages.
2. Transforming the coordinates for bed positions etc. may in some cases go wrong. The bug is investigated. If you have any further information please report it.

Regarding building types (important for the villagers mod):
* added new type "stable". "horestable" existed already, but this is more general
* type "park" and "lamp" used where appropriate instead of "deco"; deco will remain as a general type for decoration and might in the future be used for statues, art and the like
* type "shed" is a very general type used for anything that's not a specific workplace; it may be storage, it may be partial workplace, but in general will not have a workplace marker
* mobs that work in a building where they can't live (no beds) will prefer "hut" as homes; if no more huts are left, they'll use any other building with beds except "farm_full"; "farm_full" is a last resort as the farmer there usually doesn't have time for a second job
A list of my mods can be found here.

Sokomine
Member
Posts: 4127
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

Two more quick changes:
* the chateau now gets fancy beds from the beds mod if cottages is not installed
* the plotmarkers are now burried one node below the ground; all information can be obtained from the plotmarker formspec (update handle_schematics for this change to take effect)

Next on agenda:
* check if any actual mob is loaded
* if so, show the mob's position and allow to teleport to it
A list of my mods can be found here.

ErrorNull
Member
Posts: 222
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

wow that is a huge update. very awesome! the plotmarker formspec provides so much info now.. especially about the villagers. it's also very convenient for me to test and jump around different villages by using the /villages command to click into the inhabitant info and just click on the 'visit' button. i'm also glad to see all the columns line up nicely now. There will be lots of pathfinding data and positions that your villages now contain that i can take advantage of. thanks for all that.

After a few adjustments with my villagers mod, everything seems good. EXCEPT that my villagers felt some momentary pain when you moved the mob spawner deeper. LOL. I updated my LBM spawn code to use the village height to spawn instead of the mob spawner height. :p
Attachments
villages list.png
plotmarker info.png
all-the-horrer.png
My Villagers Mod: [villagers]

KCoombes
Member
Posts: 412
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt
Location: SW Florida, USA

Re: [Mod] Villages for Minetest [mg_villages]

Now that's funny XD

Pulled fresh copies of the mods Sokomine has updated and plan to test all night long :P

Member
Posts: 112
Joined: Thu Jul 20, 2017 07:58

Re: [Mod] Villages for Minetest [mg_villages]

Hi, just dropping an idea : Why not make some kind of underground village ? With a part that sticks up on top of the ground so you can at least spot it when walking in the world... or a very specific height so you can be almost sure to find it when mining at that heigth.

hajo
Member
Posts: 605
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

Re: [Mod] Villages for Minetest [mg_villages]

Lord_Vlad wrote:Why not make some kind of underground village ?
Because it is hard to automatically place buildings in random cave-terrain ?

Member
Posts: 112
Joined: Thu Jul 20, 2017 07:58

Re: [Mod] Villages for Minetest [mg_villages]

hajo wrote:
Lord_Vlad wrote:Why not make some kind of underground village ?
Because it is hard to automatically place buildings in random cave-terrain ?
Then you can force like, a box around the village to make sure it's not connected to any caves and such ? I mean, I remember a minecraft mod that did it well in a sugar-like dimension... It must be possible. All that's actually left to see is, if Sokomine would enjoy doing it.

Sokomine
Member
Posts: 4127
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

Lord_Vlad wrote: Hi, just dropping an idea : Why not make some kind of underground village ? With a part that sticks up on top of the ground so you can at least spot it when walking in the world... or a very specific height so you can be almost sure to find it when mining at that heigth.
Hmm. The sandmobs got the sandcity village type (not that there are any sandmobs living there yet...). The dirt mobs might love a very simple underground village made mostly of dirt. Maybe that's doable. It'd probably not be what you want though. Building a village inside a cave is a diffrent matter. Caves tend to have anything but flat ground. Even players building there may have trouble placing something really nice-looking on the scale of a village. The houses would need to be placed at diffrent heights and connected somehow. Mobs would be in danger of falling off the road.
A list of my mods can be found here.

Member
Posts: 112
Joined: Thu Jul 20, 2017 07:58

Re: [Mod] Villages for Minetest [mg_villages]

Sokomine wrote:
Lord_Vlad wrote: Hi, just dropping an idea : Why not make some kind of underground village ? With a part that sticks up on top of the ground so you can at least spot it when walking in the world... or a very specific height so you can be almost sure to find it when mining at that heigth.
Hmm. The sandmobs got the sandcity village type (not that there are any sandmobs living there yet...). The dirt mobs might love a very simple underground village made mostly of dirt. Maybe that's doable. It'd probably not be what you want though. Building a village inside a cave is a diffrent matter. Caves tend to have anything but flat ground. Even players building there may have trouble placing something really nice-looking on the scale of a village. The houses would need to be placed at diffrent heights and connected somehow. Mobs would be in danger of falling off the road.

Rather than creating it in a cave, I'd rather see it as an underground box, and everything inside that box is the village. So like, you have walls on every side and a ceiling, so nothing can happen to the village, no water or lava, no mobs in or out (until a player comes by). Flat ground would be the floor of the box. If you don't have one, you just make it. Except that, I'd see a very normal village, with different types of house, just made out of materials you'd find in a cave. Also, fields would be different or absent, things like that... I can make one in a map and send it to you if you don't get what I mean.

Sokomine
Member
Posts: 4127
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

Lord_Vlad wrote: Rather than creating it in a cave, I'd rather see it as an underground box, and everything inside that box is the village. So like, you have walls on every side and a ceiling, so nothing can happen to the village, no water or lava, no mobs in or out (until a player comes by). Flat ground would be the floor of the box. If you don't have one, you just make it. Except that, I'd see a very normal village, with different types of house, just made out of materials you'd find in a cave. Also, fields would be different or absent, things like that... I can make one in a map and send it to you if you don't get what I mean.
Wouldn't that look utterly strange? A normal village inside a square box? I'm afraid that'd just utterly break any sense of wonder and destroy any immersion. People don't build the same way in a stony environment than they would on flat land. Of course, technically, it will be a village in a square box anyway. That's how mapgen works. Just...not too square hopefully. And I think the bottom of the cave could be filled with lava or with a lake (with some glowing materials from below?). It'd be very helpful if you could build what you have in mind and send me the schematic (schematics are smaller than full maps). Exchanging materials is no problem. Maybe there could be some pre-built caves that'd just be randomly spawned. I don't see a way yet to automaticly generate something that looks acceptable. I'm not even sure if I can manually fill a cave with a village that looks good. I did try to some degree on Oldcoders Lord of the Test server, but that's something where most of the village is digged into stone.
A list of my mods can be found here.

Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Villages for Minetest [mg_villages]

would you consider adding underground "dwarven" villages? i think that would really be neat, and loot in chests there could have more valuable items like ores since a dwarven village would be hard to find
Hey, what can i say? I'm the bad guy.

ErrorNull
Member
Posts: 222
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

hi sokomine, would you mind listing all the possible job titles that your inhabitants can have? unless you have a table that already contains all?

also is there a way to disable spawning in a village and just have player spawn in the wilderness again? thanks!
My Villagers Mod: [villagers]

hajo
Member
Posts: 605
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

Re: [Mod] Villages for Minetest [mg_villages]

Stix wrote:would you consider adding underground "dwarven" villages?
Well, "considering" is cheap, coming up with details is a lot of work...

Do you have concrete ideas, eg. about layout of village, houses, floorplans,
inhabitants & jobs, special buildings, textures etc. ?

Sokomine
Member
Posts: 4127
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

ErrorNull wrote: hi sokomine, would you mind listing all the possible job titles that your inhabitants can have? unless you have a table that already contains all?
It's a bit hidden inside inhabitants.lua: The table mg_villages.inhabitants.jobs_in_buildings[ building_type ] = {"job1","job2","job3",...} contains the jobs a particular building may offer. It's usually one entry. Some types - i.e. the forge - have alternate jobs (blacksmith, coppersmith, goldsmith, tinsmith). Jobs may be listed multiple times in the table for each building_type in order to increase the chance of that job beeing choosen, while others offered are more rare (i.e. we need far more blacksmiths than tinsmiths). Types castle (=all inhabitants work as soldiers in the castle), chateau (=main worker landlord; has servants and housemaids) and hotel/inn (=some are "working" as guests) diverge from the usual 1-worker-per-building-with-worker-scheme. Others may be added in the future.
ErrorNull wrote: also is there a way to disable spawning in a village and just have player spawn in the wilderness again? thanks!
You can set a static_spawnpoint in your minetest.conf. This is intended for servers. I've now made mg_villages.spawnplayer(player) a function that is no longer local. That way you can overwrite it if you want.
hajo wrote: Well, "considering" is cheap, coming up with details is a lot of work...
That's right :-)
hajo wrote: Do you have concrete ideas, eg. about layout of village, houses, floorplans, inhabitants & jobs, special buildings, textures etc. ?
I guess the jobs would be mostly miners, blacksmiths, perhaps some shop owners, a tavern, .. That would probably be the smallest problem. What's needed are schematics that fit into the sourrounding. A cave is far more demanding in that regard than flat land.

My own ideas would be to create schematics including part of the cave wall, with tiny cobble huts (that's what the miners have in surplus...) stacked up at the side of the cave. A lake or lava lake at the bottom would be great for light. One of the buildings needs to be a shaft that leads back to the surface (I'm not convinced of caves without connection to the outside world). Thus, they probably ought not to be too deep down. Without that shaft visible on the outside, the vast majority of caves with villages would never be discovered.

Finding a large enough cave for first tests wasn't easy. And I'll have to generate those things myshelf for the villages...The next problem was lighting. That huge cave took too long to light manually. Had to make ores emit light in order to be able to actually see something. Now my underground looks a bit weired :-)

Consistent schematics for underground caves are welcome.
A list of my mods can be found here.

zorman2000
Member
Posts: 83
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Villages for Minetest [mg_villages]

Hi Sokomine!

First of all, thanks for all the changes and additions into mg_villages, they will be really helpful. I have some feedback to provide, that will help, I think, with the development of Advanced NPCs and other NPC mods:

Workplace nodes: These are great! But a few things that I can point/ask out:
• Please make them invisible: no texture, not pointable and walkable. This way, mods can find the node, but players won't have any idea.
• Please please add them into tiny_farm and full_farm buildings! All tiny farms have a field attached to it, and I would love to have farmer NPCs go into that plot and work on it. Maybe it can be placed just after the fence gate? Also, all full farms have stables, set them inside the stable.
• Could you please please add a few, random nodes of this into the random, infinite fields of wheat surrounding the villages? NPCs living in the village edges could also work these plots.
• Please add nodemeta information as to which building they belong, so that when I search for a workplace node and find one, I can figure out which NPC needs to work on it.
Village families and titles: I like a lot this feature, but it would be great if mods could override this. Advanced NPCs, first of all, doesn't uses all beds in the house: that would be a lot of NPCs actually and probably performance issues. Second, this is selecting automatically names and jobs. While the second one isn't that bad, NPC mods could want to provide their own names. And the job looks slightly wrong: I saw that in a "farm_tiny" a glassmaker lived. Well, looks like no one is attending the little plot? So here are my requests:
• Make functions that allow overriding the people living in a particular plot. Maybe add_npc(), remove_npc() could be a good API. The parameter could be a Lua table with {name="", age=0, job=""...} etc. Also, this method should assign a bed and let the caller know which bed was assigned to it.
• The automatic job assignment should take into account the building type. Farms ought to have farmers, huts can have glassmakers, but maybe if a hut is located beside a tavern, then the tavern owner lives there? This can be left to mods, but it is an idea.
Big thanks for all your hard work! If you add the features I requested for workplace markers, I will definitely use them (I for one need them) for Advanced NPC, as that is to me right now the biggest challenge: determining the work place of a NPC. Farmers specially, since tiny farms have attached plots, I would need to detect many nodes in specific conditions in order to guess a workplace.

Thanks!

Sokomine
Member
Posts: 4127
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

zorman2000 wrote: Please make them invisible: no texture, not pointable and walkable. This way, mods can find the node, but players won't have any idea.
Making them invisible will probably be better in the long run. However, they need to be visible for players who want to edit buildings or add new ones with particular workplaces. My plan was to have one flat texture with two footprints, indicating that someone has been standing there for a long time.
zorman2000 wrote: Please please add them into tiny_farm and full_farm buildings! All tiny farms have a field attached to it, and I would love to have farmer NPCs go into that plot and work on it. Maybe it can be placed just after the fence gate? Also, all full farms have stables, set them inside the stable.
Workplace markers are intended as places where the mob is most commonly found. On farms I imagine them running around most of the time - checking this place, removing some weed, planting something, cleaning the stable, checking and fixing small things here and there. Adding workplace markers to intresting places like you mentionned might still be helpful. The furnace could also be a place of particular intrest (especially at lunch time). What's probably needed more are places for cattle. If any mob mods are installed, chicken ought to run around at daytime. Goats might also feel happy in the small stables. Or a cow now and then. Maybe it'll be sufficient for them to look for cottages:straw_ground, spawn there with a certain probability, store their position, and move there at night. Perhaps at least these special workplaces (garden, field, stable, furnace) can be obtained by analyzing the building. That'd be less work than editing them all and placing the workplace markers. I'll see what can be done there.
zorman2000 wrote: Could you please please add a few, random nodes of this into the random, infinite fields of wheat surrounding the villages? NPCs living in the village edges could also work these plots.
I'd love to see especially the farmers working there. Does it really help them to get a workplace marker there? The farmer might have to move around a lot in order to check and maintain his fields. I can place those markers, but I'm not sure if it wouldn't help more if the farmer just checks for plants he cares for (wheat or cotton).
zorman2000 wrote: Please add nodemeta information as to which building they belong, so that when I search for a workplace node and find one, I can figure out which NPC needs to work on it.
They already store plot_nr, workplace_nr, lives_at and bed_nr in their metadata. You can also calculate where the workplaces are if you take the building data. How that can be done can be seen in inhabitants.lua, right before the markers are placed. Paths from workplace markers to a place in front of the house are precalculated and can be accessed.
zorman2000 wrote: Advanced NPCs, first of all, doesn't uses all beds in the house: that would be a lot of NPCs actually and probably performance issues.
That's right, there can be an unhandy number of inhabitants soon. And no bed will be left empty. Which is also a bit unrealistic. Maybe some just aren't there, that is: don't spawn even though there's (theoretical) data for them? The mobs could be visiting family members in nearby villages (all those guests in the inns need to come from somewhere after all), deceased, not born yet (room for more babies), married and moved out, ..Just store in the bed's data structure that the mob doesn't exist. If its beds infotext looks strange, then that could be removed as well once the mobs are actually spawned.

The function mg_villages.inhabitants.assign_mobs( village, village_id, force_repopulate ) does create all the data structure. You can overlay it with your own function that calls the original function first and then changes the data as you like.
zorman2000 wrote: NPC mods could want to provide their own names.
mg_villages.inhabitants.names_male and mg_villages.inhabitants.names_female are the namelists beeing used. They can be changed by other mods. If you overlay mg_villages.inhabitants.assign_mobs, you can even set a per-village-namelist :-)
zorman2000 wrote: I saw that in a "farm_tiny" a glassmaker lived.
Admittedly that is a bit..unfitting. Same as potatos or tomatos beeing grown by medieval farmers. Glassmakers needed a lot of wood and just didn't live the same way as i.e. a carpenter did. In general, farm_tiny farms are not the same as farm_full. Only those farmers on farm_full have large enough fields to be able to live from what they grow. Those on farm_tiny just don't have enough land and need to take a second job. If you force them to live off their tiny land, they and their families will starve! They may have a small garden for vegtables, a bit of cattle (chicken, sheep, goats, cows - but no horses) - but they can't live from that alone. They have to work on the larger farms and/or take on another job, same as their historic counterparts had to.
zorman2000 wrote: Well, looks like no one is attending the little plot?
Originally, the wives of the farm_tiny house owners where supposed to work in the garden and grow vegtables. The small working garden is definitely a place where the inhabitants of the farm_tiny ought to be found now and then. Else the weed will overgrow their food.
zorman2000 wrote: Make functions that allow overriding the people living in a particular plot. Maybe add_npc(), remove_npc() could be a good API. The parameter could be a Lua table with {name="", age=0, job=""...} etc. Also, this method should assign a bed and let the caller know which bed was assigned to it.
Problem there is that beds can only be assigned if they're there. Not much point in assigning more beds than exist in a house. It's easier to just discard or modify unwanted inhabitants. The function

Code: Select all

mg_villages.inhabitants.get_mob_data( village_id, plot_nr, bed_nr )
can be used to get data about a particular inhabitant. They're defined by the village they live in, the plot and the bed number. The data structure storing all that data is indeed a bit complicated. But it can be accessed and changed by other mods. After all it's only a suggestion as to how information about inhabitants might be stored. Functions to get the coordinates and the workplace marker of a particular inhabitant (as definied by village, plot and bed nr) could be added.
zorman2000 wrote: The automatic job assignment should take into account the building type. Farms ought to have farmers, huts can have glassmakers, but maybe if a hut is located beside a tavern, then the tavern owner lives there? This can be left to mods, but it is an idea.
That would be very nice, yes. For now all the algorithm can manage is to try to get at least some house for the workers to live in. Choosing the closest one might be a good idea. I'll have to see if I can include it.

As to the workplace markers...you're not supposed to search for them with find_node. Those positions can be calculated. Which is necessary in order to make use of the pathfinding. It's all a bit hidden right now and needs a better api I'm afraid.
A list of my mods can be found here.

Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Villages for Minetest [mg_villages]

Stix wrote:would you consider adding underground "dwarven" villages? i think that would really be neat, and loot in chests there could have more valuable items like ores since a dwarven village would be hard to find
would you add this if i made the buildings? i dont know how to use WE so i couldnt give you WE files but i could pm you the world_file with the buildings once im done.
Hey, what can i say? I'm the bad guy.

Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Villages for Minetest [mg_villages]

Stix wrote:
Stix wrote:would you consider adding underground "dwarven" villages? i think that would really be neat, and loot in chests there could have more valuable items like ores since a dwarven village would be hard to find
would you add this if i made the buildings? i dont know how to use WE so i couldnt give you WE files but i could pm you the world_file with the buildings once im done.
Hey, what can i say? I'm the bad guy.

maikerumine
Member
Posts: 1387
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: [Mod] Villages for Minetest [mg_villages]

Soko!

I have a problem on a fresh map:

Code: Select all

2017-12-05 20:07:42: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback LuaABM::trigger(): D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:3: bad argument #1 to 'pairs' (table expected, got nil)
2017-12-05 20:07:42: ERROR[Main]: stack traceback:
2017-12-05 20:07:42: ERROR[Main]: 	[C]: in function 'pairs'
2017-12-05 20:07:42: ERROR[Main]: 	D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:3: in function 'get_town_id_at_pos'
2017-12-05 20:07:42: ERROR[Main]: 	D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:82: in function 'old_is_protected'
2017-12-05 20:07:42: ERROR[Main]: 	D:\ESM2\bin\..\games\ESM5\mods\basic_machines/protect.lua:12: in function 'is_protected'
2017-12-05 20:07:42: ERROR[Main]: 	...n\..\games\ESM5\mods\mobs_esm5_mobpack\mobs_redo/api.lua:2767: in function <...n\..\games\ESM5\mods\mobs_esm5_mobpack\mobs_redo/api.lua:2716>

then

2017-12-05 21:30:04: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback LuaABM::trigger(): D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:3: bad argument #1 to 'pairs' (table expected, got nil)
2017-12-05 21:30:04: ERROR[Main]: stack traceback:
2017-12-05 21:30:04: ERROR[Main]: 	[C]: in function 'pairs'
2017-12-05 21:30:04: ERROR[Main]: 	D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:3: in function 'get_town_id_at_pos'
2017-12-05 21:30:04: ERROR[Main]: 	D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:82: in function 'old_is_protected'
2017-12-05 21:30:04: ERROR[Main]: 	D:\ESM2\bin\..\games\ESM5\mods\basic_machines/protect.lua:12: in function 'is_protected'
2017-12-05 21:30:04: ERROR[Main]: 	...n\..\games\ESM5\mods\mobs_esm5_mobpack\mobs_redo/api.lua:2767: in function <...n\..\games\ESM5\mods\mobs_esm5_mobpack\mobs_redo/api.lua:2716>

Basic machines is trying to violate it seems, is there a way to make a check like: if not player then end?

EDIT: It turns out the mobs are checking to spawn in protected area, but the villages are bugged when checking for protection in the certain village.

I LOVE^99 your villages and do NOT want to remove them, they are the best mod ever for MT, hands down.

Extreme Survival Minetest-->viewtopic.php?f=10&t=12959

maikerumine
Member
Posts: 1387
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: [Mod] Villages for Minetest [mg_villages]

I 'fixed' the problem by setting mobs to spawn anywhere including protected areas.
if set to 1 then mobs will not spawn in protected areas (default is 0)
Extreme Survival Minetest-->viewtopic.php?f=10&t=12959

maikerumine
Member
Posts: 1387
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: [Mod] Villages for Minetest [mg_villages]

NOPE!

Still broken. Now on dig.

Code: Select all

2017-12-06 13:01:24: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback node_on_dig(): D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:3: bad argument #1 to 'pairs' (table expected, got nil)
2017-12-06 13:01:24: ERROR[Main]: stack traceback:
2017-12-06 13:01:24: ERROR[Main]: 	[C]: in function 'pairs'
2017-12-06 13:01:24: ERROR[Main]: 	D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:3: in function 'get_town_id_at_pos'
2017-12-06 13:01:24: ERROR[Main]: 	D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:82: in function 'old_is_protected'
2017-12-06 13:01:24: ERROR[Main]: 	D:\ESM2\bin\..\games\ESM5\mods\basic_machines/protect.lua:12: in function 'is_protected'
2017-12-06 13:01:24: ERROR[Main]: 	D:\ESM2\bin\..\builtin\game\item.lua:522: in function <D:\ESM2\bin\..\builtin\game\item.lua:512>
Extreme Survival Minetest-->viewtopic.php?f=10&t=12959

Sokomine
Member
Posts: 4127
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

Stix wrote: would you add this if i made the buildings? i dont know how to use WE so i couldnt give you WE files but i could pm you the world_file with the buildings once im done.
A whole world would be quite large to download. You can use the build_chest from my handle_schematics mod to save your buildings. That's easy and will create them with the additional information of orientation and depth of the building below ground. If you're using mg_villages, handle_schematics will already be there. Just type "/giveme handle_schematics:build 2", place the building spawner somewhere, right-click the chest and follow the instructions in the formspec.
maikerumine wrote: I have a problem on a fresh map:
Code: Select all
2017-12-05 20:07:42: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback LuaABM::trigger(): D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:3: bad argument #1 to 'pairs' (table expected, got nil)
Sounds as if mg_villages.all_villages got set to null. Did your WORLDNAME/mg_all_villages.data file get corrupted? It's no problem if it's not there at all. But if it contains no or wrong data it will cause an error like this one.
maikerumine wrote: I 'fixed' the problem by setting mobs to spawn anywhere including protected areas.
if set to 1 then mobs will not spawn in protected areas (default is 0)
IIRC that setting in the mobs mod is there to prevent hostile mobs from spawning in your home. DMs are not the best lodgers. You have to renovate too often with them beeing at home. Perhaps the mobs mod needs to differentiate between free space, generated villages and places protected by players. You can check for "inside village" by calling mg_villages.get_town_id_at_pos( pos )
A list of my mods can be found here.

maikerumine
Member
Posts: 1387
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: [Mod] Villages for Minetest [mg_villages]

Sokomine wrote:
maikerumine wrote: I have a problem on a fresh map:
Code: Select all
2017-12-05 20:07:42: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback LuaABM::trigger(): D:\ESM2\bin\..\games\ESM5\mods\mg_villages/protection.lua:3: bad argument #1 to 'pairs' (table expected, got nil)
Sounds as if mg_villages.all_villages got set to null. Did your WORLDNAME/mg_all_villages.data file get corrupted? It's no problem if it's not there at all. But if it contains no or wrong data it will cause an error like this one.

BINGO! Somehow the mg_all_villages.data file got corrupted, mpost likely on a crash whilst being written to. I looked into this and will try to 'hack' the id go get it working again, but with my experience messing with this file is no good, and if I were to delete it, then right clicking on the mob spawn node caused it to crash. :/ i cannot win. lol
maikerumine wrote: I 'fixed' the problem by setting mobs to spawn anywhere including protected areas.
if set to 1 then mobs will not spawn in protected areas (default is 0)
IIRC that setting in the mobs mod is there to prevent hostile mobs from spawning in your home. DMs are not the best lodgers. You have to renovate too often with them beeing at home.

HA! TOO FUNNY!!!

Perhaps the mobs mod needs to differentiate between free space, generated villages and places protected by players. You can check for "inside village" by calling mg_villages.get_town_id_at_pos( pos )
Extreme Survival Minetest-->viewtopic.php?f=10&t=12959

Sokomine
Member
Posts: 4127
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

maikaumine wrote: BINGO! Somehow the mg_all_villages.data file got corrupted, mpost likely on a crash whilst being written to. I looked into this and will try to 'hack' the id go get it working again, but with my experience messing with this file is no good, and if I were to delete it, then right clicking on the mob spawn node caused it to crash. :/ i cannot win. lol
If it's a new world, starting it anew might be best. Else try to use a backup of your mg_all_villages.data file. Letting the game recreate the data file might also work to some degree. Not all random values are 100% procecural.
A list of my mods can be found here.

AndroBuilder
Member
Posts: 51
Joined: Mon Dec 04, 2017 11:34
In-game: AndroBuilder

Re: [Mod] Villages for Minetest [mg_villages]

After a few adjustments with my villagers mod, everything seems good. EXCEPT that my villagers felt some momentary pain when you moved the mob spawner deeper. LOL. I updated my LBM spawn code to use the village height to spawn instead of the mob spawner height. :p
[/quote]

Same Error still existing? How can it be fixed?

Who is online

Users browsing this forum: MisterE and 4 guests