forked from LizzyFleckenstein03/Memeclone
Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2
This commit is contained in:
commit
6ca5799565
|
@ -1,114 +0,0 @@
|
|||
--Dripping Water Mod
|
||||
--by kddekadenz
|
||||
|
||||
local math = math
|
||||
|
||||
-- License of code, textures & sounds: CC0
|
||||
|
||||
--Drop entities
|
||||
|
||||
--water
|
||||
|
||||
local water_tex = "default_water_source_animated.png^[verticalframe:16:0"
|
||||
minetest.register_entity("drippingwater:drop_water", {
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
collide_with_objects = false,
|
||||
collisionbox = {-0.025,-0.05,-0.025,0.025,-0.01,0.025},
|
||||
pointable = false,
|
||||
visual = "cube",
|
||||
visual_size = {x=0.05, y=0.1},
|
||||
textures = {water_tex, water_tex, water_tex, water_tex, water_tex, water_tex},
|
||||
spritediv = {x=1, y=1},
|
||||
initial_sprite_basepos = {x=0, y=0},
|
||||
static_save = false,
|
||||
on_activate = function(self, staticdata)
|
||||
self.object:set_sprite({x=0,y=0}, 1, 1, true)
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
local k = math.random(1,222)
|
||||
local ownpos = self.object:get_pos()
|
||||
if k==1 then
|
||||
self.object:set_acceleration({x=0, y=-5, z=0})
|
||||
end
|
||||
if minetest.get_node({x=ownpos.x, y=ownpos.y +0.5, z=ownpos.z}).name == "air" then
|
||||
self.object:set_acceleration({x=0, y=-5, z=0})
|
||||
end
|
||||
if minetest.get_node({x=ownpos.x, y=ownpos.y -0.5, z=ownpos.z}).name ~= "air" then
|
||||
self.object:remove()
|
||||
minetest.sound_play({name="drippingwater_drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
--lava
|
||||
|
||||
local lava_tex = "default_lava_source_animated.png^[verticalframe:16:0"
|
||||
minetest.register_entity("drippingwater:drop_lava", {
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
collide_with_objects = false,
|
||||
collisionbox = {-0.025,-0.05,-0.025,0.025,-0.01,0.025},
|
||||
glow = math.max(7, minetest.registered_nodes["mcl_core:lava_source"].light_source - 3),
|
||||
pointable = false,
|
||||
visual = "cube",
|
||||
visual_size = {x=0.05, y=0.1},
|
||||
textures = {lava_tex, lava_tex, lava_tex, lava_tex, lava_tex, lava_tex},
|
||||
spritediv = {x=1, y=1},
|
||||
initial_sprite_basepos = {x=0, y=0},
|
||||
static_save = false,
|
||||
on_activate = function(self, staticdata)
|
||||
self.object:set_sprite({x=0,y=0}, 1, 0, true)
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
local k = math.random(1,222)
|
||||
local ownpos = self.object:get_pos()
|
||||
if k == 1 then
|
||||
self.object:set_acceleration({x=0, y=-5, z=0})
|
||||
end
|
||||
if minetest.get_node({x=ownpos.x, y=ownpos.y +0.5, z=ownpos.z}).name == "air" then
|
||||
self.object:set_acceleration({x=0, y=-5, z=0})
|
||||
end
|
||||
if minetest.get_node({x=ownpos.x, y=ownpos.y -0.5, z=ownpos.z}).name ~= "air" then
|
||||
self.object:remove()
|
||||
minetest.sound_play({name="drippingwater_lavadrip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
--Create drop
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Create water drops",
|
||||
nodenames = {"group:opaque", "group:leaves"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 2,
|
||||
chance = 22,
|
||||
action = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name, "water") ~= 0
|
||||
and minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" then
|
||||
local i = math.random(-45,45) / 100
|
||||
minetest.add_entity({x=pos.x + i, y=pos.y - 0.501, z=pos.z + i}, "drippingwater:drop_water")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--Create lava drop
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Create lava drops",
|
||||
nodenames = {"group:opaque"},
|
||||
neighbors = {"group:lava"},
|
||||
interval = 2,
|
||||
chance = 22,
|
||||
action = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name, "lava") ~= 0
|
||||
and minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" then
|
||||
local i = math.random(-45,45) / 100
|
||||
minetest.add_entity({x=pos.x + i, y=pos.y - 0.501, z=pos.z + i}, "drippingwater:drop_lava")
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,66 @@
|
|||
-- Dripping Water Mod
|
||||
-- by kddekadenz
|
||||
|
||||
local math = math
|
||||
|
||||
-- License of code, textures & sounds: CC0
|
||||
|
||||
local function register_drop(liquid, glow, sound, nodes)
|
||||
minetest.register_entity("mcl_dripping:drop_" .. liquid, {
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
collide_with_objects = false,
|
||||
collisionbox = {-0.01, 0.01, -0.01, 0.01, 0.01, 0.01},
|
||||
glow = glow,
|
||||
pointable = false,
|
||||
visual = "sprite",
|
||||
visual_size = {x = 0.1, y = 0.1},
|
||||
textures = {""},
|
||||
spritediv = {x = 1, y = 1},
|
||||
initial_sprite_basepos = {x = 0, y = 0},
|
||||
static_save = false,
|
||||
_dropped = false,
|
||||
on_activate = function(self)
|
||||
self.object:set_properties({
|
||||
textures = {"[combine:2x2:" .. -math.random(1, 16) .. "," .. -math.random(1, 16) .. "=default_" .. liquid .. "_source_animated.png"}
|
||||
})
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
local k = math.random(1, 222)
|
||||
local ownpos = self.object:get_pos()
|
||||
if k == 1 then
|
||||
self.object:set_acceleration(vector.new(0, -5, 0))
|
||||
end
|
||||
if minetest.get_node(vector.offset(ownpos, 0, 0.5, 0)).name == "air" then
|
||||
self.object:set_acceleration(vector.new(0, -5, 0))
|
||||
end
|
||||
if minetest.get_node(vector.offset(ownpos, 0, -0.1, 0)).name ~= "air" then
|
||||
local ent = self.object:get_luaentity()
|
||||
if not ent._dropped then
|
||||
ent._dropped = true
|
||||
minetest.sound_play({name = "drippingwater_" .. sound .. "drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true)
|
||||
end
|
||||
if k < 3 then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
minetest.register_abm({
|
||||
label = "Create drops",
|
||||
nodenames = nodes,
|
||||
neighbors = {"group:" .. liquid},
|
||||
interval = 2,
|
||||
chance = 22,
|
||||
action = function(pos)
|
||||
if minetest.get_item_group(minetest.get_node(vector.offset(pos, 0, 1, 0)).name, liquid) ~= 0
|
||||
and minetest.get_node(vector.offset(pos, 0, -1, 0)).name == "air" then
|
||||
local x, z = math.random(-45, 45) / 100, math.random(-45, 45) / 100
|
||||
minetest.add_entity(vector.offset(pos, x, -0.520, z), "mcl_dripping:drop_" .. liquid)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
register_drop("water", 1, "", {"group:opaque", "group:leaves"})
|
||||
register_drop("lava", math.max(7, minetest.registered_nodes["mcl_core:lava_source"].light_source - 3), "lava", {"group:opaque"})
|
|
@ -1,4 +1,4 @@
|
|||
name = drippingwater
|
||||
name = mcl_dripping
|
||||
author = kddekadenz
|
||||
description = Drops are generated rarely under solid nodes
|
||||
depends = mcl_core
|
|
@ -1,12 +1,12 @@
|
|||
Dripping Water Mod
|
||||
Dripping Mod
|
||||
by kddekadenz
|
||||
|
||||
modified for MineClone 2 by Wuzzy
|
||||
modified for MineClone 2 by Wuzzy and NO11
|
||||
|
||||
|
||||
Installing instructions:
|
||||
|
||||
1. Copy the drippingwater mod folder into games/gamemode/mods
|
||||
1. Copy the mcl_dripping mod folder into games/gamemode/mods
|
||||
|
||||
2. Start game and enjoy :)
|
||||
|
|
@ -215,7 +215,9 @@ lightning.register_on_strike(function(pos, pos2, objects)
|
|||
posadd = { x=math.cos(angle),y=0,z=math.sin(angle) }
|
||||
posadd = vector.normalize(posadd)
|
||||
local mob = add_entity(vector.add(pos2, posadd), "mobs_mc:skeleton")
|
||||
mob:set_yaw(angle-math.pi/2)
|
||||
if mob then
|
||||
mob:set_yaw(angle-math.pi/2)
|
||||
end
|
||||
angle = angle + (math.pi*2) / 3
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local F = minetest.formspec_escape
|
||||
local C = minetest.colorize
|
||||
|
||||
-- Prepare player info table
|
||||
local players = {}
|
||||
|
@ -289,6 +290,19 @@ filtername["inv"] = S("Survival Inventory")
|
|||
bg["default"] = dark_bg
|
||||
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)
|
||||
--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]"
|
||||
end
|
||||
|
||||
local stack_size = get_stack_size(player)
|
||||
|
||||
-- Survival inventory slots
|
||||
main_list = "list[current_player;main;0,3.75;9,3;9]"..
|
||||
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
|
||||
"image_button[9,4;1,1;mcl_achievements_button.png;__mcl_achievements;]"..
|
||||
--"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
|
||||
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
|
||||
set_inv_search(string.lower(fields.search),player)
|
||||
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
|
||||
|
||||
if page then
|
||||
|
@ -667,3 +693,11 @@ minetest.register_on_joinplayer(function(player)
|
|||
init(player)
|
||||
mcl_inventory.set_creative_formspec(player, 0, 1, nil, false, "nix", "")
|
||||
end)
|
||||
|
||||
minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info)
|
||||
local stack = inventory_info.stack
|
||||
local item = stack:get_name()
|
||||
if minetest.is_creative_enabled(player:get_player_name()) and action == "put" and inventory_info.listname == "main" and get_stack_size(player) == 64 and not item:find("mcl_enchanting:book_enchanted") then
|
||||
player:get_inventory():set_stack("main", inventory_info.index, item .. " " .. stack:get_stack_max())
|
||||
end
|
||||
end)
|
|
@ -92,7 +92,7 @@ local function get_arrow(player)
|
|||
return arrow_stack, arrow_stack_id
|
||||
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 arrow_itemstring = wielditem:get_meta():get("arrow")
|
||||
|
||||
|
@ -286,7 +286,7 @@ end)
|
|||
|
||||
controls.register_on_press(function(player, key, time)
|
||||
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
|
||||
local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name())
|
||||
local speed, damage
|
||||
|
|
Loading…
Reference in New Issue