forked from VoxeLibre/VoxeLibre
Merge branch 'master' into dripping
This commit is contained in:
commit
d27109d807
|
@ -44,18 +44,18 @@ minetest.register_on_respawnplayer(function(player)
|
||||||
mcl_burning.extinguish(player)
|
mcl_burning.extinguish(player)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
function mcl_burning.init_player(player)
|
||||||
local storage
|
local meta = player:get_meta()
|
||||||
|
-- NOTE: mcl_burning:data may be "return nil" (which deserialize into nil) for reasons unknown.
|
||||||
local burn_data = player:get_meta():get_string("mcl_burning:data")
|
if meta:get_string("mcl_burning:data"):find("return nil", 1, true) then
|
||||||
if burn_data == "" then
|
minetest.log("warning", "[mcl_burning] 'mcl_burning:data' player meta field is invalid! Please report this bug")
|
||||||
storage = {}
|
|
||||||
else
|
|
||||||
storage = minetest.deserialize(burn_data)
|
|
||||||
end
|
end
|
||||||
|
mcl_burning.storage[player] = meta:contains("mcl_burning:data") and minetest.deserialize(meta:get_string("mcl_burning:data")) or {}
|
||||||
mcl_burning.storage[player] = storage
|
|
||||||
mcl_burning.channels[player] = minetest.mod_channel_join("mcl_burning:" .. player:get_player_name())
|
mcl_burning.channels[player] = minetest.mod_channel_join("mcl_burning:" .. player:get_player_name())
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
mcl_burning.init_player(player)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
|
|
@ -37,7 +37,7 @@ mobs:register_mob("mobs_mc:creeper", {
|
||||||
},
|
},
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
walk_velocity = 1.05,
|
walk_velocity = 1.05,
|
||||||
run_velocity = 3.25,
|
run_velocity = 2.1,
|
||||||
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
|
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
|
||||||
attack_type = "explode",
|
attack_type = "explode",
|
||||||
eye_height = 1.25,
|
eye_height = 1.25,
|
||||||
|
@ -47,8 +47,8 @@ mobs:register_mob("mobs_mc:creeper", {
|
||||||
--explosion_radius = 3,
|
--explosion_radius = 3,
|
||||||
--explosion_damage_radius = 6,
|
--explosion_damage_radius = 6,
|
||||||
--explosiontimer_reset_radius = 6,
|
--explosiontimer_reset_radius = 6,
|
||||||
reach = 1.5,
|
reach = 3,
|
||||||
defuse_reach = 4,
|
defuse_reach = 5.2,
|
||||||
explosion_timer = 0.3,
|
explosion_timer = 0.3,
|
||||||
allow_fuse_reset = true,
|
allow_fuse_reset = true,
|
||||||
stop_to_explode = true,
|
stop_to_explode = true,
|
||||||
|
@ -95,7 +95,8 @@ mobs:register_mob("mobs_mc:creeper", {
|
||||||
if self._forced_explosion_countdown_timer then
|
if self._forced_explosion_countdown_timer then
|
||||||
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
|
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
|
||||||
if self._forced_explosion_countdown_timer <= 0 then
|
if self._forced_explosion_countdown_timer <= 0 then
|
||||||
mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
mcl_explosions.explode(mcl_util.get_object_center(self.object), self.explosion_strength, { griefing = mobs_griefing, drop_chance = 1.0}, self.object)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -151,6 +152,7 @@ mobs:register_mob("mobs_mc:creeper_charged", {
|
||||||
description = S("Charged Creeper"),
|
description = S("Charged Creeper"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
hostile = true,
|
||||||
hp_min = 20,
|
hp_min = 20,
|
||||||
hp_max = 20,
|
hp_max = 20,
|
||||||
xp_min = 5,
|
xp_min = 5,
|
||||||
|
@ -186,8 +188,8 @@ mobs:register_mob("mobs_mc:creeper_charged", {
|
||||||
--explosion_radius = 3,
|
--explosion_radius = 3,
|
||||||
--explosion_damage_radius = 6,
|
--explosion_damage_radius = 6,
|
||||||
--explosiontimer_reset_radius = 3,
|
--explosiontimer_reset_radius = 3,
|
||||||
reach = 1.5,
|
reach = 3,
|
||||||
defuse_reach = 4,
|
defuse_reach = 5.2,
|
||||||
explosion_timer = 0.3,
|
explosion_timer = 0.3,
|
||||||
allow_fuse_reset = true,
|
allow_fuse_reset = true,
|
||||||
stop_to_explode = true,
|
stop_to_explode = true,
|
||||||
|
@ -219,7 +221,8 @@ mobs:register_mob("mobs_mc:creeper_charged", {
|
||||||
if self._forced_explosion_countdown_timer then
|
if self._forced_explosion_countdown_timer then
|
||||||
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
|
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
|
||||||
if self._forced_explosion_countdown_timer <= 0 then
|
if self._forced_explosion_countdown_timer <= 0 then
|
||||||
mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
mcl_explosions.explode(mcl_util.get_object_center(self.object), self.explosion_strength, { griefing = mobs_griefing, drop_chance = 1.0}, self.object)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
local F = minetest.formspec_escape
|
local F = minetest.formspec_escape
|
||||||
|
local C = minetest.colorize
|
||||||
|
|
||||||
-- Prepare player info table
|
-- Prepare player info table
|
||||||
local players = {}
|
local players = {}
|
||||||
|
@ -289,6 +290,19 @@ filtername["inv"] = S("Survival Inventory")
|
||||||
bg["default"] = dark_bg
|
bg["default"] = dark_bg
|
||||||
end]]
|
end]]
|
||||||
|
|
||||||
|
local function get_stack_size(player)
|
||||||
|
return player:get_meta():get_int("mcl_inventory:switch_stack")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function set_stack_size(player, n)
|
||||||
|
player:get_meta():set_int("mcl_inventory:switch_stack", n)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function (player)
|
||||||
|
if get_stack_size(player) == 0 then
|
||||||
|
set_stack_size(player, 64)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, show, page, filter)
|
function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, show, page, filter)
|
||||||
--reset_menu_item_bg()
|
--reset_menu_item_bg()
|
||||||
|
@ -349,6 +363,8 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size,
|
||||||
armor_slot_imgs = armor_slot_imgs .. "image[5.5,2.75;1,1;mcl_inventory_empty_armor_slot_boots.png]"
|
armor_slot_imgs = armor_slot_imgs .. "image[5.5,2.75;1,1;mcl_inventory_empty_armor_slot_boots.png]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local stack_size = get_stack_size(player)
|
||||||
|
|
||||||
-- Survival inventory slots
|
-- Survival inventory slots
|
||||||
main_list = "list[current_player;main;0,3.75;9,3;9]"..
|
main_list = "list[current_player;main;0,3.75;9,3;9]"..
|
||||||
mcl_formspec.get_itemslot_bg(0,3.75,9,3)..
|
mcl_formspec.get_itemslot_bg(0,3.75,9,3)..
|
||||||
|
@ -376,7 +392,11 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size,
|
||||||
-- achievements button
|
-- achievements button
|
||||||
"image_button[9,4;1,1;mcl_achievements_button.png;__mcl_achievements;]"..
|
"image_button[9,4;1,1;mcl_achievements_button.png;__mcl_achievements;]"..
|
||||||
--"style_type[image_button;border=;bgimg=;bgimg_pressed=]"..
|
--"style_type[image_button;border=;bgimg=;bgimg_pressed=]"..
|
||||||
"tooltip[__mcl_achievements;"..F(S("Achievements")).."]"
|
"tooltip[__mcl_achievements;"..F(S("Achievements")).."]"..
|
||||||
|
-- switch stack size button
|
||||||
|
"image_button[9,5;1,1;default_apple.png;__switch_stack;]"..
|
||||||
|
"label[9.4,5.4;".. F(C("#FFFFFF", stack_size ~= 1 and stack_size or "")) .."]"..
|
||||||
|
"tooltip[__switch_stack;"..F(S("Switch stack size")).."]"
|
||||||
|
|
||||||
-- For shortcuts
|
-- For shortcuts
|
||||||
listrings = listrings ..
|
listrings = listrings ..
|
||||||
|
@ -544,6 +564,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
elseif fields.search and not fields.creative_next and not fields.creative_prev then
|
elseif fields.search and not fields.creative_next and not fields.creative_prev then
|
||||||
set_inv_search(string.lower(fields.search),player)
|
set_inv_search(string.lower(fields.search),player)
|
||||||
page = "nix"
|
page = "nix"
|
||||||
|
elseif fields.__switch_stack then
|
||||||
|
local switch = 1
|
||||||
|
if get_stack_size(player) == 1 then
|
||||||
|
switch = 64
|
||||||
|
end
|
||||||
|
set_stack_size(player, switch)
|
||||||
end
|
end
|
||||||
|
|
||||||
if page then
|
if page then
|
||||||
|
@ -667,3 +693,10 @@ minetest.register_on_joinplayer(function(player)
|
||||||
init(player)
|
init(player)
|
||||||
mcl_inventory.set_creative_formspec(player, 0, 1, nil, false, "nix", "")
|
mcl_inventory.set_creative_formspec(player, 0, 1, nil, false, "nix", "")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info)
|
||||||
|
if minetest.is_creative_enabled(player:get_player_name()) and action == "put" and inventory_info.listname == "main" and get_stack_size(player) == 64 then
|
||||||
|
local stack = inventory_info.stack
|
||||||
|
player:get_inventory():set_stack("main", inventory_info.index, stack:get_name() .. " " .. stack:get_stack_max())
|
||||||
|
end
|
||||||
|
end)
|
|
@ -92,7 +92,7 @@ local function get_arrow(player)
|
||||||
return arrow_stack, arrow_stack_id
|
return arrow_stack, arrow_stack_id
|
||||||
end
|
end
|
||||||
|
|
||||||
local function player_shoot_arrow(itemstack, player, power, damage, is_critical)
|
local function player_shoot_arrow(wielditem, player, power, damage, is_critical)
|
||||||
local has_multishot_enchantment = mcl_enchanting.has_enchantment(player:get_wielded_item(), "multishot")
|
local has_multishot_enchantment = mcl_enchanting.has_enchantment(player:get_wielded_item(), "multishot")
|
||||||
local arrow_itemstring = wielditem:get_meta():get("arrow")
|
local arrow_itemstring = wielditem:get_meta():get("arrow")
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ end)
|
||||||
|
|
||||||
controls.register_on_press(function(player, key, time)
|
controls.register_on_press(function(player, key, time)
|
||||||
if key~="LMB" then return end
|
if key~="LMB" then return end
|
||||||
wielditem = player:get_wielded_item()
|
local wielditem = player:get_wielded_item()
|
||||||
if wielditem:get_name()=="mcl_bows:crossbow_loaded" or wielditem:get_name()=="mcl_bows:crossbow_loaded_enchanted" then
|
if wielditem:get_name()=="mcl_bows:crossbow_loaded" or wielditem:get_name()=="mcl_bows:crossbow_loaded_enchanted" then
|
||||||
local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name())
|
local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name())
|
||||||
local speed, damage
|
local speed, damage
|
||||||
|
|
Loading…
Reference in New Issue