mckaygerhard 66952a26ac up to date to minenux gameid mods stable-4.0 version 4.0.17.4
* this cherry pícked from comit
  at 6861a44b60
* 74702c6ada
    * Carts: Replace old, deprecated function names mods/carts/cart_entity.lua
* Mushroom spread: make overridable and reduce spread
    * Move mushroom spread ABM action into a global and overridable function.
      but do not optimise spread code mods/flowers/init.lua
    * backported bcf98df5fac3eb59b02d9fdb066ab92c6228d787
    * Reduce spread range to reduce spread through walls.
* 657f7cee6e
  set art and game default, use minenux name and logo venenux
    * backported d5cc8c46f6
    * Flowers: More flowers
    * now we are into minenux so minetest4 stable-4.0 branch for engine
* 95e70da3a6
  Default: Increase the maximum level of the diamond axe to 3
    * backported https://github.com/minetest/minetest_game/pull/1854
    * This is the maximum level of the other diamond tools and makes the
      number of uses similar to them at mods/default/tools.lua
    * fixed https://github.com/minetest/minetest_game/issues/1456
      Diamond axe breaks earlier than mese axe
* 535204298e
    * Farming: Make cotton look like cotton, add crafted string item
    * Remove string -> cotton alias.
    * mods/farming/README.txt, mods/farming/init.lua,
      mods/farming/textures/farming_cotton.png, mods/farming/textures/farming_string.png
* 2b6de659cb
  Floatland biomes: Add ocean biomes to fix missing sandstone
    * Update biome lists for blob ores mods/default/mapgen.lua
    * backported bdc09d2313e5734400d2283549c4906d77a546d0
* e07ad71d11
  aa7f6cd060
  4a1fc02e82
  Make sapling, leaves and fence descriptions consistent
  Descriptions: Make capitalization consistent also in
  Improve node descriptions for most default items and nodes
    * backported https://github.com/minetest/minetest_game/pull/1834
    * addressed consistency issues previously discussed in:
    * https://github.com/minetest/minetest_game/issues/1473
      Bad item descriptions: Too generic descriptions among specific descriptions
      also cos has a strong tendency towards mixing generic item names
    * https://github.com/minetest/minetest_game/issues/1817
      Add tree species to descriptions for appletree and jungletree
      No change to node technical names though. Normal wood is obviously an appletree
    * mods/default/nodes.lua, mods/doors/init.lua, mods/flowers/init.lua,
      mods/vessels/init.lua, mods/default/nodes.lua, mods/doors/init.lua,
      mods/flowers/init.lua, mods/carts/rails.lua, mods/dye/init.lua,
      mods/farming/init.lua and mods/xpanes/init.lua
    * backported https://github.com/minetest/minetest_game/pull/1795
* fb610ffa59
  Allow mossy cobble slabs to combine  mods/stairs/init.lua
    * backported https://github.com/minetest/minetest_game/pull/1791
    * fixed https://github.com/minetest/minetest_game/issues/1790
* d37c1d2312
    * Creative: Do not give creative priv to admin mods/creative/init.lua
* https://codeberg.org/minenux/minetest-game-minetest/commit/commit fea78bdf541e6106408018441937d77d163963e5
    * Creative: Add 'creative' privilege for survival servers
    * This adds a 'creative' privilege to survival servers which OPs can bestow
      on admin or competent builders to give access to the creative inventory.
    * backported from 0157175346f9af8cf9ea5ffeb5f3d91fa474d044
2021-12-12 20:39:01 -06:00

71 lines
2.0 KiB
Lua

creative = {}
minetest.register_privilege("creative", {
description = "Allow player to use creative inventory",
give_to_singleplayer = false,
give_to_admin = false
})
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
function creative.is_enabled_for(name)
return creative_mode_cache or
minetest.check_player_privs(name, {creative = true})
end
dofile(minetest.get_modpath("creative") .. "/inventory.lua")
if creative_mode_cache then
-- Dig time is modified according to difference (leveldiff) between tool
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
-- leveldiff and 1.
-- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been
-- increased such that nodes of differing levels have an insignificant
-- effect on digtime.
local digtime = 42
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x = 1, y = 1, z = 2.5},
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = caps,
cracky = caps,
snappy = caps,
choppy = caps,
oddly_breakable_by_hand = caps,
},
damage_groups = {fleshy = 10},
}
})
end
-- Unlimited node placement
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
if placer and placer:is_player() then
return creative.is_enabled_for(placer:get_player_name())
end
end)
-- Don't pick up if the item is already in the inventory
local old_handle_node_drops = minetest.handle_node_drops
function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() or
not creative.is_enabled_for(digger:get_player_name()) then
return old_handle_node_drops(pos, drops, digger)
end
local inv = digger:get_inventory()
if inv then
for _, item in ipairs(drops) do
if not inv:contains_item("main", item, true) then
inv:add_item("main", item)
end
end
end
end