-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring:
lottpotion
: extract lord_vessels
; rewrite code. Closes
- Loading branch information
Showing
28 changed files
with
170 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
|
||
minetest.mod(function(mod) | ||
require('glasses') | ||
require('bottles') | ||
|
||
dofile(mod.path .. '/legacy.lua') | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
-- @tags: legacy | ||
|
||
minetest.register_alias('lottpotion:glass_bottle_water', 'lord_vessels:glass_bottle_water') | ||
minetest.register_alias('lottpotion:drinking_glass_water', 'lord_vessels:drinking_glass_water') | ||
|
||
-- DEFAULTS (Ghost blocks) | ||
-- похоже не было |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# textdomain: lord_vessels | ||
|
||
Glass Bottle (empty)=Glass Bottle (empty) | ||
Glass Bottle (Water)=Glass Bottle (Water) | ||
Drinking Glass (empty)=Drinking Glass (empty) | ||
Drinking Glass (Water)=Drinking Glass (Water) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# textdomain: lord_vessels | ||
|
||
Glass Bottle (empty)=Стеклянная бутыль | ||
Glass Bottle (Water)=Стеклянная бутыль с водой | ||
Drinking Glass (empty)=Стеклянный стакан | ||
Drinking Glass (Water)=Стеклянный стакан с водой |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name = lord_vessels | ||
depends = builtin, default, vessels |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
local S = minetest.get_mod_translator() | ||
|
||
local cauldron = require('cauldron.usage') | ||
|
||
|
||
minetest.override_item('vessels:glass_bottle', { | ||
selection_box = { | ||
type = 'fixed', | ||
fixed = { -0.25, -0.5, -0.25, 0.25, 0.4, 0.25 } | ||
}, | ||
on_use = function(itemstack, user, pointed_thing) | ||
local pos = pointed_thing.above | ||
if pos == nil then return itemstack end | ||
pos.y = pos.y - 1 | ||
|
||
return cauldron.fill_from(pos, itemstack, user, 'lord_vessels:glass_bottle_water') | ||
end | ||
}) | ||
|
||
local glass_bottle_water_texture = 'vessels_glass_bottle.png^lottpotion_water.png' | ||
minetest.register_node('lord_vessels:glass_bottle_water', { | ||
description = S('Glass Bottle (Water)'), | ||
drawtype = 'plantlike', | ||
tiles = { glass_bottle_water_texture }, | ||
inventory_image = glass_bottle_water_texture, | ||
wield_image = glass_bottle_water_texture, | ||
paramtype = 'light', | ||
walkable = false, | ||
selection_box = { | ||
type = 'fixed', | ||
fixed = { -0.25, -0.5, -0.25, 0.25, 0.4, 0.25 } | ||
}, | ||
groups = { vessel = 1, dig_immediate = 3, attached_node = 1 }, | ||
sounds = default.node_sound_glass_defaults(), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
local cauldron_changes = { | ||
['lottpotion:cauldron_full'] = 'lottpotion:cauldron_two_third_full', | ||
['lottpotion:cauldron_two_third_full'] = 'lottpotion:cauldron_one_third_full', | ||
['lottpotion:cauldron_one_third_full'] = 'lottpotion:cauldron_empty', | ||
} | ||
|
||
--- @param pos Position | ||
--- @param itemstack ItemStack | ||
--- @param user Player | ||
local function fill_from(pos, itemstack, user, filled_item_name) | ||
local leftover | ||
|
||
for from, to in pairs(cauldron_changes) do | ||
if (minetest.get_node(pos).name == from) then | ||
minetest.remove_node(pos) | ||
minetest.set_node(pos, { name = to }) | ||
itemstack:take_item() | ||
leftover = user:get_inventory():add_item('main', filled_item_name) | ||
if leftover then | ||
minetest.item_drop(leftover, user, pos) | ||
end | ||
return itemstack | ||
end | ||
end | ||
end | ||
|
||
|
||
return { | ||
fill_from = fill_from, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
local S = minetest.get_mod_translator() | ||
|
||
local cauldron = require('cauldron.usage') | ||
|
||
|
||
minetest.override_item('vessels:drinking_glass', { | ||
on_use = function(itemstack, user, pointed_thing) | ||
local pos = pointed_thing.above | ||
if pos == nil then return itemstack end | ||
pos.y = pos.y - 1 | ||
|
||
return cauldron.fill_from(pos, itemstack, user, 'lord_vessels:drinking_glass_water') | ||
end | ||
}) | ||
|
||
minetest.register_node('lord_vessels:drinking_glass_water', { | ||
description = S('Drinking Glass (Water)'), | ||
drawtype = 'plantlike', | ||
tiles = { 'lottpotion_glass_water.png' }, | ||
inventory_image = 'lottpotion_glass_water.png', | ||
wield_image = 'lottpotion_glass_water.png', | ||
paramtype = 'light', | ||
walkable = false, | ||
selection_box = { | ||
type = 'fixed', | ||
fixed = { -0.25, -0.5, -0.25, 0.25, 0.4, 0.25 } | ||
}, | ||
groups = { vessel = 1, dig_immediate = 3, attached_node = 1 }, | ||
sounds = default.node_sound_glass_defaults(), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
|
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.