forked from VoxeLibre/VoxeLibre
Compare commits
10 Commits
master
...
mcl_starti
Author | SHA1 | Date |
---|---|---|
|
29597af738 | |
|
f3e840a0ff | |
|
d48b3dcaee | |
|
88493091b6 | |
|
d68667beb9 | |
|
181628e539 | |
|
c57a757510 | |
|
26f3275b7c | |
|
45b4b4a458 | |
|
5424ca8c2b |
|
@ -24,11 +24,6 @@ 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 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 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
|
-- Peaceful mode message so players will know there are no monsters
|
||||||
if minetest.settings:get_bool("only_peaceful_mobs", false) then
|
if minetest.settings:get_bool("only_peaceful_mobs", false) then
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
@ -333,37 +328,12 @@ local function update_timers (self, dtime)
|
||||||
end
|
end
|
||||||
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
|
-- main mob function
|
||||||
function mob_class:on_step(dtime)
|
function mob_class:on_step(dtime)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
if not pos then return end
|
if not pos then return end
|
||||||
|
|
||||||
if self:check_despawn(pos, dtime) then return true 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
|
if self:check_death_and_slow_mob() then
|
||||||
--minetest.log("action", "Mob is dying: ".. tostring(self.name))
|
--minetest.log("action", "Mob is dying: ".. tostring(self.name))
|
||||||
|
|
|
@ -172,7 +172,6 @@ local professions = {
|
||||||
{ { "mcl_mobitems:string", 15, 20 }, E1 },
|
{ { "mcl_mobitems:string", 15, 20 }, E1 },
|
||||||
{ E1, { "mcl_bows:arrow", 8, 12 } },
|
{ E1, { "mcl_bows:arrow", 8, 12 } },
|
||||||
{ { "mcl_core:gravel", 10, 10, "mcl_core:emerald", 1, 1 }, { "mcl_core:flint", 6, 10 } },
|
{ { "mcl_core:gravel", 10, 10, "mcl_core:emerald", 1, 1 }, { "mcl_core:flint", 6, 10 } },
|
||||||
{ { "mcl_core:stick", 32, 32 }, E1 },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{ { "mcl_core:flint", 26, 26 }, E1 },
|
{ { "mcl_core:flint", 26, 26 }, E1 },
|
||||||
|
|
|
@ -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
|
|
@ -236,6 +236,9 @@ mcl_extended_pet_control (Extended pet control) bool true
|
||||||
# Enable hamburgers for villagers to follow
|
# Enable hamburgers for villagers to follow
|
||||||
mcl_enable_hamburger (Enable Hamburger) bool true
|
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]
|
[Debugging]
|
||||||
# If enabled, this will show the itemstring of an item in the description.
|
# If enabled, this will show the itemstring of an item in the description.
|
||||||
mcl_item_id_debug (Item ID Debug) bool false
|
mcl_item_id_debug (Item ID Debug) bool false
|
||||||
|
|
Loading…
Reference in New Issue