Skip to content

Commit

Permalink
add signs_lib hack
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Sep 24, 2020
1 parent e0cd95f commit 5d0c826
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions hacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@ if minetest.get_modpath("digistuff") and minetest.registered_nodes["digistuff:ni
}
})
end

-- override signs_lib's static_save property
-- false causes it to stay loaded over the server lifetime (*all* visited signs)
-- related: https://github.com/pandorabox-io/pandorabox.io/issues/544
if minetest.get_modpath("signs_lib") then
local def = minetest.registered_entities["signs_lib:text"]
assert(def)
def.static_save = true
end
5 changes: 3 additions & 2 deletions mod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ advtrains_platform,
prefab,
vacuum,
maptools,
bamboo
digistuff
bamboo,
digistuff,
signs_lib
"""

5 comments on commit 5d0c826

@OgelGames
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that explains the huge amount of entities 😲 I wonder if vendor entities are the same, because those and sign entities are the first things I see when areas are loading in...

@BuckarooBanzay
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fancy_vend actually does it properly: https://github.com/pandorabox-io/fancy_vend/blob/master/display_item.lua#L4 no static_save = false there

@OgelGames
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it's true by default, that makes sense.

@OgelGames
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... Looking into this, it seems like the behavior of static_save is not what is described in the documentation, nor is it what was intended...

static_save = true,
-- If false, never save this object statically. It will simply be
-- deleted when the block gets unloaded.
-- The get_staticdata() callback is never called then.
-- Defaults to 'true'.

https://forum.minetest.net/viewtopic.php?f=6&t=24566
minetest/minetest#5112

Also, there are a number of other entities that set static_save to false, including advtrains wagons, and mobs_redo monsters:

https://github.com/minetest-mirrors/advtrains/blob/1a743c2dd67df10e4e15191b2aeb8532158b28ad/advtrains/wagons.lua#L52
https://github.com/minetest-mirrors/mobs_redo/blob/f14050ad3cf52f1168d7011d4ad5fa28bae41b77/api.lua#L3179

@BuckarooBanzay
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.