Merge branch 'master' into real_maps

This commit is contained in:
Elias Fleckenstein 2021-05-05 08:21:01 +02:00
commit a9817fea4b
20 changed files with 91 additions and 49 deletions

View File

@ -98,7 +98,7 @@ end
minetest.register_globalstep(function(dtime)
tick = not tick
for _,player in pairs(minetest.get_connected_players()) do
@ -106,7 +106,7 @@ minetest.register_globalstep(function(dtime)
local name = player:get_player_name()
local pos = player:get_pos()
if tick == true and pool[name] > 0 then
@ -124,7 +124,7 @@ minetest.register_globalstep(function(dtime)
end
local inv = player:get_inventory()
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
@ -406,6 +406,14 @@ minetest.register_entity(":__builtin:item", {
return
end
local stack = ItemStack(itemstring)
if minetest.get_item_group(stack:get_name(), "compass") > 0 then
stack:set_name("mcl_compass:16")
itemstring = stack:to_string()
self.itemstring = itemstring
end
if minetest.get_item_group(stack:get_name(), "clock") > 0 then
self.is_clock = true
end
local count = stack:get_count()
local max_count = stack:get_stack_max()
if count > max_count then
@ -593,6 +601,12 @@ minetest.register_entity(":__builtin:item", {
local node = minetest.get_node_or_nil(p)
local in_unloaded = (node == nil)
if self.is_clock then
self.object:set_properties({
textures = {"mcl_clock:clock_" .. (mcl_worlds.clock_works(p) and mcl_clock.old_time or mcl_clock.random_frame)}
})
end
-- If no collector was found for a long enough time, declare the magnet as disabled
if self._magnet_active and (self._collector_timer == nil or (self._collector_timer > item_drop_settings.magnet_time)) then
self._magnet_active = false

View File

@ -43,10 +43,10 @@ mobs:register_mob("mobs_mc:creeper", {
eye_height = 1.25,
--hssssssssssss
explosion_strength = 10,
explosion_radius = 4,
explosion_damage_radius = 6,
explosiontimer_reset_radius = 6,
explosion_strength = 3,
--explosion_radius = 3,
--explosion_damage_radius = 6,
--explosiontimer_reset_radius = 6,
reach = 1.5,
defuse_reach = 4,
explosion_timer = 0.3,
@ -148,7 +148,7 @@ mobs:register_mob("mobs_mc:creeper", {
})
mobs:register_mob("mobs_mc:creeper_charged", {
description = S("Creeper"),
description = S("Charged Creeper"),
type = "monster",
spawn_class = "hostile",
hp_min = 20,
@ -182,10 +182,10 @@ mobs:register_mob("mobs_mc:creeper_charged", {
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
attack_type = "explode",
explosion_strength = 24,
explosion_radius = 12,
explosion_damage_radius = 18,
explosiontimer_reset_radius = 10,
explosion_strength = 6,
--explosion_radius = 3,
--explosion_damage_radius = 6,
--explosiontimer_reset_radius = 3,
reach = 1.5,
defuse_reach = 4,
explosion_timer = 0.3,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,7 +1,7 @@
local S = minetest.get_translator("mcl_clock")
--[[
mcl_clock, renew of the renew of the watch mod
mcl_clock, renew of the renew of the mcl_clock mod
Original from Echo, here: http://forum.minetest.net/viewtopic.php?id=3795
]]--
@ -11,8 +11,7 @@ mcl_clock = {}
-- This is the itemstring of the default clock item. It is used for the default inventory image, help entries, and the like
mcl_clock.stereotype = "mcl_clock:clock"
local watch = {}
watch.old_time = -1
mcl_clock.old_time = -1
local clock_frames = 64
@ -22,20 +21,20 @@ local random_timer_trigger = 1.0 -- random clock spinning tick in seconds. Incre
local random_frame = math.random(0, clock_frames-1)
-- Image of all possible faces
watch.images = {}
mcl_clock.images = {}
for frame=0, clock_frames-1 do
local sframe = tostring(frame)
if string.len(sframe) == 1 then
sframe = "0" .. sframe
end
table.insert(watch.images, "mcl_clock_clock_"..sframe..".png")
table.insert(mcl_clock.images, "mcl_clock_clock_"..sframe..".png")
end
local function round(num)
return math.floor(num + 0.5)
end
function watch.get_clock_frame()
function mcl_clock.get_clock_frame()
local t = clock_frames * minetest.get_timeofday()
t = round(t)
if t == clock_frames then t = 0 end
@ -45,7 +44,7 @@ end
local doc_mod = minetest.get_modpath("doc") ~= nil
-- Register items
function watch.register_item(name, image, creative, frame)
function mcl_clock.register_item(name, image, creative, frame)
local g = 1
if creative then
g = 0
@ -78,7 +77,7 @@ end
local force_clock_update_timer = 0
minetest.register_globalstep(function(dtime)
local now = watch.get_clock_frame()
local now = mcl_clock.get_clock_frame()
force_clock_update_timer = force_clock_update_timer + dtime
random_timer = random_timer + dtime
-- This causes the random spinning of the clock
@ -87,16 +86,18 @@ minetest.register_globalstep(function(dtime)
random_timer = 0
end
if watch.old_time == now and force_clock_update_timer < 60 then
if mcl_clock.old_time == now and force_clock_update_timer < 60 then
return
end
force_clock_update_timer = 0
watch.old_time = now
mcl_clock.old_time = now
mcl_clock.random_frame = random_frame
for p, player in pairs(minetest.get_connected_players()) do
for s, stack in pairs(player:get_inventory():get_list("main")) do
local dim = mcl_worlds.pos_to_dimension(player:get_pos())
local frame
-- Clocks do not work in certain zones
if not mcl_worlds.clock_works(player:get_pos()) then
@ -104,6 +105,7 @@ minetest.register_globalstep(function(dtime)
else
frame = now
end
local count = stack:get_count()
if stack:get_name() == mcl_clock.stereotype then
player:get_inventory():set_stack("main", s, "mcl_clock:clock_"..frame.." "..count)
@ -117,7 +119,7 @@ end)
-- Immediately set correct clock time after crafting
minetest.register_on_craft(function(itemstack)
if itemstack:get_name() == mcl_clock.stereotype then
itemstack:set_name("mcl_clock:clock_"..watch.get_clock_frame())
itemstack:set_name("mcl_clock:clock_"..mcl_clock.get_clock_frame())
end
end)
@ -132,7 +134,7 @@ minetest.register_craft({
})
-- Clock tool
watch.register_item(mcl_clock.stereotype, watch.images[1], true, 1)
mcl_clock.register_item(mcl_clock.stereotype, mcl_clock.images[1], true, 1)
-- Faces
for a=0,clock_frames-1,1 do
@ -142,6 +144,6 @@ for a=0,clock_frames-1,1 do
else
b = b + 32
end
watch.register_item("mcl_clock:clock_"..tostring(a), watch.images[b+1], false, a+1)
mcl_clock.register_item("mcl_clock:clock_"..tostring(a), mcl_clock.images[b+1], false, a+1)
end

View File

@ -12,6 +12,27 @@ local random_timer_trigger = 0.5 -- random compass spinning tick in seconds. Inc
local random_frame = math.random(0, compass_frames-1)
function mcl_compass.get_compass_image(pos, dir)
-- Compasses do not work in certain zones
if mcl_worlds.compass_works(pos) then
local spawn = {x=0,y=0,z=0}
local ssp = minetest.setting_get_pos("static_spawnpoint")
if ssp then
spawn = ssp
if type(spawn) ~= "table" or type(spawn.x) ~= "number" or type(spawn.y) ~= "number" or type(spawn.z) ~= "number" then
spawn = {x=0,y=0,z=0}
end
end
local angle_north = math.deg(math.atan2(spawn.x - pos.x, spawn.z - pos.z))
if angle_north < 0 then angle_north = angle_north + 360 end
local angle_dir = -math.deg(dir)
local angle_relative = (angle_north - angle_dir + 180) % 360
return math.floor((angle_relative/11.25) + 0.5) % compass_frames
else
return random_frame
end
end
minetest.register_globalstep(function(dtime)
random_timer = random_timer + dtime
@ -30,27 +51,7 @@ minetest.register_globalstep(function(dtime)
end
if has_compass(player) then
local pos = player:get_pos()
local dim = mcl_worlds.pos_to_dimension(pos)
local compass_image
-- Compasses do not work in certain zones
if not mcl_worlds.compass_works(pos) then
compass_image = random_frame
else
local spawn = {x=0,y=0,z=0}
local ssp = minetest.setting_get_pos("static_spawnpoint")
if ssp then
spawn = ssp
if type(spawn) ~= "table" or type(spawn.x) ~= "number" or type(spawn.y) ~= "number" or type(spawn.z) ~= "number" then
spawn = {x=0,y=0,z=0}
end
end
local dir = player:get_look_horizontal()
local angle_north = math.deg(math.atan2(spawn.x - pos.x, spawn.z - pos.z))
if angle_north < 0 then angle_north = angle_north + 360 end
local angle_dir = -math.deg(dir)
local angle_relative = (angle_north - angle_dir + 180) % 360
compass_image = math.floor((angle_relative/11.25) + 0.5) % compass_frames
end
local compass_image = mcl_compass.get_compass_image(pos, player:get_look_horizontal())
for j,stack in pairs(player:get_inventory():get_list("main")) do
if minetest.get_item_group(stack:get_name(), "compass") ~= 0 and

View File

@ -117,8 +117,9 @@ pumpkin_face_base_def.groups.armor_head=1
pumpkin_face_base_def.groups.non_combat_armor_head=1
pumpkin_face_base_def._mcl_armor_mob_range_factor = 0
pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman"
pumpkin_face_base_def._mcl_armor_entry = "head"
pumpkin_face_base_def.groups.non_combat_armor=1
pumpkin_face_base_def._mcl_armor_element = "head"
pumpkin_face_base_def._mcl_armor_texture = "mcl_farming_pumpkin_face.png"
pumpkin_face_base_def._mcl_armor_preview = "mcl_farming_pumpkin_face_preview.png"
if minetest.get_modpath("mcl_armor") then
pumpkin_face_base_def.on_secondary_use = mcl_armor.equip_on_use
end

View File

@ -112,6 +112,8 @@ local function addhead(name, texture, desc, longdesc, rangemob, rangefactor)
_mcl_armor_mob_range_mob = rangemob,
_mcl_armor_mob_range_factor = rangefactor,
_mcl_armor_element = "head",
_mcl_armor_texture = "mcl_heads_" .. name .. ".png",
_mcl_armor_preview = "mcl_heads_" .. name .. "_preview.png",
_mcl_blast_resistance = 1,
_mcl_hardness = 1,
})

View File

@ -165,6 +165,21 @@ minetest.register_node("mcl_itemframes:item_frame",{
groups = { dig_immediate=3,deco_block=1,dig_by_piston=1,container=7,attached_node_facedir=1 },
sounds = mcl_sounds.node_sound_defaults(),
node_placement_prediction = "",
on_timer = function(pos)
local inv = minetest.get_meta(pos):get_inventory()
local stack = inv:get_stack("main", 1)
local itemname = stack:get_name()
if minetest.get_item_group(itemname, "clock") > 0 then
local new_name = "mcl_clock:clock_" .. (mcl_worlds.clock_works(pos) and mcl_clock.old_time or mcl_clock.random_frame)
if itemname ~= new_name then
stack:set_name(new_name)
inv:set_stack("main", 1, stack)
local node = minetest.get_node(pos)
update_item_entity(pos, node, node.param2)
end
minetest.get_node_timer(pos):start(1.0)
end
end,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
@ -205,6 +220,13 @@ minetest.register_node("mcl_itemframes:item_frame",{
end
local put_itemstack = ItemStack(itemstack)
put_itemstack:set_count(1)
local itemname = put_itemstack:get_name()
if minetest.get_item_group(itemname, "compass") > 0 then
put_itemstack:set_name("mcl_compass:" .. mcl_compass.get_compass_image(pos, minetest.dir_to_yaw(minetest.facedir_to_dir(node.param2))))
end
if minetest.get_item_group(itemname, "clock") > 0 then
minetest.get_node_timer(pos):start(1.0)
end
inv:set_stack("main", 1, put_itemstack)
update_item_entity(pos, node)
-- Add node infotext when item has been named

View File

@ -1,3 +1,3 @@
name = mcl_itemframes
depends = mcl_core, mcl_sounds, mcl_maps
depends = mcl_core, mcl_sounds, mcl_compass, mcl_maps
optional_depends = screwdriver

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB