forked from VoxeLibre/VoxeLibre
Merge branch 'master' into fix_copper_blocks
This commit is contained in:
commit
618313f0af
|
@ -24,6 +24,11 @@ local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= fa
|
|||
local mobs_debug = minetest.settings:get_bool("mobs_debug", false) -- Shows helpful debug info above each mob
|
||||
local spawn_logging = minetest.settings:get_bool("mcl_logging_mobs_spawn",true)
|
||||
|
||||
local MAPGEN_LIMIT = mcl_vars.mapgen_limit
|
||||
local MAPGEN_MOB_LIMIT = MAPGEN_LIMIT - 90
|
||||
-- 30927 seems to be the edge of the world, so could be closer, but this is safer
|
||||
|
||||
|
||||
-- Peaceful mode message so players will know there are no monsters
|
||||
if minetest.settings:get_bool("only_peaceful_mobs", false) then
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
|
@ -328,12 +333,37 @@ local function update_timers (self, dtime)
|
|||
end
|
||||
end
|
||||
|
||||
function mob_class:outside_limits()
|
||||
local pos = self.object:get_pos()
|
||||
if pos then
|
||||
local posx = math.abs(pos.x)
|
||||
local posy = math.abs(pos.y)
|
||||
local posz = math.abs(pos.z)
|
||||
if posx > MAPGEN_MOB_LIMIT or posy > MAPGEN_MOB_LIMIT or posz > MAPGEN_MOB_LIMIT then
|
||||
--minetest.log("action", "Getting close to limits of worldgen: " .. minetest.pos_to_string(pos))
|
||||
if posx > MAPGEN_LIMIT or posy > MAPGEN_LIMIT or posz > MAPGEN_LIMIT then
|
||||
minetest.log("action", "Warning mob past limits of worldgen: " .. minetest.pos_to_string(pos))
|
||||
else
|
||||
if self.state ~= "stand" then
|
||||
minetest.log("action", "Warning mob close to limits of worldgen: " .. minetest.pos_to_string(pos))
|
||||
self.state = "stand"
|
||||
self:set_animation("stand")
|
||||
self.object:set_acceleration(vector.zero())
|
||||
self.object:set_velocity(vector.zero())
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- main mob function
|
||||
function mob_class:on_step(dtime)
|
||||
local pos = self.object:get_pos()
|
||||
if not pos then return end
|
||||
|
||||
if self:check_despawn(pos, dtime) then return true end
|
||||
if self:outside_limits() then return end
|
||||
|
||||
if self:check_death_and_slow_mob() then
|
||||
--minetest.log("action", "Mob is dying: ".. tostring(self.name))
|
||||
|
|
|
@ -298,7 +298,14 @@ local function who_are_you_looking_at (self)
|
|||
elseif not self._locked_object then
|
||||
if math.random(1, 30) then
|
||||
--minetest.log("Change look check: ".. self.name)
|
||||
local look_at_player_chance = math.random(20/self.curiosity)
|
||||
|
||||
-- For the wither this was 20/60=0.33, so probably need to rebalance and divide rates.
|
||||
-- but frequency of check isn't good as it is costly. Making others too infrequent requires testing
|
||||
local chance = 20/self.curiosity
|
||||
|
||||
if chance < 1 then chance = 1 end
|
||||
local look_at_player_chance = math.random(chance)
|
||||
|
||||
-- was 5000 but called in loop based on entities. so div by 12 as estimate avg of entities found,
|
||||
-- then div by 20 as less freq lookup
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ local psdef= {
|
|||
time=0,
|
||||
minpos = vector.new(-15,20,-15),
|
||||
maxpos = vector.new(15,25,15),
|
||||
minvel = vector.new(-2,-17,-2),
|
||||
maxvel = vector.new(2,-8,2),
|
||||
minacc = vector.new(0,0,0),
|
||||
maxacc = vector.new(0,-0.5,0),
|
||||
minvel = vector.new(0,-20,0),
|
||||
maxvel = vector.new(0,-15,0),
|
||||
minacc = vector.new(0,-0.8,0),
|
||||
maxacc = vector.new(0,-0.8,0),
|
||||
minexptime = 1,
|
||||
maxexptime = 4,
|
||||
minsize = 4,
|
||||
|
|
|
@ -1061,8 +1061,8 @@ minetest.register_allow_player_inventory_action(function(player, action, inv, in
|
|||
or action == "take" and info.listname == "enderchest"
|
||||
) then
|
||||
local def = player:get_wielded_item():get_definition()
|
||||
|
||||
if not minetest.find_node_near(player:get_pos(), def and def.range or ItemStack():get_definition().range, "mcl_chests:ender_chest_small", true) then
|
||||
local range = (def and def.range or player:get_inventory():get_stack("hand", 1):get_definition().range) + 1
|
||||
if not minetest.find_node_near(player:get_pos(), range, "mcl_chests:ender_chest_small", true) then
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -50,7 +50,7 @@ minetest.register_node("mcl_core:water_flowing", {
|
|||
liquid_viscosity = WATER_VISC,
|
||||
liquid_range = 7,
|
||||
waving = 3,
|
||||
post_effect_color = {a=20, r=0x03, g=0x3C, b=0x5C},
|
||||
post_effect_color = {a=60, r=0x03, g=0x3C, b=0x5C},
|
||||
groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 100,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
|
|
|
@ -238,7 +238,6 @@ filled_wield_def.wield_scale = { x = 1, y = 1, z = 1 }
|
|||
filled_wield_def.paramtype = "light"
|
||||
filled_wield_def.drawtype = "mesh"
|
||||
filled_wield_def.node_placement_prediction = ""
|
||||
filled_wield_def.range = minetest.registered_items[""].range
|
||||
filled_wield_def.on_place = mcl_util.call_on_rightclick
|
||||
filled_wield_def._mcl_wieldview_item = "mcl_maps:filled_map"
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
Mcl_starting_inventory, adapted for Mineclone 2 by Michieal.
|
||||
|
||||
Based on:
|
||||
Minetest Game mod: give_initial_stuff
|
||||
=====================================
|
||||
See license.txt for license information.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Perttu Ahola (celeron55) <celeron55@gmail.com> (MIT)
|
||||
Various Minetest developers and contributors (MIT)
|
|
@ -0,0 +1,62 @@
|
|||
--- Copyright 2023, Michieal. (Modifications for the mod to be usable in Mineclone 2.)
|
||||
--- Based on mtg mod, give_initial_stuff. "Written by C55 and various minetest developers."
|
||||
---
|
||||
--- Copyright notice created for the license to be valid. (MIT 3)
|
||||
|
||||
local DEBUG = false
|
||||
|
||||
local function mcl_log(message)
|
||||
if DEBUG then
|
||||
minetest.log(message)
|
||||
end
|
||||
end
|
||||
|
||||
local give_inventory = minetest.settings:get_bool("give_starting_inv", false)
|
||||
|
||||
local stuff_string = "mcl_tools:pick_iron,mcl_tools:axe_iron,mcl_tools:shovel_iron,mcl_torches:torch 32,mcl_core:cobble 32"
|
||||
|
||||
mcl_starting_inventory = {
|
||||
items = {}
|
||||
}
|
||||
|
||||
function mcl_starting_inventory.give(player)
|
||||
mcl_log("Giving initial stuff to player " .. player:get_player_name())
|
||||
local inv = player:get_inventory()
|
||||
for _, stack in ipairs(mcl_starting_inventory.items) do
|
||||
if inv:room_for_item("main", stack) then
|
||||
inv:add_item("main", stack)
|
||||
else
|
||||
mcl_log("no room for the item: " .. dump(stack))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_starting_inventory.add(stack)
|
||||
mcl_starting_inventory.items[#mcl_starting_inventory.items + 1] = ItemStack(stack)
|
||||
end
|
||||
|
||||
function mcl_starting_inventory.clear()
|
||||
mcl_starting_inventory.items = {}
|
||||
end
|
||||
|
||||
function mcl_starting_inventory.add_from_csv(str)
|
||||
local items = str:split(",")
|
||||
for _, itemname in ipairs(items) do
|
||||
mcl_starting_inventory.add(itemname)
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_starting_inventory.set_list(list)
|
||||
mcl_starting_inventory.items = list
|
||||
end
|
||||
|
||||
function mcl_starting_inventory.get_list()
|
||||
return mcl_starting_inventory.items
|
||||
end
|
||||
|
||||
if give_inventory and give_inventory == true then
|
||||
mcl_starting_inventory.add_from_csv(stuff_string)
|
||||
mcl_log("Okay to give inventory:\n" .. dump(mcl_starting_inventory.get_list()))
|
||||
end
|
||||
|
||||
minetest.register_on_newplayer(mcl_starting_inventory.give)
|
|
@ -0,0 +1,25 @@
|
|||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
Copyright (C) 2012-2016 Various Minetest developers and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more details:
|
||||
https://opensource.org/licenses/MIT
|
|
@ -0,0 +1,3 @@
|
|||
title = mcl_starting_inventory
|
||||
description = Mineclone 2 mod, Give Starting Inventory
|
||||
depends = mcl_core, mcl_tools, mcl_torches
|
|
@ -424,13 +424,15 @@ minetest.register_lbm({
|
|||
nodenames = {"mcl_core:dirt_with_grass", "mcl_flowers:tallgrass", "mcl_flowers:double_grass", "mcl_flowers:double_grass_top", "mcl_flowers:fern", "mcl_flowers:double_fern", "mcl_flowers:double_fern_top", "mcl_core:reeds", "mcl_core:dirt_with_grass_snow"},
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
local biome_data = minetest.get_biome_data(pos)
|
||||
local biome = biome_data.biome
|
||||
local biome_name = minetest.get_biome_name(biome)
|
||||
local reg_biome = minetest.registered_biomes[biome_name]
|
||||
if node.param2 ~= reg_biome._mcl_grass_palette_index then
|
||||
node.param2 = reg_biome._mcl_grass_palette_index
|
||||
minetest.set_node(pos, node)
|
||||
if mg_name ~= "v6" and mg_name ~= "singlenode" then
|
||||
local biome_data = minetest.get_biome_data(pos)
|
||||
local biome = biome_data.biome
|
||||
local biome_name = minetest.get_biome_name(biome)
|
||||
local reg_biome = minetest.registered_biomes[biome_name]
|
||||
if node.param2 ~= reg_biome._mcl_grass_palette_index then
|
||||
node.param2 = reg_biome._mcl_grass_palette_index
|
||||
minetest.set_node(pos, node)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -3,8 +3,6 @@ mcl_playerplus = {
|
|||
is_pressing_jump = {},
|
||||
}
|
||||
|
||||
local hud_water = {}
|
||||
|
||||
local get_connected_players = minetest.get_connected_players
|
||||
local dir_to_yaw = minetest.dir_to_yaw
|
||||
local get_item_group = minetest.get_item_group
|
||||
|
@ -27,26 +25,6 @@ local mcl_playerplus_internal = {}
|
|||
local time = 0
|
||||
local look_pitch = 0
|
||||
|
||||
|
||||
local function calculate_water_depth(pos)
|
||||
for i=1, 50 do
|
||||
if get_item_group(minetest.get_node(vector.new(pos.x,pos.y+i,pos.z)).name, "water") == 0 then
|
||||
return i
|
||||
end
|
||||
end
|
||||
return 50
|
||||
end
|
||||
|
||||
local function remove_water_hud(player)
|
||||
if hud_water[player] then
|
||||
mcl_weather.skycolor.update_sky_color()
|
||||
for i=1, #hud_water[player] do
|
||||
player:hud_remove(hud_water[player][i])
|
||||
end
|
||||
hud_water[player] = nil
|
||||
end
|
||||
end
|
||||
|
||||
local function player_collision(player)
|
||||
|
||||
local pos = player:get_pos()
|
||||
|
@ -417,23 +395,13 @@ minetest.register_globalstep(function(dtime)
|
|||
set_bone_pos(player,"Body_Control", nil, vector.new(0, -player_vel_yaw + yaw, 0))
|
||||
end
|
||||
|
||||
if get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 then
|
||||
if not hud_water[player] or hud_water[player] and calculate_water_depth(player:get_pos()) ~= #hud_water[player] then
|
||||
remove_water_hud(player)
|
||||
hud_water[player] = {}
|
||||
for i=1, calculate_water_depth(player:get_pos()) do
|
||||
table.insert(hud_water[player], player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
text = "mcl_playerplus_water.png",
|
||||
position = {x = 0.5, y = 0.5},
|
||||
scale = {x = 32, y = 16},
|
||||
offset = {x = 0, y = 0},
|
||||
z_index = -1002,
|
||||
}))
|
||||
end
|
||||
end
|
||||
else
|
||||
remove_water_hud(player)
|
||||
local underwater
|
||||
if get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and underwater ~= true then
|
||||
mcl_weather.skycolor.update_sky_color()
|
||||
local underwater = true
|
||||
elseif get_item_group(mcl_playerinfo[name].node_head, "water") == 0 and underwater == true then
|
||||
mcl_weather.skycolor.update_sky_color()
|
||||
local underwater = false
|
||||
end
|
||||
|
||||
elytra.last_yaw = player:get_look_horizontal()
|
||||
|
@ -643,7 +611,7 @@ minetest.register_globalstep(function(dtime)
|
|||
local vi = area:indexp({x=x, y=y, z=z})
|
||||
local nodename = get_name_from_content_id(data[vi])
|
||||
local light_block_group = minetest.get_item_group(nodename, "light_block")
|
||||
|
||||
|
||||
local tex
|
||||
if nodename == "mcl_core:barrier" then
|
||||
tex = "mcl_core_barrier.png"
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 9.2 KiB |
|
@ -236,6 +236,9 @@ mcl_extended_pet_control (Extended pet control) bool true
|
|||
# Enable hamburgers for villagers to follow
|
||||
mcl_enable_hamburger (Enable Hamburger) bool true
|
||||
|
||||
# Starting Inventory contents (given directly to the new player) type: bool
|
||||
give_starting_inv (Player Starter Pack) bool false
|
||||
|
||||
[Debugging]
|
||||
# If enabled, this will show the itemstring of an item in the description.
|
||||
mcl_item_id_debug (Item ID Debug) bool false
|
||||
|
|
Loading…
Reference in New Issue