Merge branch 'master' into credits

This commit is contained in:
Elias Fleckenstein 2021-04-06 10:53:15 +02:00
commit 175cb44fb1
15 changed files with 248 additions and 35 deletions

View File

@ -21,6 +21,9 @@ mcl_vars.gui_bg_img = "background9[1,1;1,1;mcl_base_textures_background9.png;tru
-- Legacy
mcl_vars.inventory_header = ""
-- Tool wield size
mcl_vars.tool_wield_scale = { x = 1.8, y = 1.8, z = 1 }
-- Mapgen variables
local mg_name = minetest.get_mapgen_setting("mg_name")
local minecraft_height_limit = 256

View File

@ -4351,7 +4351,7 @@ end
-- make explosion with protection and tnt mod check
function mobs:boom(self, pos, strength, fire)
self.object:remove()
if mod_explosions then
if mobs_griefing and not minetest.is_protected(pos, "") then
mcl_explosions.explode(pos, strength, { drop_chance = 1.0, fire = fire }, self.object)

View File

@ -75,6 +75,57 @@ mobs:register_mob("mobs_mc:blaze", {
fear_height = 0,
glow = 14,
fire_resistant = true,
do_custom = function(self)
if self.state == "attack" and vector.distance(self.object:get_pos(), self.attack:get_pos()) < 1.2 then
mcl_burning.set_on_fire(self.attack, 5)
end
local pos = self.object:get_pos()
minetest.add_particle({
pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2},
velocity = {x=0, y=math.random(1,1), z=0},
expirationtime = math.random(),
size = math.random(1, 4),
collisiondetection = true,
vertical = false,
texture = "mcl_particles_smoke_anim.png^[colorize:#2c2c2c:255",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 2.05,
},
})
minetest.add_particle({
pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2},
velocity = {x=0, y=math.random(1,1), z=0},
expirationtime = math.random(),
size = math.random(1, 4),
collisiondetection = true,
vertical = false,
texture = "mcl_particles_smoke_anim.png^[colorize:#424242:255",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 2.05,
},
})
minetest.add_particle({
pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2},
velocity = {x=0, y=math.random(1,1), z=0},
expirationtime = math.random(),
size = math.random(1, 4),
collisiondetection = true,
vertical = false,
texture = "mcl_particles_smoke_anim.png^[colorize:#0f0f0f:255",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 2.05,
},
})
end,
})
mobs:spawn_specific("mobs_mc:blaze", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 5000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max)

View File

@ -157,8 +157,29 @@ local horse = {
self._regentimer = 0
end
-- if driver present allow control of horse
if self.driver then
-- Some weird human is riding. Buck them off?
if self.driver and not self.tamed and self.buck_off_time <= 0 then
if math.random() < 0.2 then
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
-- TODO bucking animation
else
-- Nah, can't be bothered. Think about it again in one second
self.buck_off_time = 20
end
end
-- Tick the timer for trying to buck the player off
if self.buck_off_time then
if self.driver then
self.buck_off_time = self.buck_off_time - 1
else
-- Player isn't riding anymore so no need to count
self.buck_off_time = nil
end
end
-- if driver present and horse has a saddle allow control of horse
if self.driver and self._saddle then
mobs.drive(self, "walk", "stand", false, dtime)
@ -191,6 +212,50 @@ local horse = {
local item = clicker:get_wielded_item()
local iname = item:get_name()
local heal = 0
-- Taming
self.temper = self.temper or (math.random(1,100))
if not self.tamed then
local temper_increase = 0
-- Feeding, intentionally not using mobs:feed_tame because horse taming is
-- different and more complicated
if (iname == mobs_mc.items.sugar) then
temper_increase = 3
elseif (iname == mobs_mc.items.wheat) then
temper_increase = 3
elseif (iname == mobs_mc.items.apple) then
temper_increase = 3
elseif (iname == mobs_mc.items.golden_carrot) then
temper_increase = 5
elseif (iname == mobs_mc.items.golden_apple) then
temper_increase = 10
-- Trying to ride
elseif not self.driver then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
self.buck_off_time = 40 -- TODO how long does it take in minecraft?
if self.temper > 100 then
self.tamed = true -- NOTE taming can only be finished by riding the horse
if not self.owner or self.owner == "" then
self.owner = clicker:get_player_name()
end
end
temper_increase = 5
-- Clicking on the horse while riding ==> unmount
elseif self.driver and self.driver == clicker then
mobs.detach(clicker, {x = 1, y = 0, z = 1})
end
-- If nothing happened temper_increase = 0 and addition does nothing
self.temper = self.temper + temper_increase
return
end
if can_breed(self.name) then
-- Breed horse with golden apple or golden carrot
if (iname == mobs_mc.items.golden_apple) then
@ -202,7 +267,8 @@ local horse = {
return
end
end
-- Feed/tame with anything else
-- Feed with anything else
-- TODO heal amounts don't work
if (iname == mobs_mc.items.sugar) then
heal = 1
elseif (iname == mobs_mc.items.wheat) then
@ -212,7 +278,7 @@ local horse = {
elseif (iname == mobs_mc.items.hay_bale) then
heal = 20
end
if heal > 0 and mobs:feed_tame(self, clicker, heal, false, true) then
if heal > 0 and mobs:feed_tame(self, clicker, heal, false, false) then
return
end

View File

@ -51,7 +51,6 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance
end
end, children, self.attack)
end
return true
end
end

View File

@ -133,7 +133,7 @@ S("The speed and damage of the arrow increases the longer you charge. The regula
_doc_items_usagehelp = S("To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot."),
_doc_items_durability = BOW_DURABILITY,
inventory_image = "mcl_bows_bow.png",
wield_scale = { x = 1.8, y = 1.8, z = 1 },
wield_scale = mcl_vars.tool_wield_scale,
stack_max = 1,
range = 4,
-- Trick to disable digging as well
@ -198,7 +198,7 @@ for level=0, 2 do
description = S("Bow"),
_doc_items_create_entry = false,
inventory_image = "mcl_bows_bow_"..level..".png",
wield_scale = { x = 1.8, y = 1.8, z = 1 },
wield_scale = mcl_vars.tool_wield_scale,
stack_max = 1,
range = 0, -- Pointing range to 0 to prevent punching with bow :D
groups = {not_in_creative_inventory=1, not_in_craft_guide=1, bow=1, enchantability=1},

View File

@ -1,6 +1,6 @@
name = mcl_bows
author = Arcelmi
description = This mod adds bows and arrows for MineClone 2.
depends = controls, mcl_particles, mcl_enchanting
depends = controls, mcl_particles, mcl_enchanting, mcl_init
optional_depends = awards, mcl_achievements, mcl_core, mcl_mobitems, playerphysics, doc, doc_identifier, mesecons_button

View File

@ -68,7 +68,7 @@ minetest.register_tool("mcl_farming:hoe_wood", {
_doc_items_usagehelp = hoe_usagehelp,
_doc_items_hidden = false,
inventory_image = "farming_tool_woodhoe.png",
wield_scale = { x = 1.8, y = 1.8, z = 1 },
wield_scale = mcl_vars.tool_wield_scale,
on_place = hoe_on_place_function(uses.wood),
groups = { tool=1, hoe=1, enchantability=15 },
tool_capabilities = {
@ -111,7 +111,7 @@ minetest.register_tool("mcl_farming:hoe_stone", {
_doc_items_longdesc = hoe_longdesc,
_doc_items_usagehelp = hoe_usagehelp,
inventory_image = "farming_tool_stonehoe.png",
wield_scale = { x = 1.8, y = 1.8, z = 1 },
wield_scale = mcl_vars.tool_wield_scale,
on_place = hoe_on_place_function(uses.stone),
groups = { tool=1, hoe=1, enchantability=5 },
tool_capabilities = {
@ -149,7 +149,7 @@ minetest.register_tool("mcl_farming:hoe_iron", {
_doc_items_longdesc = hoe_longdesc,
_doc_items_usagehelp = hoe_usagehelp,
inventory_image = "farming_tool_steelhoe.png",
wield_scale = { x = 1.8, y = 1.8, z = 1 },
wield_scale = mcl_vars.tool_wield_scale,
on_place = hoe_on_place_function(uses.iron),
groups = { tool=1, hoe=1, enchantability=14 },
tool_capabilities = {
@ -195,7 +195,7 @@ minetest.register_tool("mcl_farming:hoe_gold", {
_doc_items_longdesc = hoe_longdesc,
_doc_items_usagehelp = hoe_usagehelp,
inventory_image = "farming_tool_goldhoe.png",
wield_scale = { x = 1.8, y = 1.8, z = 1 },
wield_scale = mcl_vars.tool_wield_scale,
on_place = hoe_on_place_function(uses.gold),
groups = { tool=1, hoe=1, enchantability=22 },
tool_capabilities = {
@ -242,7 +242,7 @@ minetest.register_tool("mcl_farming:hoe_diamond", {
_doc_items_longdesc = hoe_longdesc,
_doc_items_usagehelp = hoe_usagehelp,
inventory_image = "farming_tool_diamondhoe.png",
wield_scale = { x = 1.8, y = 1.8, z = 1 },
wield_scale = mcl_vars.tool_wield_scale,
on_place = hoe_on_place_function(uses.diamond),
groups = { tool=1, hoe=1, enchantability=10 },
tool_capabilities = {

View File

@ -1,3 +1,3 @@
name = mcl_farming
depends = mcl_core, mcl_sounds, mcl_wool, mcl_torches, mcl_weather, mobs_mc, mcl_colors
depends = mcl_core, mcl_sounds, mcl_wool, mcl_torches, mcl_weather, mobs_mc, mcl_colors, mcl_init
optional_depends = mcl_armor, doc

View File

@ -70,7 +70,7 @@ local shovel_use = S("To turn a grass block into a grass path, hold the shovel i
local shears_longdesc = S("Shears are tools to shear sheep and to mine a few block types. Shears are a special mining tool and can be used to obtain the original item from grass, leaves and similar blocks that require cutting.")
local shears_use = S("To shear sheep or carve faceless pumpkins, use the “place” key on them. Faces can only be carved at the side of faceless pumpkins. Mining works as usual, but the drops are different for a few blocks.")
local wield_scale = { x = 1.8, y = 1.8, z = 1 }
local wield_scale = mcl_vars.tool_wield_scale
-- Picks
minetest.register_tool("mcl_tools:pick_wood", {

View File

@ -1,2 +1,2 @@
name = mcl_tools
depends = mcl_sounds
depends = mcl_sounds, mcl_init

View File

@ -0,0 +1,36 @@
local noisemap = PerlinNoiseMap({
offset = 0.5,
scale = 0.5,
spread = {x = 84, y = 84, z = 84},
seed = minetest.get_mapgen_setting("seed") + 99999,
octaves = 4,
persist = 0.85,
}, {x = 151, y = 30, z = 151}):get_3d_map({x = 0, y = 0, z = 0})
local c_end_stone = minetest.get_content_id("mcl_end:end_stone")
local x_offset = mcl_vars.mg_end_platform_pos.x - 27
local y_offset = -2
minetest.register_on_generated(function(minp, maxp)
if maxp.y < (-27025 + y_offset) or minp.y > (-27000 + y_offset + 4) or maxp.x < (-75 + x_offset) or minp.x > (75 + x_offset) or maxp.z < -75 or minp.z > 75 then
return
end
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
for idx in area:iter(math.max(minp.x, -75 + x_offset), math.max(minp.y, -27025 + y_offset + 4), math.max(minp.z, -75), math.min(maxp.x, 75 + x_offset), math.min(maxp.y, -27000 + y_offset), math.min(maxp.z, 75)) do
local pos = area:position(idx)
local y = 27025 + pos.y - y_offset
if noisemap[pos.x + 75 - x_offset + 1][y + 1][pos.z + 75 + 1] > (math.abs(1 - y / 25) ^ 2 + math.abs((pos.x - x_offset) / 75) ^ 2 + math.abs(pos.z / 75) ^ 2) then
data[idx] = c_end_stone
end
end
vm:set_data(data)
vm:calc_lighting()
vm:update_liquids()
vm:write_to_map()
end)

View File

@ -0,0 +1,4 @@
name = mcl_end_island
author = Fleckenstein
depends = mcl_mapgen_core, mcl_end
description = Generate the end main island for MCL2

View File

@ -86,17 +86,23 @@ minetest.register_globalstep(function(dtime)
time = time + dtime
-- Update jump status immediately since we need this info in real time.
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
for _,player in pairs(get_connected_players()) do
--[[
_ _ _
__ _ _ __ (_)_ __ ___ __ _| |_(_) ___ _ __ ___
/ _` | '_ \| | '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
| (_| | | | | | | | | | | (_| | |_| | (_) | | | \__ \
\__,_|_| |_|_|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
]]--
local controls = player:get_player_control()
name = player:get_player_name()
local name = player:get_player_name()
local meta = player:get_meta()
local player_velocity = player:get_velocity() or player:get_player_velocity()
local parent = player:get_attach()
local wielded = player:get_wielded_item()
local player_velocity = player:get_velocity() or player:get_player_velocity()
-- controls head bone
local pitch = - degrees(player:get_look_vertical())
@ -114,7 +120,7 @@ minetest.register_globalstep(function(dtime)
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35))
-- when punching
elseif controls.LMB and player:get_attach() == nil then
elseif controls.LMB and not parent then
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch,0,0))
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
-- when holding an item.
@ -127,38 +133,40 @@ minetest.register_globalstep(function(dtime)
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0))
end
if controls.sneak and player:get_attach() == nil then
if parent then
local parent_yaw = degrees(parent:get_yaw())
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch, -limit_vel_yaw(yaw, parent_yaw) + parent_yaw, 0))
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
elseif controls.sneak then
-- controls head pitch when sneaking
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0))
-- sets eye height, and nametag color accordingly
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }})
-- sneaking body conrols
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
elseif get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and player:get_attach() == nil and is_sprinting(name) == true then
elseif get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and is_sprinting(name) == true then
-- set head pitch and yaw when swimming
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),player_vel_yaw - yaw,0))
-- sets eye height, and nametag color accordingly
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
-- control body bone when swimming
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,-player_vel_yaw + yaw + 180,0))
elseif player:get_attach() == nil then
else
-- sets eye height, and nametag color accordingly
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch, player_vel_yaw - yaw, 0))
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0, -player_vel_yaw + yaw, 0))
else
local attached = player:get_attach(parent)
local attached_yaw = degrees(attached:get_yaw())
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch, -limit_vel_yaw(yaw, attached_yaw) + attached_yaw, 0))
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
end
-- Update jump status immediately since we need this info in real time.
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
if mcl_playerplus_internal[name].jump_cooldown > 0 then
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
end
if controls.jump and mcl_playerplus_internal[name].jump_cooldown <= 0 then
pos = player:get_pos()

46
tools/remove_end.py Normal file
View File

@ -0,0 +1,46 @@
world_name = "world"
path_to_map_sqlite = "../../../worlds/" + world_name + "/map.sqlite"
import sqlite3, sys
try:
conn = sqlite3.connect(path_to_map_sqlite)
except Error as e:
print(e)
sys.exit()
def unsignedToSigned(i, max_positive):
if i < max_positive:
return i
else:
return i - 2*max_positive
cursor = conn.cursor()
cursor.execute("SELECT pos FROM blocks")
poses = cursor.fetchall()
end_blocks = []
for i0 in (poses):
i = int(i0[0])
blockpos = i
x = unsignedToSigned(i % 4096, 2048)
i = int((i - x) / 4096)
y = unsignedToSigned(i % 4096, 2048)
i = int((i - y) / 4096)
z = unsignedToSigned(i % 4096, 2048)
node_pos_y = y * 16
if node_pos_y > -28811 and node_pos_y + 15 < -67:
end_blocks.append(blockpos)
if len(end_blocks) < 1:
print ("End blocks not found")
sys.exit()
counter = 0
for blockpos in end_blocks:
print("Deleting ", blockpos)
cursor.execute("DELETE FROM blocks WHERE pos=" + str(blockpos))
counter += 1
conn.commit()
print(counter, " block(s) deleted")