clothes, climate, fire
|
@ -72,6 +72,12 @@ https://github.com/minetest/minetest/blob/master/LICENSE.txt
|
|||
- License: This work is licensed under the Attribution 4.0 License.
|
||||
- Site: https://freesound.org/people/eardeer/sounds/402005/
|
||||
|
||||
## sound_grass_footstep.1.ogg
|
||||
- Mod: sound
|
||||
- Author: Nox_Sound
|
||||
- License: This work is licensed under the Creative Commons 0 License.
|
||||
- Site: https://freesound.org/people/Nox_Sound/sounds/546604/
|
||||
|
||||
# Other Licenses
|
||||
|
||||
Read inside the mods to further info.
|
||||
|
@ -95,3 +101,5 @@ Read inside the mods to further info.
|
|||
## "playerphysics" mod
|
||||
|
||||
- License: This mod is free software, released under the MIT License.
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#Sizes
|
||||
|
||||
chat_font_size = 30
|
||||
|
||||
player_transfer_distance = 60
|
||||
# Temperature variation for biomes.
|
||||
# type: noise_params_2d
|
||||
mg_biome_np_heat = {
|
||||
offset = 50,
|
||||
scale = 50,
|
||||
scale = 10,
|
||||
spread = (384, 384, 384),
|
||||
seed = 5349,
|
||||
octaves = 3,
|
||||
|
@ -18,7 +18,7 @@ mg_biome_np_heat = {
|
|||
# type: noise_params_2d
|
||||
mg_biome_np_humidity = {
|
||||
offset = 50,
|
||||
scale = 50,
|
||||
scale = 10,
|
||||
spread = (384, 384, 384),
|
||||
seed = 842,
|
||||
octaves = 3,
|
||||
|
|
|
@ -8,6 +8,9 @@ globals = {
|
|||
"boomz",
|
||||
"bucketz",
|
||||
"chestz",
|
||||
"climaz",
|
||||
"closetz",
|
||||
"clothz",
|
||||
"decoz",
|
||||
"doorz",
|
||||
"farmz",
|
||||
|
@ -20,6 +23,8 @@ globals = {
|
|||
"itemz",
|
||||
"kitz",
|
||||
"minetest",
|
||||
"mirrorz",
|
||||
"mg_name",
|
||||
"modname",
|
||||
"nodez",
|
||||
"ladderz",
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
unused_args = false
|
||||
allow_defined_top = false
|
||||
|
||||
globals = {
|
||||
"minetest",
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
string = {fields = {"split"}},
|
||||
table = {fields = {"copy", "getn"}},
|
||||
|
||||
-- Builtin
|
||||
"vector", "ItemStack",
|
||||
"dump", "DIR_DELIM", "VoxelArea", "Settings",
|
||||
|
||||
-- MTG
|
||||
"default", "sfinv", "creative",
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
# Licenses
|
||||
|
||||
- Source code: GPLv3.
|
||||
|
||||
- Textures: CC BY-SA 4.0
|
||||
|
||||
- Sounds:
|
||||
|
||||
-- "climatez_rain.ogg"
|
||||
Author: unfa
|
||||
https://freesound.org/people/unfa/sounds/177479/
|
||||
License: This work is licensed under the Creative Commons 0 License.
|
||||
|
||||
-- "climatez_thunder.ogg"
|
||||
Author: elmoustachio
|
||||
https://freesound.org/people/elmoustachio/sounds/476735/
|
||||
License: This work is licensed under the Creative Commons 0 License.
|
||||
|
||||
# Mentions
|
||||
|
||||
- I take some code from the Weather Mod by theFox6:
|
||||
https://forum.minetest.net/viewtopic.php?t=5245
|
||||
https://github.com/theFox6/minetest_mod_weather
|
||||
|
||||
- I take some ideas from the mod:
|
||||
Regional Weather Bundle by TestificateMods
|
||||
https://forum.minetest.net/viewtopic.php?t=24569
|
|
@ -0,0 +1,29 @@
|
|||
#Climate Min Height
|
||||
climate_min_height = -10
|
||||
#Climate Max Height (normally clouds at 120)
|
||||
climate_max_height = 120
|
||||
#Chance of the a new volume climate to be created
|
||||
##in seconds
|
||||
climate_change_ratio = 600
|
||||
#Volume of the regional climates (sphere)
|
||||
climate_radius = 80
|
||||
#Average time of the climate
|
||||
climate_duration = 60
|
||||
#Random deviation for the duration
|
||||
climate_duration_random_ratio = 0.45
|
||||
#Sounds
|
||||
climate_rain_sound = true
|
||||
#Storm Chance
|
||||
##Chance of the rain being stormy
|
||||
storm_chance = 5
|
||||
##Lightning Effect
|
||||
lightning = true
|
||||
lightning_chance = 300
|
||||
thunder_sound = true
|
||||
lightning_duration = 0.15
|
||||
##Dust Screen Effect for Sandstorms
|
||||
dust_effect = true
|
||||
#Rain Tweaks
|
||||
rain_particles = 15
|
||||
rain_falling_speed = 15
|
||||
rain_sound_gain = 0.35
|
|
@ -0,0 +1,691 @@
|
|||
local modpath = ...
|
||||
climaz = {}
|
||||
climaz.wind = {}
|
||||
climaz.climates = {}
|
||||
climaz.settings = {}
|
||||
|
||||
--Settings
|
||||
|
||||
local settings = Settings(modpath .. "/climaz.conf")
|
||||
|
||||
climaz.settings = {
|
||||
climate_min_height = tonumber(settings:get("climate_min_height")),
|
||||
climate_max_height = tonumber(minetest.settings:get('climate_max_height', true)) or 120,
|
||||
climate_change_ratio = tonumber(settings:get("climate_change_ratio")),
|
||||
radius = tonumber(settings:get("climate_radius")),
|
||||
climate_duration = tonumber(settings:get("climate_duration")),
|
||||
duration_random_ratio = tonumber(settings:get("climate_duration_random_ratio")),
|
||||
climate_rain_sound = settings:get_bool("climate_rain_sound"),
|
||||
thunder_sound = settings:get_bool("thunder_sound"),
|
||||
storm_chance = tonumber(settings:get("storm_chance")),
|
||||
lightning = settings:get_bool("lightning"),
|
||||
lightning_chance = tonumber(settings:get("lightning_chance")),
|
||||
dust_effect = settings:get_bool("dust_effect"),
|
||||
rain_particles = tonumber(settings:get("rain_particles")) or 15,
|
||||
rain_falling_speed = tonumber(settings:get("rain_falling_speed")) or 15,
|
||||
lightning_duration = tonumber(settings:get("lightning_duration")) or 0.15,
|
||||
rain_sound_gain = tonumber(settings:get("rain_sound_gain")) or 0.35,
|
||||
}
|
||||
|
||||
local timer = 0 -- A timer to create climates each x seconds an for lightning too.
|
||||
|
||||
--Helper Functions
|
||||
|
||||
local function remove_table_by_key(tab, key)
|
||||
local i = 0
|
||||
local keys, values = {},{}
|
||||
for k, v in pairs(tab) do
|
||||
i = i + 1
|
||||
keys[i] = k
|
||||
values[i] = v
|
||||
end
|
||||
|
||||
while i > 0 do
|
||||
if keys[i] == key then
|
||||
table.remove(keys, i)
|
||||
table.remove(values, i)
|
||||
break
|
||||
end
|
||||
i = i - 1
|
||||
end
|
||||
|
||||
local new_tab = {}
|
||||
|
||||
for j = 1, #keys do
|
||||
new_tab[keys[j]] = values[j]
|
||||
end
|
||||
|
||||
return new_tab
|
||||
end
|
||||
|
||||
function climaz.is_inside_climate(pos)
|
||||
--This function returns the climate_id if inside
|
||||
--check altitude
|
||||
if (pos.y < climaz.settings.climate_min_height) or (pos.y > climaz.settings.climate_max_height) then
|
||||
return false, nil
|
||||
end
|
||||
--check if on water
|
||||
pos.y = pos.y + 1
|
||||
local node_name = minetest.get_node(pos).name
|
||||
if minetest.registered_nodes[node_name] and (
|
||||
minetest.registered_nodes[node_name]["liquidtype"] == "source" or
|
||||
minetest.registered_nodes[node_name]["liquidtype"] == "flowing") then
|
||||
return false, true
|
||||
end
|
||||
pos.y = pos.y - 1
|
||||
--If sphere's centre coordinates is (cx,cy,cz) and its radius is r,
|
||||
--then point (x,y,z) is in the sphere if (x−cx)2+(y−cy)2+(z−cz)2<r2.
|
||||
for i, _climate in ipairs(climaz.climates) do
|
||||
local climate_center = climaz.climates[i].center
|
||||
if climaz.settings.radius > math.sqrt((pos.x - climate_center.x)^2 +
|
||||
(pos.y - climate_center.y)^2 +
|
||||
(pos.z - climate_center.z)^2
|
||||
) then
|
||||
return i, false
|
||||
end
|
||||
end
|
||||
return false, false
|
||||
end
|
||||
|
||||
local function has_light(minp, maxp)
|
||||
local manip = minetest.get_voxel_manip()
|
||||
local e1, e2 = manip:read_from_map(minp, maxp)
|
||||
local area = VoxelArea:new{MinEdge=e1, MaxEdge=e2}
|
||||
local data = manip:get_light_data()
|
||||
local node_num = 0
|
||||
local light = false
|
||||
|
||||
for i in area:iterp(minp, maxp) do
|
||||
node_num = node_num + 1
|
||||
if node_num < 5 then
|
||||
if data[i] and data[i] == 15 then
|
||||
light = true
|
||||
break
|
||||
end
|
||||
else
|
||||
node_num = 0
|
||||
end
|
||||
end
|
||||
|
||||
return light
|
||||
end
|
||||
|
||||
local function is_on_surface(player_pos)
|
||||
local height = minetest.get_spawn_level(player_pos.x, player_pos.z)
|
||||
--minetest.chat_send_all(tostring(height))
|
||||
if not height then
|
||||
return false
|
||||
end
|
||||
if (player_pos.y + 5) >= height then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
--DOWNFALLS REGISTRATIONS
|
||||
|
||||
climaz.registered_downfalls = {}
|
||||
|
||||
local function register_downfall(name, def)
|
||||
local new_def = table.copy(def)
|
||||
climaz.registered_downfalls[name] = new_def
|
||||
end
|
||||
|
||||
register_downfall("rain", {
|
||||
min_pos = {x = -15, y = 10, z = -15},
|
||||
max_pos = {x = 15, y = 10, z = 15},
|
||||
falling_speed = climaz.settings.rain_falling_speed,
|
||||
amount = climaz.settings.rain_particles,
|
||||
exptime = 1,
|
||||
size = 1.75,
|
||||
texture = {"climaz_rain.png", "climaz_rain2.png", "climaz_rain3.png"},
|
||||
})
|
||||
|
||||
register_downfall("storm", {
|
||||
min_pos = {x = -15, y = 20, z = -15},
|
||||
max_pos = {x = 15, y = 20, z = 15},
|
||||
falling_speed = 20,
|
||||
amount = 20,
|
||||
exptime = 1,
|
||||
size = 1.5,
|
||||
texture = {"climaz_rain.png", "climaz_rain2.png", "climaz_rain3.png"},
|
||||
})
|
||||
|
||||
register_downfall("snow", {
|
||||
min_pos = {x = -15, y = 10, z= -15},
|
||||
max_pos = {x = 15, y = 10, z = 15},
|
||||
falling_speed = 5,
|
||||
amount = 10,
|
||||
exptime = 5,
|
||||
size = 1,
|
||||
texture= {"climaz_snow.png", "climaz_snow2.png", "climaz_snow3.png"},
|
||||
})
|
||||
|
||||
register_downfall("sand", {
|
||||
min_pos = {x = -20, y = -4, z = -20},
|
||||
max_pos = {x = 20, y = 4, z = 20},
|
||||
falling_speed = -1,
|
||||
amount = 25,
|
||||
exptime = 1,
|
||||
size = 4,
|
||||
texture = "climaz_sand.png",
|
||||
})
|
||||
|
||||
--WIND STUFF
|
||||
|
||||
local function create_wind()
|
||||
local wind = {
|
||||
x = math.random(0,5),
|
||||
y = 0,
|
||||
z = math.random(0,5)
|
||||
}
|
||||
return wind
|
||||
end
|
||||
|
||||
function climaz.get_player_wind(player_name)
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
local player_pos = player:get_pos()
|
||||
local climate_id = climaz.is_inside_climate(player_pos)
|
||||
if climate_id then
|
||||
return climaz.climates[climate_id].wind
|
||||
else
|
||||
return create_wind()
|
||||
end
|
||||
end
|
||||
|
||||
--LIGHTING
|
||||
|
||||
local function show_lightning(player_name)
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
local hud_id = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
text = "climaz_lightning.png",
|
||||
position = {x=0, y=0},
|
||||
scale = {x=-100, y=-100},
|
||||
alignment = {x=1, y=1},
|
||||
offset = {x=0, y=0}
|
||||
})
|
||||
--save the lightning per player, NOT per climate
|
||||
player:get_meta():set_int("climaz:lightning", hud_id)
|
||||
if climaz.settings.thunder_sound then
|
||||
minetest.sound_play("climaz_thunder", {
|
||||
to_player = player_name,
|
||||
loop = false,
|
||||
gain = 1.0,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local function remove_lightning(player_name)
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
local meta = player:get_meta()
|
||||
local hud_id = meta:get_int("climaz:lightning")
|
||||
player:hud_remove(hud_id)
|
||||
meta:set_int("climaz:lightning", -1)
|
||||
end
|
||||
|
||||
-- CLIMATE PLAYERS FUNCTIONS
|
||||
|
||||
local function get_player_climate_id(player)
|
||||
local id = player:get_meta():get_int("climaz:climate_id")
|
||||
if id == 0 then
|
||||
id = nil
|
||||
end
|
||||
return id
|
||||
end
|
||||
|
||||
local function set_player_climate_id(player_name, value)
|
||||
minetest.get_player_by_name(player_name):get_meta():set_int("climaz:climate_id", value)
|
||||
end
|
||||
|
||||
local function reset_player_climate_id(player_name)
|
||||
minetest.get_player_by_name(player_name):get_meta():set_int("climaz:climate_id", 0)
|
||||
end
|
||||
|
||||
--CLIMATE FUNCTIONS
|
||||
|
||||
local function get_id()
|
||||
local id
|
||||
--search for a free position
|
||||
for i= 1, (#climaz.climates+1) do
|
||||
if not climaz.climates[i] then
|
||||
id = i
|
||||
break
|
||||
end
|
||||
end
|
||||
return id
|
||||
end
|
||||
|
||||
local climate = {
|
||||
id = nil,
|
||||
center = {},
|
||||
players = {},
|
||||
downfall_type = "",
|
||||
wind = {},
|
||||
timer = 0,
|
||||
end_time = 0,
|
||||
|
||||
new = function(self, climate_id, player_name)
|
||||
|
||||
local new_climate = {}
|
||||
|
||||
setmetatable(new_climate, self)
|
||||
|
||||
self.__index = self
|
||||
|
||||
--Get the climate_id
|
||||
new_climate.id = climate_id
|
||||
|
||||
--program climate's end
|
||||
local climate_duration = climaz.settings.climate_duration
|
||||
local climate_duration_random_ratio = climaz.settings.duration_random_ratio
|
||||
--minetest.chat_send_all(tostring(climate_id))
|
||||
new_climate.end_time = (math.random(climate_duration - (climate_duration*climate_duration_random_ratio),
|
||||
climate_duration + (climate_duration*climate_duration_random_ratio)))
|
||||
|
||||
--Get the center of the climate
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
new_climate.center = player:get_pos()
|
||||
|
||||
--Get the downfall type
|
||||
|
||||
--Firstly get some biome data
|
||||
local biome_data = minetest.get_biome_data(new_climate.center)
|
||||
local biome_heat = biome_data.heat
|
||||
local biome_humidity = biome_data.humidity
|
||||
|
||||
local downfall_type
|
||||
|
||||
--Firstly check high
|
||||
|
||||
if minetest.get_player_by_name(player_name):get_pos().y >= mapgenz.biomes.peaky_mountain_height then
|
||||
downfall_type = "snow"
|
||||
else
|
||||
if biome_heat > 28 and biome_humidity >= 35 then
|
||||
local chance = math.random(climaz.settings.storm_chance)
|
||||
if chance == 1 then
|
||||
downfall_type = "storm"
|
||||
else
|
||||
downfall_type = "rain"
|
||||
end
|
||||
elseif biome_heat >= 50 and biome_humidity <= 20 then
|
||||
downfall_type = "sand"
|
||||
elseif biome_heat <= 28 then
|
||||
downfall_type = "snow"
|
||||
end
|
||||
end
|
||||
|
||||
if not downfall_type then --fallback
|
||||
downfall_type = "rain"
|
||||
end
|
||||
|
||||
new_climate.downfall_type = downfall_type
|
||||
|
||||
--minetest.chat_send_all("id= "..minetest.get_biome_name(biome_data.biome)..", heat="..tostring(biome_heat).. ", downfall type: "..downfall_type)
|
||||
|
||||
--Get the wind of the climate
|
||||
--Create wind
|
||||
local wind = create_wind()
|
||||
|
||||
--strong wind if a storm
|
||||
if downfall_type == "storm" then
|
||||
wind = {
|
||||
x = wind.x * 2,
|
||||
y = wind.y,
|
||||
z = wind.z * 2,
|
||||
}
|
||||
end
|
||||
|
||||
--very strong wind if a sandstorm
|
||||
if downfall_type == "sand" then
|
||||
if wind.x < 1 then
|
||||
wind.x = 1
|
||||
wind.y = 1
|
||||
end
|
||||
wind = {
|
||||
x = wind.x * 5,
|
||||
y = wind.y,
|
||||
z = wind.z * 5,
|
||||
}
|
||||
end
|
||||
|
||||
new_climate.wind = wind
|
||||
|
||||
--save the player
|
||||
self:add_player(player_name, new_climate.id, new_climate.downfall_type)
|
||||
|
||||
return new_climate
|
||||
|
||||
end,
|
||||
|
||||
on_timer = function(self)
|
||||
--minetest.chat_send_all(tostring(self.timer))
|
||||
if self.timer >= self.end_time then
|
||||
self:remove() --remove the climate
|
||||
self.timer = 0
|
||||
end
|
||||
end,
|
||||
|
||||
remove_players = function(self)
|
||||
for _player_name, _climate in pairs(self.players) do
|
||||
self:remove_player(_player_name)
|
||||
--minetest.chat_send_all(_player_name.." removed from climate")
|
||||
end
|
||||
end,
|
||||
|
||||
remove = function(self)
|
||||
--remove the players
|
||||
self:remove_players(self.id)
|
||||
--remove the climate
|
||||
climaz.climates = remove_table_by_key(climaz.climates, self.id)
|
||||
end,
|
||||
|
||||
stop = function(self)
|
||||
--remove the players
|
||||
self:remove_players(self.id)
|
||||
--remove the climate
|
||||
climaz.climates = remove_table_by_key(climaz.climates, self.id)
|
||||
end,
|
||||
|
||||
apply = function(self, _player_name)
|
||||
|
||||
local _player = minetest.get_player_by_name(_player_name)
|
||||
|
||||
local _player_pos = _player:get_pos()
|
||||
|
||||
local downfall = climaz.registered_downfalls[self.downfall_type]
|
||||
local wind_pos = vector.multiply(self.wind, -1)
|
||||
local minp = vector.add(vector.add(_player_pos, downfall.min_pos), wind_pos)
|
||||
local maxp = vector.add(vector.add(_player_pos, downfall.max_pos), wind_pos)
|
||||
|
||||
--Check if in player in interiors or not
|
||||
if not has_light(minp, maxp) then
|
||||
return
|
||||
end
|
||||
|
||||
local vel = {x = self.wind.x, y = - downfall.falling_speed, z = self.wind.z}
|
||||
local acc = {x = 0, y = 0, z = 0}
|
||||
local exp = downfall.exptime
|
||||
|
||||
local downfall_texture
|
||||
if type(downfall.texture) == "table" then
|
||||
downfall_texture = downfall.texture[math.random(#downfall.texture)]
|
||||
else
|
||||
downfall_texture = downfall.texture
|
||||
end
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = downfall.amount, time=0.5,
|
||||
minpos = minp, maxpos = maxp,
|
||||
minvel = vel, maxvel = vel,
|
||||
minacc = acc, maxacc = acc,
|
||||
minexptime = exp, maxexptime = exp,
|
||||
minsize = downfall.size, maxsize= downfall.size,
|
||||
collisiondetection = true, collision_removal = true,
|
||||
vertical = true,
|
||||
texture = downfall_texture, playername = _player_name
|
||||
})
|
||||
|
||||
--Lightning
|
||||
if self.downfall_type == "storm" and climaz.settings.lightning then
|
||||
local lightning = _player:get_meta():get_int("climaz:lightning")
|
||||
--minetest.chat_send_all(tostring(lightning))
|
||||
--minetest.chat_send_all(tonumber(timer))
|
||||
if lightning <= 0 then
|
||||
local chance = math.random(climaz.settings.lightning_chance)
|
||||
if chance == 1 then
|
||||
if is_on_surface(_player_pos) then
|
||||
show_lightning(_player_name)
|
||||
minetest.after(climaz.settings.lightning_duration, remove_lightning, _player_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if climaz.settings.climate_rain_sound
|
||||
and (self.downfall_type == "rain" or self.downfall_type == "storm") then
|
||||
local rain_sound_handle = self.players[_player_name].rain_sound_handle
|
||||
if rain_sound_handle and not(is_on_surface(_player_pos)) then
|
||||
self:stop_rain_sound(_player_name, rain_sound_handle)
|
||||
elseif not(rain_sound_handle) and is_on_surface(_player_pos) then
|
||||
self:start_rain_sound(_player_name)
|
||||
end
|
||||
end
|
||||
|
||||
--minetest.chat_send_all("Climate created by ".._player_name)
|
||||
end,
|
||||
|
||||
add_player = function(self, player_name, climate_id, downfall_type)
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
self.players[player_name] = {
|
||||
climate_id = climate_id,
|
||||
sky_color = nil,
|
||||
clouds_color = nil,
|
||||
rain_sound_handle = nil,
|
||||
hud_id = nil,
|
||||
downfall_type = downfall_type,
|
||||
}
|
||||
local downfall_sky_color, downfall_clouds_color
|
||||
|
||||
if downfall_type == "rain" or downfall_type == "storm" or downfall_type == "snow" then
|
||||
downfall_sky_color = "#808080"
|
||||
downfall_clouds_color = "#C0C0C0"
|
||||
else --"sand"
|
||||
downfall_sky_color = "#DEB887"
|
||||
downfall_clouds_color = "#DEB887"
|
||||
end
|
||||
self.players[player_name].sky_color = player:get_sky().sky_color or "#8cbafa"
|
||||
player:set_sky({
|
||||
sky_color = {
|
||||
day_sky = downfall_sky_color,
|
||||
}
|
||||
})
|
||||
self.players[player_name].clouds_color = player:get_clouds().color or "#fff0f0e5"
|
||||
player:set_clouds({
|
||||
color = downfall_clouds_color,
|
||||
})
|
||||
|
||||
if downfall_type == "sand" and climaz.settings.dust_effect then
|
||||
self.players[player_name].hud_id = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
text = "climaz_dust.png",
|
||||
position = {x=0, y=0},
|
||||
scale = {x=-100, y=-100},
|
||||
alignment = {x=1, y=1},
|
||||
offset = {x=0, y=0}
|
||||
})
|
||||
end
|
||||
|
||||
--if climaz.settings.climate_rain_sound and (downfall_type == "rain" or downfall_type== "storm")
|
||||
--and is_on_surface(player:get_pos()) then
|
||||
--self:start_rain_sound(player_name)
|
||||
--end
|
||||
|
||||
set_player_climate_id(player_name, climate_id)
|
||||
|
||||
--minetest.chat_send_all(player_name.." added to climate "..tostring(climate_id))
|
||||
end,
|
||||
|
||||
remove_climate_player_effects = function(self, player_name)
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
player:set_sky({
|
||||
sky_color = {
|
||||
day_sky = self.players[player_name].sky_color,
|
||||
}
|
||||
})
|
||||
player:set_clouds({
|
||||
color = self.players[player_name].clouds_color,
|
||||
})
|
||||
|
||||
local downfall_type = self.players[player_name].downfall_type
|
||||
|
||||
local rain_sound_handle = self.players[player_name].rain_sound_handle
|
||||
if rain_sound_handle and climaz.settings.climate_rain_sound
|
||||
and (downfall_type == "rain" or downfall_type == "storm") then
|
||||
self:stop_rain_sound(player_name, rain_sound_handle)
|
||||
end
|
||||
|
||||
if downfall_type == "sand" and climaz.settings.dust_effect then
|
||||
player:hud_remove(self[player_name].hud_id)
|
||||
end
|
||||
|
||||
local lightning = player:get_meta():get_int("climaz:lightning")
|
||||
if downfall_type == "storm" and lightning > 0 then
|
||||
remove_lightning(player_name)
|
||||
end
|
||||
end,
|
||||
|
||||
remove_player = function(self, player_name)
|
||||
self:remove_climate_player_effects(player_name)
|
||||
--remove the player-->
|
||||
self.players = remove_table_by_key(self.players, player_name)
|
||||
reset_player_climate_id(player_name)
|
||||
end,
|
||||
|
||||
start_rain_sound = function(self, player_name)
|
||||
local rain_sound_handle = minetest.sound_play("climaz_rain", {
|
||||
to_player = player_name,
|
||||
loop = true,
|
||||
gain = climaz.settings.rain_sound_gain
|
||||
})
|
||||
self.players[player_name].rain_sound_handle = rain_sound_handle
|
||||
end,
|
||||
|
||||
stop_rain_sound = function(self, player_name, rain_sound_handle)
|
||||
minetest.sound_stop(rain_sound_handle)
|
||||
self.players[player_name].rain_sound_handle = nil
|
||||
end
|
||||
|
||||
}
|
||||
|
||||
--CLIMATE CORE: GLOBALSTEP
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
timer = timer + dtime
|
||||
if timer >= 1 then
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local player_name = player:get_player_name()
|
||||
local player_pos = player:get_pos()
|
||||
local current_climate_id = get_player_climate_id(player)
|
||||
local inside_climate_id, on_water = climaz.is_inside_climate(player_pos)
|
||||
if current_climate_id then
|
||||
local _remove_player
|
||||
if on_water then
|
||||
_remove_player = true
|
||||
elseif not(current_climate_id == inside_climate_id) then --IMPORTANT: this comparation should be in this order!!!
|
||||
_remove_player = true
|
||||
--minetest.chat_send_all(player_name.." abandoned a climate")
|
||||
end
|
||||
if _remove_player then
|
||||
if climaz.climates[current_climate_id] then
|
||||
climaz.climates[current_climate_id]:remove_player(player_name)
|
||||
else
|
||||
reset_player_climate_id(player_name)
|
||||
end
|
||||
end
|
||||
elseif inside_climate_id and not(current_climate_id) then --another player enter into the climate
|
||||
local downfall_type = climaz.climates[inside_climate_id].downfall_type
|
||||
climaz.climates[inside_climate_id]:add_player(player_name, inside_climate_id, downfall_type)
|
||||
--minetest.chat_send_all(player_name.." entered into the climate")
|
||||
--minetest.chat_send_all("climate_id= "..tostring(climate_id)..", _climate?= "..tostring(_climate))
|
||||
elseif not(current_climate_id) and not(inside_climate_id) then --chance to create a climate
|
||||
local chance = math.random(climaz.settings.climate_change_ratio)
|
||||
if chance == 1 then
|
||||
local new_climate_id = get_id()
|
||||
climaz.climates[new_climate_id] = climate:new(new_climate_id, player_name)
|
||||
--minetest.chat_send_all(player_name.." created a climate id="..new_climate_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
end
|
||||
|
||||
for _id, _climate in pairs(climaz.climates) do
|
||||
--Update the climate timers
|
||||
_climate.timer = _climate.timer + dtime
|
||||
_climate:on_timer()
|
||||
for _player_name in pairs(_climate.players) do
|
||||
if minetest.get_player_by_name(_player_name) then
|
||||
_climate:apply(_player_name)
|
||||
else --remove player from climate
|
||||
remove_player(player_name, _id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
--COMMANDS
|
||||
|
||||
minetest.register_chatcommand("climaz", {
|
||||
privs = {
|
||||
server = true,
|
||||
},
|
||||
description = "Climate Functions",
|
||||
func = function(name, param)
|
||||
local subcommand, player_name
|
||||
local i = 0
|
||||
for word in string.gmatch(param, "([%a%d_-]+)") do
|
||||
if i == 0 then
|
||||
subcommand = word
|
||||
else
|
||||
player_name = word
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
if not(subcommand == "stop") and not(subcommand == "start") then
|
||||
return true, "Error: The subcomands for the climatez command are 'stop | start'"
|
||||
end
|
||||
--if subcommand then
|
||||
--minetest.chat_send_all("subcommand =".. subcommand)
|
||||
--end
|
||||
--if player_name then
|
||||
--minetest.chat_send_all("player name =".. player_name)
|
||||
--end
|
||||
if subcommand == "stop" then
|
||||
if player_name then --remove the climate only for that player
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
if player then
|
||||
local climate_id = get_player_climate_id(player)
|
||||
if climate_id then
|
||||
climaz.climates[climate_id]:remove_player(player_name)
|
||||
else
|
||||
minetest.chat_send_player(player_name, player_name .. " ".. "is not inside any climate.")
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, "The player "..player_name.." is not online.")
|
||||
end
|
||||
else
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
local climate_id = get_player_climate_id(player)
|
||||
if climate_id then
|
||||
climaz.climates[climate_id]:stop()
|
||||
else
|
||||
minetest.chat_send_player(name, "You are not inside any climate.")
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif subcommand == "start" then
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
local climate_id = get_player_climate_id(player)
|
||||
if climate_id then
|
||||
climaz.climates[climate_id]:stop()
|
||||
end
|
||||
local new_climate_id = get_id()
|
||||
climaz.climates[new_climate_id] = climate:new(new_climate_id, name)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,12 @@
|
|||
--
|
||||
-- Climatez
|
||||
-- License:GPLv3
|
||||
--
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
if mg_name ~= "v6" and mg_name ~= "singlenode" and minetest.settings:get_bool("climate_enabled", true) then
|
||||
assert(loadfile(modpath .. "/engine.lua"))(modpath)
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
name = climaz
|
||||
description = A weather mod
|
|
@ -0,0 +1 @@
|
|||
climate (Enable/disable the climate engine) bool true
|
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 224 B |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.5 KiB |
|
@ -0,0 +1,3 @@
|
|||
local modpath = ...
|
||||
|
||||
assert(loadfile(modpath .. "/api/api_container.lua"))()
|
|
@ -0,0 +1,152 @@
|
|||
closetz.container = {}
|
||||
closetz.container.open_containers = {}
|
||||
|
||||
local function get_bg(x,y,rows,columns,image)
|
||||
local out = ""
|
||||
for i=0,columns do
|
||||
out = out .."image["..x+i..","..y..";1,1;"..image.."]"
|
||||
for j = 0,rows do
|
||||
out = out .."image["..x+i..","..y+j..";1,1;"..image.."]"
|
||||
end
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
function closetz.container.get_container_formspec(pos, clicker)
|
||||
local gender = playerz.get_gender(clicker)
|
||||
--5.4--local model = playerz.get_gender_model(gender)
|
||||
local preview = playerz.compose_preview(clicker, gender)
|
||||
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
|
||||
local formspec =
|
||||
"size[8,8.25]" ..
|
||||
--5.4--"model[0,0;5,5;preview_model;"..model..";"..texture..";-10,195;;;0,79]"..
|
||||
"image[0.5,0.5;2,4;"..minetest.formspec_escape(preview).."]" ..
|
||||
"list[current_player;cloths;2.5,0.25;2,4]" ..
|
||||
get_bg(2.5,0.25,3,1,"closetz_gui_clothes_bg.png")..
|
||||
"list[nodemeta:" .. spos .. ";closet;5,0.25;3,12;]" ..
|
||||
get_bg(5,0.25,3,2,"closetz_gui_closet_bg.png")..
|
||||
"list[current_player;main;0,4.5;8,1;]" ..
|
||||
"list[current_player;main;0,5.5;8,3;8]"
|
||||
--get_bg(0,4.5,3,2,"closetz_gui_closetz_bg.png")
|
||||
--default.get_hotbar_bg(0,4.5)
|
||||
return formspec
|
||||
end
|
||||
|
||||
function closetz.container.container_lid_close(pn)
|
||||
local container_open_info = closetz.container.open_containers[pn]
|
||||
local pos = container_open_info.pos
|
||||
local sound = container_open_info.sound
|
||||
local swap = container_open_info.swap
|
||||
|
||||
closetz.container.open_containers[pn] = nil
|
||||
for k, v in pairs(closetz.container.open_containers) do
|
||||
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.after(0.2, minetest.swap_node, pos, { name = "closetz:" .. swap,
|
||||
param2 = node.param2 })
|
||||
minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
|
||||
end
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local pn = player:get_player_name()
|
||||
if closetz.container.open_containers[pn] then
|
||||
closetz.container.container_lid_close(pn)
|
||||
end
|
||||
end)
|
||||
|
||||
function closetz.container.container_lid_obstructed(pos, direction)
|
||||
if direction == "above" then
|
||||
pos = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
end
|
||||
local def = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
-- allow ladders, signs, wallmounted things and torches to not obstruct
|
||||
if def and
|
||||
(def.drawtype == "airlike" or
|
||||
def.drawtype == "signlike" or
|
||||
def.drawtype == "torchlike" or
|
||||
(def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "closetz:container" then
|
||||
return
|
||||
end
|
||||
if not player or not fields.quit then
|
||||
return
|
||||
end
|
||||
local pn = player:get_player_name()
|
||||
|
||||
if not closetz.container.open_containers[pn] then
|
||||
return
|
||||
end
|
||||
|
||||
playerz.reset_closet_context(pn)
|
||||
|
||||
closetz.container.container_lid_close(pn)
|
||||
return true
|
||||
end)
|
||||
|
||||
function closetz.register_container(name, d)
|
||||
local def = table.copy(d)
|
||||
def.drawtype = 'mesh'
|
||||
def.use_texture_alpha = true
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.is_ground_content = false
|
||||
|
||||
def.on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", d.description)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("closet", 12*1)
|
||||
end
|
||||
def.can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("closet")
|
||||
end
|
||||
def.on_rightclick = function(pos, node, clicker)
|
||||
minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos, max_hear_distance = 10})
|
||||
if not closetz.container.container_lid_obstructed(pos, "above") then
|
||||
minetest.swap_node(pos, {
|
||||
name = "closetz:" .. name .. "_open",
|
||||
param2 = node.param2 })
|
||||
end
|
||||
minetest.after(0.2, minetest.show_formspec,
|
||||
clicker:get_player_name(),
|
||||
"closetz:container", closetz.container.get_container_formspec(pos, clicker))
|
||||
local player_name = clicker:get_player_name()
|
||||
playerz.set_closet_context(player_name, pos)
|
||||
closetz.container.open_containers[player_name] = { pos = pos, sound = def.sound_close, swap = name }
|
||||
end
|
||||
def.on_blast = function(pos)
|
||||
local drops = {}
|
||||
default.get_inventory_drops(pos, "closet", drops)
|
||||
drops[#drops+1] = "closetz:" .. name
|
||||
minetest.remove_node(pos)
|
||||
return drops
|
||||
end
|
||||
|
||||
local def_opened = table.copy(def)
|
||||
local def_closed = table.copy(def)
|
||||
|
||||
def_opened.mesh = "closet_open.obj"
|
||||
def_opened.tiles = {"closetz_closet_open.png",}
|
||||
def_opened.drop = "closetz:" .. name
|
||||
def_opened.groups.not_in_creative_inventory = 1
|
||||
def_opened.can_dig = function()
|
||||
return false
|
||||
end
|
||||
def_opened.on_blast = function() end
|
||||
|
||||
minetest.register_node("closetz:" .. name, def_closed)
|
||||
minetest.register_node("closetz:" .. name .. "_open", def_opened)
|
||||
|
||||
end
|
|
@ -0,0 +1,29 @@
|
|||
local S = ...
|
||||
|
||||
closetz.register_container("closet", {
|
||||
description = S("Closet"),
|
||||
inventory_image = "closetz_closet_inv.png",
|
||||
mesh = "closet.obj",
|
||||
tiles = {
|
||||
"closetz_closet.png",
|
||||
},
|
||||
use_texture_alpha = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -1/2, -1/2, 0.062500, 1/2, 1.5, 1/2 },
|
||||
},
|
||||
sounds = sound.wood(),
|
||||
sound_open = "default_chest_open",
|
||||
sound_close = "default_chest_close",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, deco = 1},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "closetz:closet",
|
||||
type = "shaped",
|
||||
recipe = {
|
||||
{"","group:mirror",
|
||||
""},{"group:wood", "", ""},
|
||||
{"", "", ""},
|
||||
}
|
||||
})
|
|
@ -0,0 +1,18 @@
|
|||
--
|
||||
-- closetz
|
||||
-- License:GPLv3
|
||||
--
|
||||
|
||||
closetz = {}
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
--
|
||||
-- Closetz Mod
|
||||
--
|
||||
|
||||
-- Load the files
|
||||
assert(loadfile(modpath .. "/api/api.lua"))(modpath)
|
||||
assert(loadfile(modpath .. "/closet.lua"))(S)
|
|
@ -0,0 +1,2 @@
|
|||
# textdomain: closetz
|
||||
Closet=Armario ropero
|
|
@ -0,0 +1,2 @@
|
|||
name = closetz
|
||||
description = A Wardove for put/store cloths
|
|
@ -0,0 +1,13 @@
|
|||
# Blender MTL File: 'closet.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl none
|
||||
Ns 92.156863
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd /opt/minetest/games/juanchi/mods/closet/textures/closet_closet.png
|
|
@ -0,0 +1,50 @@
|
|||
# Blender v2.79 (sub 0) OBJ File: 'closet.blend'
|
||||
# www.blender.org
|
||||
mtllib closet.mtl
|
||||
o wardrove_nodebox1
|
||||
v 0.500000 -0.500000 0.062500
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v 0.500000 1.500000 0.500000
|
||||
v 0.500000 1.500000 0.062500
|
||||
v -0.500000 -0.500000 0.062500
|
||||
v -0.500000 -0.500000 0.500000
|
||||
v -0.500000 1.500000 0.500000
|
||||
v -0.500000 1.500000 0.062500
|
||||
vt 0.656250 0.179487
|
||||
vt 0.875000 0.179487
|
||||
vt 0.875000 1.000000
|
||||
vt 0.656250 1.000000
|
||||
vt 0.765625 0.179487
|
||||
vt 0.546875 0.179487
|
||||
vt 0.546875 1.000000
|
||||
vt 0.765625 1.000000
|
||||
vt 0.000000 0.179487
|
||||
vt -0.000000 1.000000
|
||||
vt 0.500000 1.000000
|
||||
vt 0.515625 0.179487
|
||||
vt 1.000000 0.179487
|
||||
vt 1.000000 1.000000
|
||||
vt 0.500000 1.000000
|
||||
vt 0.500000 0.179487
|
||||
vt 0.000000 0.000000
|
||||
vt 0.500000 0.000000
|
||||
vt 0.500000 0.179487
|
||||
vt -0.000000 0.179487
|
||||
vt 0.500000 0.179487
|
||||
vt 0.500000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn -0.5774 0.5774 0.5774
|
||||
vn -0.7071 0.7071 0.0000
|
||||
vn 0.0000 -0.0000 1.0000
|
||||
vn 0.0000 0.7071 0.7071
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
usemtl none
|
||||
s 1
|
||||
f 1/1/1 2/2/1 3/3/1 4/4/1
|
||||
f 5/5/1 6/6/1 7/7/2 8/8/3
|
||||
f 1/9/4 4/10/4 8/11/4 5/12/4
|
||||
f 2/13/4 3/14/5 7/15/2 6/16/4
|
||||
f 1/9/6 2/17/6 6/18/6 5/19/6
|
||||
f 7/20/2 3/21/5 4/22/7 8/23/3
|
|
@ -0,0 +1,13 @@
|
|||
# Blender MTL File: 'closet_open.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl none.002
|
||||
Ns 94.117647
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd /opt/minetest/games/juanchi/mods/closet/textures/closet_closet_open.png
|
|
@ -0,0 +1,86 @@
|
|||
# Blender v2.79 (sub 0) OBJ File: 'closet_open.blend'
|
||||
# www.blender.org
|
||||
mtllib closet_open.mtl
|
||||
o nodebox2.001
|
||||
v -0.312500 -0.437500 -0.500000
|
||||
v -0.312500 1.437500 -0.500000
|
||||
v -0.312500 1.437500 0.062500
|
||||
v -0.312500 -0.437500 0.062500
|
||||
v -0.375000 -0.437500 -0.500000
|
||||
v -0.375000 -0.437500 0.062500
|
||||
v -0.375000 1.437500 0.062500
|
||||
v -0.375000 1.437500 -0.500000
|
||||
v 0.500000 -0.500000 0.062500
|
||||
v 0.500000 1.500000 0.062500
|
||||
v 0.500000 1.500000 0.500000
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v -0.500000 -0.500000 0.062500
|
||||
v -0.500000 -0.500000 0.500000
|
||||
v -0.500000 1.500000 0.500000
|
||||
v -0.500000 1.500000 0.062500
|
||||
vt 0.743902 0.974359
|
||||
vt 0.743902 0.205128
|
||||
vt 0.463415 0.205128
|
||||
vt 0.463415 0.974359
|
||||
vt 0.780488 0.230769
|
||||
vt 1.000000 0.230769
|
||||
vt 1.000000 1.000000
|
||||
vt 0.780488 1.000000
|
||||
vt 0.585366 0.205128
|
||||
vt 0.560976 0.205128
|
||||
vt 0.560976 0.974359
|
||||
vt 0.585366 0.974359
|
||||
vt 0.585366 0.615385
|
||||
vt 0.585366 0.628205
|
||||
vt 0.573171 0.628205
|
||||
vt 0.573171 0.615385
|
||||
vt 0.719512 0.897436
|
||||
vt 0.451219 0.897436
|
||||
vt 0.451219 0.871795
|
||||
vt 0.719512 0.871795
|
||||
vt 0.756098 0.615385
|
||||
vt 0.756098 0.589744
|
||||
vt 0.475610 0.589744
|
||||
vt 0.475610 0.615385
|
||||
vt 0.512195 0.179487
|
||||
vt 0.512195 1.000000
|
||||
vt 0.682927 1.000000
|
||||
vt 0.682927 0.179487
|
||||
vt 0.597561 0.179487
|
||||
vt 0.426829 0.179487
|
||||
vt 0.426829 1.000000
|
||||
vt 0.597561 1.000000
|
||||
vt 0.000000 0.179487
|
||||
vt 0.390244 0.179487
|
||||
vt 0.390244 1.000000
|
||||
vt -0.000000 1.000000
|
||||
vt 0.780488 0.179487
|
||||
vt 0.780488 1.000000
|
||||
vt 0.390244 1.000000
|
||||
vt 0.390244 0.179487
|
||||
vt 0.000000 -0.000000
|
||||
vt 0.390244 0.000000
|
||||
vt 0.390244 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 0.179487
|
||||
vt 0.390244 0.179487
|
||||
vn 1.0000 -0.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 -0.0000 1.0000
|
||||
vn 0.0000 -1.0000 -0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
usemtl none.002
|
||||
s 1
|
||||
f 1/1/1 2/2/1 3/3/1 4/4/1
|
||||
f 5/5/2 6/6/2 7/7/2 8/8/2
|
||||
f 1/9/3 5/10/3 8/11/3 2/12/3
|
||||
f 4/13/4 3/14/4 7/15/4 6/16/4
|
||||
f 1/17/5 4/18/5 6/19/5 5/20/5
|
||||
f 2/21/6 8/22/6 7/23/6 3/24/6
|
||||
f 9/25/1 10/26/1 11/27/1 12/28/1
|
||||
f 13/29/2 14/30/2 15/31/2 16/32/2
|
||||
f 9/33/3 13/34/3 16/35/3 10/36/3
|
||||
f 12/37/4 11/38/4 15/39/4 14/40/4
|
||||
f 9/33/5 12/41/5 14/42/5 13/34/5
|
||||
f 10/43/6 16/44/6 15/45/6 11/46/6
|
After Width: | Height: | Size: 766 B |
After Width: | Height: | Size: 603 B |
After Width: | Height: | Size: 821 B |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 6.6 KiB |
|
@ -0,0 +1,114 @@
|
|||
--
|
||||
-- Clothz
|
||||
-- License:GPLv3
|
||||
--
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
--Gray Hoodie
|
||||
|
||||
playerz.register_cloth("clothz:gray_hoodie", {
|
||||
description = S("Gray Hoodie"),
|
||||
texture = "clothz_gray_hoodie.png",
|
||||
inventory_image = "clothz_gray_hoodie_inv.png",
|
||||
wield_image = "clothz_gray_hoodie_inv.png",
|
||||
preview = "clothz_gray_hoodie_preview.png",
|
||||
gender = "unisex",
|
||||
groups = {cloth = 2},
|
||||
attach = "clothz:gray_hoodie_hood",
|
||||
})
|
||||
|
||||
playerz.register_cloth("clothz:gray_hoodie_hood", {
|
||||
attached = true,
|
||||
texture = "clothz_gray_hoodie_hood.png",
|
||||
groups = {cloth = 1, not_in_creative_inventory = 1},
|
||||
})
|
||||
|
||||
--Blue Jeans
|
||||
playerz.register_cloth("clothz:blue_jeans", {
|
||||
description = S("Blue Jeans"),
|
||||
texture = "clothz_blue_jeans.png",
|
||||
inventory_image = "clothz_blue_jeans_inv.png",
|
||||
wield_image = "clothz_blue_jeans_inv.png",
|
||||
preview = "clothz_blue_jeans_preview.png",
|
||||
gender = "unisex",
|
||||
groups = {cloth = 3},
|
||||
})
|
||||
|
||||
--Black Sneakers
|
||||
playerz.register_cloth("clothz:black_sneakers", {
|
||||
description = S("Black Sneakers"),
|
||||
texture = "clothz_black_sneakers.png",
|
||||
inventory_image = "clothz_black_sneakers_inv.png",
|
||||
wield_image = "clothz_black_sneakers_inv.png",
|
||||
preview = "clothz_black_sneakers_preview.png",
|
||||
gender = "unisex",
|
||||
groups = {cloth = 4},
|
||||
})
|
||||
|
||||
--Straw Hat
|
||||
playerz.register_cloth("clothz:straw_hat", {
|
||||
description = S("Straw Hat"),
|
||||
texture = "clothz_straw_hat.png",
|
||||
inventory_image = "clothz_straw_hat_inv.png",
|
||||
wield_image = "clothz_straw_hat_inv.png",
|
||||
preview = "clothz_straw_hat_preview.png",
|
||||
gender = "unisex",
|
||||
groups = {cloth = 5},
|
||||
})
|
||||
|
||||
--Red Cap
|
||||
playerz.register_cloth("clothz:red_cap", {
|
||||
description = S("Red Cap"),
|
||||
texture = "clothz_red_cap.png",
|
||||
inventory_image = "clothz_red_cap_inv.png",
|
||||
wield_image = "clothz_red_cap_inv.png",
|
||||
preview = "clothz_red_cap_preview.png",
|
||||
gender = "unisex",
|
||||
groups = {cloth = 5},
|
||||
})
|
||||
|
||||
--'Lady' Blue Hat
|
||||
playerz.register_cloth("clothz:lady_hat", {
|
||||
description = S("Lady Hat"),
|
||||
texture = "clothz_lady_hat.png",
|
||||
inventory_image = "clothz_lady_hat_inv.png",
|
||||
wield_image = "clothz_lady_hat_inv.png",
|
||||
preview = "clothz_lady_hat_preview.png",
|
||||
gender = "female",
|
||||
groups = {cloth = 5},
|
||||
})
|
||||
|
||||
--Checked Shirt
|
||||
playerz.register_cloth("clothz:checked_shirt", {
|
||||
description = S("Checked Shirt"),
|
||||
texture = "clothz_checked_shirt.png",
|
||||
inventory_image = "clothz_checked_shirt_inv.png",
|
||||
wield_image = "clothz_checked_shirt_inv.png",
|
||||
preview = "clothz_checked_shirt_preview.png",
|
||||
gender = "male",
|
||||
groups = {cloth = 2},
|
||||
})
|
||||
|
||||
--Girly Sweater
|
||||
playerz.register_cloth("clothz:girly_sweater", {
|
||||
description = S("Girly Sweater"),
|
||||
texture = "clothz_girly_sweater.png",
|
||||
inventory_image = "clothz_girly_sweater_inv.png",
|
||||
wield_image = "clothz_girly_sweater_inv.png",
|
||||
preview = "clothz_girly_sweater_preview.png",
|
||||
gender = "female",
|
||||
groups = {cloth = 2},
|
||||
})
|
||||
|
||||
--Schoolgirl Shoes
|
||||
playerz.register_cloth("clothz:schoolgirl_shoes", {
|
||||
description = S("Schoolgirl Shoes"),
|
||||
texture = "clothz_schoolgirl_shoes.png",
|
||||
inventory_image = "clothz_schoolgirl_shoes_inv.png",
|
||||
wield_image = "clothz_schoolgirl_shoes_inv.png",
|
||||
preview = "clothz_schoolgirl_shoes_preview.png",
|
||||
gender = "female",
|
||||
groups = {cloth = 4},
|
||||
})
|
|
@ -0,0 +1,10 @@
|
|||
# textdomain: clothz
|
||||
Blue Jeans=Pantalones vaqueros azules
|
||||
Black Sneakers=Zapatillas deporte negras
|
||||
Checked Shirt=Camisa de cuadros
|
||||
Girly Sweater=Suéter chavala
|
||||
Gray Hoodie=Sudadera gris con capucha
|
||||
Lady Hat=Sombrero señorita
|
||||
Red Cap=Gorra roja
|
||||
Schoolgirl Shoes=Zapatos de colegiala
|
||||
Straw Hat=Sombrero de paja
|
|
@ -0,0 +1,3 @@
|
|||
name = clothz
|
||||
description = More cool clothes
|
||||
depends = playerz
|
After Width: | Height: | Size: 514 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 496 B |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 573 B |
After Width: | Height: | Size: 502 B |
After Width: | Height: | Size: 640 B |
After Width: | Height: | Size: 575 B |
After Width: | Height: | Size: 535 B |
After Width: | Height: | Size: 571 B |
After Width: | Height: | Size: 590 B |
After Width: | Height: | Size: 522 B |
After Width: | Height: | Size: 557 B |
After Width: | Height: | Size: 531 B |
After Width: | Height: | Size: 577 B |
After Width: | Height: | Size: 533 B |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 555 B |
After Width: | Height: | Size: 516 B |
After Width: | Height: | Size: 511 B |
After Width: | Height: | Size: 524 B |
After Width: | Height: | Size: 496 B |
After Width: | Height: | Size: 536 B |
After Width: | Height: | Size: 567 B |
After Width: | Height: | Size: 510 B |
After Width: | Height: | Size: 549 B |
After Width: | Height: | Size: 549 B |
After Width: | Height: | Size: 496 B |
After Width: | Height: | Size: 6.9 KiB |
|
@ -0,0 +1,160 @@
|
|||
firez = {}
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
--Config Vars
|
||||
local timing = 1
|
||||
local extinguish_time = 2
|
||||
local node_range = 60
|
||||
|
||||
--Some Helper Functions
|
||||
local function node_can_inflamed(pos)
|
||||
if (helper.node_is_air(pos) or helper.node_is_buildable(pos))
|
||||
and helper.in_group(vector.new(pos.x, pos.y -1, pos.z), "flammable") then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--The Spreading Fire Algorithm-->
|
||||
|
||||
local function spread_fire(pos)
|
||||
--check for an empty node to spread
|
||||
local cells = {{x=0, y=0, z=-1}, {x=-1, y=0, z=0}, {x=-1, y=0, z=-1}, {x=0, y=0, z=1},
|
||||
{x=1, y=0, z=0}, {x=1, y=0, z=1}}
|
||||
local spread_cells = {}
|
||||
--check if node is empty
|
||||
for _, value in ipairs(cells) do
|
||||
local _value = {}
|
||||
_value = vector.add(pos, value)
|
||||
local inflamed = false
|
||||
if node_can_inflamed(_value) then
|
||||
inflamed = true
|
||||
else
|
||||
--checks if node up or node down
|
||||
local y_value_table = {-1, 1}
|
||||
local y_value = y_value_table[math.random(1, #y_value_table)]
|
||||
local value_1 = vector.new(_value.x, _value.y + y_value, _value.z)
|
||||
if node_can_inflamed(value_1) then
|
||||
_value = helper.table.deepcopy(value_1)
|
||||
inflamed = true
|
||||
else
|
||||
local value_2 = vector.new(_value.x, _value.y - y_value, _value.z)
|
||||
if node_can_inflamed(value_2) then
|
||||
_value = helper.table.deepcopy(value_2)
|
||||
inflamed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
if inflamed then
|
||||
spread_cells[#spread_cells+1] = _value
|
||||
end
|
||||
end
|
||||
local _spread_cells = helper.table.shuffle(spread_cells)
|
||||
if #_spread_cells > 0 then
|
||||
local spread_pos = _spread_cells[math.random(1, #_spread_cells)]
|
||||
minetest.set_node(spread_pos, {name = "firez:fire"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
local _node_range = meta:get_int("firez:node_range")
|
||||
_node_range = _node_range - 1
|
||||
minetest.get_meta(spread_pos):set_int("firez:node_range", _node_range)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--The definition of the Fire Node goes here -->
|
||||
|
||||
local function extinguish_fire(pos)
|
||||
helper.set_to_air(pos)
|
||||
end
|
||||
|
||||
minetest.register_node("firez:fire", {
|
||||
description = S("Fire"),
|
||||
drawtype = "nodebox",
|
||||
node_box = helper.nodebox.fire,
|
||||
inventory_image = "firez_fire.png",
|
||||
wield_image = "firez_fire.png",
|
||||
tiles = {{
|
||||
name = "firez_fire_animated.png",
|
||||
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 1.0}
|
||||
}},
|
||||
use_texture_alpha = "clip",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
liquids_pointable = false,
|
||||
light_source = 12,
|
||||
groups = {fire=1, igniter=1, deco = 1, float=1},
|
||||
drop = "torchz:torch",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0.0, 0.5, 0.0, 0.0},
|
||||
{0, -0.5, -0.5, 0, 0.0, 0.5},
|
||||
}
|
||||
},
|
||||
sounds = sound.wood(),
|
||||
|
||||
damage_per_second = 2,
|
||||
floodable = true,
|
||||
on_rotate = false,
|
||||
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
helper.set_to_air(pos)
|
||||
end,
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local node_range = meta:set_int("firez:node_range", node_range)
|
||||
meta:set_int("firez:spread", 0)
|
||||
meta:set_int("firez:spread_time", extinguish_time * 0.3)
|
||||
local node_under = helper.get_node(pos, "under")
|
||||
if node_under then
|
||||
if node_under.name == "nodez:dirt_with_grass" or node_under.name == "nodez:dirt_with_snow" then
|
||||
minetest.add_node(vector.new(pos.x, pos.y-1, pos.z), {name="nodez:dirt_with_burnt_grass"})
|
||||
elseif node_under.name == "nodez:ice" then
|
||||
minetest.add_node(vector.new(pos.x, pos.y-1, pos.z), {name="nodez:water_source"})
|
||||
end
|
||||
end
|
||||
minetest.get_node_timer(pos):start(timing)
|
||||
end,
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
|
||||
if minetest.get_node_light(pos, 0.5) == 15 then --is outside?
|
||||
local climate_id = climaz.is_inside_climate(pos)
|
||||
if climate_id then
|
||||
local climate_type = climaz.climates[climate_id].downfall_type
|
||||
if climate_type == "rain" or climate_type == "storm" or climate_type == "snow" then
|
||||
extinguish_fire(pos)
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local timer = meta:get_int("firez:timer")
|
||||
local spread = helper.number_to_bool(meta:get_int("firez:spread"))
|
||||
local spread_time = meta:get_int("firez:spread_time")
|
||||
|
||||
if not(spread) and (timer >= spread_time) then
|
||||
local _node_range = meta:get_int("firez:node_range")
|
||||
if _node_range > 0 then
|
||||
if not spread_fire(pos) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
meta:set_int("firez:spread", 1)
|
||||
elseif timer >= extinguish_time then
|
||||
extinguish_fire(pos)
|
||||
return false
|
||||
end
|
||||
|
||||
meta:set_int("firez:timer", timer + 1) --by default continue timing-->
|
||||
return true
|
||||
end
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
# textdomain: firez
|
||||
Fire=Fuego
|
|
@ -0,0 +1,3 @@
|
|||
name = firez
|
||||
description = Fire!
|
||||
depends = climaz
|
After Width: | Height: | Size: 611 B |
After Width: | Height: | Size: 839 B |
|
@ -42,6 +42,7 @@ function flowerz.register_flower(name, def)
|
|||
def.groups.flower = 1
|
||||
def.groups.flora = 1
|
||||
def.groups.attached_node = 1
|
||||
def.groups.flammable = 1
|
||||
|
||||
local inventory_image = modname.."_" .. name
|
||||
if def.inv_img then
|
||||
|
@ -98,6 +99,7 @@ function flowerz.register_mushroom(name, def)
|
|||
def.groups.flora = 1
|
||||
def.groups.food = 1
|
||||
def.groups.attached_node = 1
|
||||
def.groups.flammable = 1
|
||||
|
||||
local mushroom_name = modname..":" .. name
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ minetest.register_node("flowerz:reed", {
|
|||
type = "fixed",
|
||||
fixed = {-1 / 16, -0.5, -1 / 16, 1 / 16, 0.5, 1 / 16},
|
||||
},
|
||||
groups = {snappy = 3, flammable = 2},
|
||||
groups = {snappy = 3, flammable = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
after_dig_node = function(pos, node, metadata, digger)
|
||||
|
|
|
@ -5,6 +5,8 @@ helper.table = {}
|
|||
helper.string = {}
|
||||
helper.array = {}
|
||||
|
||||
--Node Helpers
|
||||
|
||||
function helper.in_group(pos, group)
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if (not node) or (minetest.get_item_group(node.name, group) == 0) then
|
||||
|
@ -21,6 +23,20 @@ function helper.get_nodedef_field(nodename, fieldname)
|
|||
return minetest.registered_nodes[nodename][fieldname]
|
||||
end
|
||||
|
||||
function helper.get_node(pos, where)
|
||||
if where == "above" then
|
||||
pos = vector.new(pos.x, pos.y + 1, pos.z)
|
||||
elseif where == "under" then
|
||||
pos = vector.new(pos.x, pos.y - 1, pos.z)
|
||||
end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if node then
|
||||
return node
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function helper.to_clock(timeofday)
|
||||
local seconds = math.round(24000*(timeofday or minetest.get_timeofday())*3.6)
|
||||
if seconds <= 0 then
|
||||
|
@ -43,11 +59,11 @@ function helper.what_hour(timeofday)
|
|||
end
|
||||
end
|
||||
|
||||
--Air
|
||||
--Node
|
||||
|
||||
function helper.node_is_air(pos, offset)
|
||||
function helper.node_is_air(pos, y_offset)
|
||||
if offset then
|
||||
pos = vector.new(pos.x, pos.y + offset, pos.z)
|
||||
pos = vector.new(pos.x, pos.y + y_offset, pos.z)
|
||||
end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if node and helper.get_nodedef_field(node.name, "drawtype") == "airlike" then
|
||||
|
@ -57,21 +73,21 @@ function helper.node_is_air(pos, offset)
|
|||
end
|
||||
end
|
||||
|
||||
function helper.node_is_buildable(pos, offset)
|
||||
function helper.node_is_buildable(pos, y_offset)
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if offset then
|
||||
pos = vector.new(pos.x, pos.y + offset, pos.z)
|
||||
pos = vector.new(pos.x, pos.y + y_offset, pos.z)
|
||||
end
|
||||
if node and (helper.node_is_air(pos) or node.buildable_to) then
|
||||
if node and (helper.get_nodedef_field(node.name, "buildable_to") or helper.node_is_air(pos)) then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function helper.node_is_soil(pos, offset)
|
||||
function helper.node_is_soil(pos, y_offset)
|
||||
if offset then
|
||||
pos = vector.new(pos.x, pos.y + offset, pos.z)
|
||||
pos = vector.new(pos.x, pos.y + y_offset, pos.z)
|
||||
end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if node and minetest.get_item_group(node.name, "soil") >= 1 then
|
||||
|
@ -81,9 +97,9 @@ function helper.node_is_soil(pos, offset)
|
|||
end
|
||||
end
|
||||
|
||||
function helper.node_is_water(pos, offset)
|
||||
function helper.node_is_water(pos, y_offset)
|
||||
if offset then
|
||||
pos = vector.new(pos.x, pos.y + offset, pos.z)
|
||||
pos = vector.new(pos.x, pos.y + y_offset, pos.z)
|
||||
end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if node and minetest.registered_nodes[node.name]["liquidtype"] == "source" or
|
||||
|
@ -94,6 +110,31 @@ function helper.node_is_water(pos, offset)
|
|||
end
|
||||
end
|
||||
|
||||
function helper.node_is_walkable(pos)
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if node and helper.get_nodedef_field(node.name, "walkable") then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function helper.node_is_fire(pos, y_offset)
|
||||
if offset then
|
||||
pos = vector.new(pos.x, pos.y + y_offset, pos.z)
|
||||
end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if node and node.name == "firez:fire" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function helper.set_to_air(pos)
|
||||
minetest.set_node(pos, {name="air"})
|
||||
end
|
||||
|
||||
--Direction
|
||||
|
||||
function helper.get_look_yaw(pos)
|
||||
|
@ -149,6 +190,14 @@ helper.nodebox.plant = {
|
|||
}
|
||||
}
|
||||
|
||||
helper.nodebox.fire = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0.0, 0.5, 0.5, 0.0},
|
||||
{0, -0.5, -0.5, 0, 0.5, 0.5},
|
||||
}
|
||||
}
|
||||
|
||||
helper.nodebox.flat_v = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
@ -206,7 +255,6 @@ end
|
|||
|
||||
--Arrays
|
||||
|
||||
|
||||
function helper.array.search(array, value)
|
||||
for index, _value in ipairs(array) do
|
||||
if _value == value then
|
||||
|
@ -215,3 +263,18 @@ function helper.array.search(array, value)
|
|||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--Conversions
|
||||
|
||||
function helper.bool_to_number(value)
|
||||
return value == true and 1 or value == false and 0
|
||||
end
|
||||
|
||||
function helper.number_to_bool(value)
|
||||
if value > 0 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
mg_name = ...
|
||||
|
||||
--
|
||||
-- Register mapgenz.biomes.for biome API
|
||||
--
|
||||
|
@ -40,8 +42,8 @@ minetest.register_biome({
|
|||
node_dungeon_stair = "stairs:stair_cobble",
|
||||
y_max = 0,
|
||||
y_min = -255,
|
||||
heat_point = 45.5,
|
||||
humidity_point = 55.5,
|
||||
heat_point = 45,
|
||||
humidity_point = 55,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
|
@ -58,8 +60,8 @@ minetest.register_biome({
|
|||
node_dungeon_stair = "stairs:stair_cobble",
|
||||
y_max = 3,
|
||||
y_min = -255,
|
||||
heat_point = 55.2,
|
||||
humidity_point = 56.2,
|
||||
heat_point = 55,
|
||||
humidity_point = 60,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
|
@ -70,8 +72,8 @@ minetest.register_biome({
|
|||
node_dungeon_stair = "stairs:stair_cobble",
|
||||
y_max = -256,
|
||||
y_min = -31000,
|
||||
heat_point = 43.7,
|
||||
humidity_point = 40.7,
|
||||
heat_point = 43,
|
||||
humidity_point = 40,
|
||||
})
|
||||
|
||||
--Desert Biome
|
||||
|
@ -110,8 +112,8 @@ minetest.register_biome({
|
|||
node_stone = "nodez:limestone",
|
||||
y_max = mapgenz.biomes.swamp_height,
|
||||
y_min = 1,
|
||||
heat_point = 80.1,
|
||||
humidity_point = 89.1,
|
||||
heat_point = 80,
|
||||
humidity_point = 89,
|
||||
vertical_blend = 0,
|
||||
})
|
||||
|
||||
|
@ -128,7 +130,7 @@ minetest.register_biome({
|
|||
node_water_top = "nodez:water_source",
|
||||
y_max = 0,
|
||||
y_min = -5,
|
||||
heat_point = 79.1,
|
||||
humidity_point = 90.1,
|
||||
heat_point = 79,
|
||||
humidity_point = 90,
|
||||
vertical_blend = 0,
|
||||
})
|
||||
|
|
|
@ -68,6 +68,6 @@ if minetest.settings:get_bool("devtest_dungeon_stairs", false) then
|
|||
end
|
||||
end
|
||||
|
||||
assert(loadfile(modpath .. "/biomes.lua"))()
|
||||
assert(loadfile(modpath .. "/biomes.lua"))(mg_name)
|
||||
assert(loadfile(modpath .. "/ores.lua"))()
|
||||
assert(loadfile(modpath .. "/deco.lua"))()
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
--
|
||||
-- mirrorz
|
||||
-- License:GPLv3
|
||||
--
|
||||
|
||||
-- internationalization boilerplate
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
--
|
||||
-- Mirrors Mod
|
||||
--
|
||||
|
||||
minetest.register_node("mirrorz:mirror", {
|
||||
description = S("Mirror"),
|
||||
inventory_image = "mirrorz_mirror_inv.png",
|
||||
wield_image = "mirrorz_mirror_inv.png",
|
||||
tiles = {"mirrorz_mirror.png", "mirrorz_mirror.png", "mirrorz_mirror.png", "mirrorz_mirror.png",
|
||||
"mirrorz_mirror_back.png","mirrorz_mirror.png"},
|
||||
groups = {mirror = 1, cracky=1, oddly_breakable_by_hand=1, deco=1},
|
||||
sounds = sound.glass(),
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0.4375, 0.5, 0.5, 0.5 },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mirrorz:mirror",
|
||||
type = "shaped",
|
||||
recipe = {
|
||||
{"","group:glass",
|
||||
""},{"group:wood", "", ""},
|
||||
{"", "", ""},
|
||||
}
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
# textdomain: mirrorz
|
||||
Mirror=Espejo
|
||||
Copper Mirror=Espejo de cobre
|
|
@ -0,0 +1,3 @@
|
|||
name = mirrorz
|
||||
description = Mirrors
|
||||
depends = treez, nodez
|
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 641 B |
|
@ -46,13 +46,52 @@ minetest.register_node("nodez:dirt_with_grass", {
|
|||
"nodez_dirt.png",
|
||||
{name = "nodez_dirt.png^nodez_grass_side.png",
|
||||
tileable_vertical = false}},
|
||||
groups = {crumbly=3, dirt=1, soil=1},
|
||||
sounds = sound.dirt(),
|
||||
groups = {crumbly=3, dirt=1, soil=1, flammable=1},
|
||||
sounds = sound.leaves(),
|
||||
on_destruct = function(pos)
|
||||
destroy_plow(pos)
|
||||
end
|
||||
})
|
||||
|
||||
if minetest.get_modpath("firez") ~= nil then
|
||||
minetest.register_node("nodez:dirt_with_burnt_grass", {
|
||||
description = S("Dirt with Burnt Grass"),
|
||||
tiles ={"nodez_burnt_grass.png",
|
||||
"nodez_dirt.png",
|
||||
{name = "nodez_dirt.png^nodez_burnt_grass_side.png",
|
||||
tileable_vertical = false}},
|
||||
groups = {crumbly=3, dirt=1},
|
||||
sounds = sound.leaves(),
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local node_above = helper.get_node(pos, "above")
|
||||
if node_above.name == "firez:fire" then
|
||||
return true
|
||||
end
|
||||
local new_node_name
|
||||
if node_above and node_above.name == "air" then
|
||||
new_node_name = "nodez:dirt_with_grass"
|
||||
else
|
||||
new_node_name = "nodez:dirt"
|
||||
end
|
||||
minetest.add_node(pos, {name= new_node_name})
|
||||
return false
|
||||
end,
|
||||
|
||||
on_construct = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:set(60, 0)
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local node_above = helper.get_node(pos, "above")
|
||||
if node_above.name == "firez:fire" then
|
||||
minetest.set_node(vector.new(pos.x, pos.y+1, pos.z), {name = "air"})
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
--Snow
|
||||
|
||||
minetest.register_node("nodez:dirt_with_snow", {
|
||||
|
@ -155,6 +194,26 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("nodez:adobe_brick", {
|
||||
description = S("Adobe Brick"),
|
||||
inventory_image = "nodez_adobe_brick.png",
|
||||
groups = {pottery=1, build=1},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "nodez:adobe_brick",
|
||||
recipe = "nodez:adobe",
|
||||
cooktime = 3.5,
|
||||
})
|
||||
|
||||
minetest.register_node("nodez:adobe_bricks", {
|
||||
description = S("Adobe Bricks"),
|
||||
tiles ={"nodez_adobe_bricks.png"},
|
||||
groups = {crumbly = 3, pottery =1, build=1},
|
||||
sounds = sound.dirt(),
|
||||
})
|
||||
|
||||
--Mud
|
||||
|
||||
minetest.register_node("nodez:silt_with_grass", {
|
||||
|
|
|
@ -9,8 +9,26 @@ minetest.register_node("nodez:lava_flowing", {
|
|||
drawtype = "flowingliquid",
|
||||
tiles = {"nodez_lava_flowing.png"},
|
||||
special_tiles = {
|
||||
{name="nodez_lava_flowing.png", backface_culling = false},
|
||||
{name="nodez_lava_flowing.png", backface_culling = false},
|
||||
{
|
||||
name="nodez_lava_flowing.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 10,
|
||||
},
|
||||
},
|
||||
{
|
||||
name="nodez_lava_flowing.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
light_source = minetest.LIGHT_MAX,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# textdomain: nodez
|
||||
Adobe=Adobe
|
||||
Adobe Brick=Ladrillo de adobe
|
||||
Adobe Bricks=Bloque de ladrillos de adobe
|
||||
Clay=Arcilla
|
||||
Clay Brick=Ladrillo
|
||||
Clay Bricks=Bloque de ladrillos
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
name = nodez
|
||||
description = Contains basic nodes for mapgen
|
||||
depends = farmz
|
||||
optional_depends = firez
|
||||
|
|
After Width: | Height: | Size: 614 B |
After Width: | Height: | Size: 642 B |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 8.1 KiB |
|
@ -154,9 +154,8 @@ minetest.register_chatcommand("toggle_gender", {
|
|||
end
|
||||
meta:set_string("gender", new_gender)
|
||||
playerz.update_model(player, playerz.get_gender_model(new_gender), true)
|
||||
playerz.compose_model_textures(player)
|
||||
local gender_model = playerz.get_gender_model(new_gender)
|
||||
local cloth = playerz.compose_cloth(player)
|
||||
playerz.registered_models[gender_model].textures[1] = cloth
|
||||
playerz.set_textures(player, models[gender_model].textures)
|
||||
local new_gender_cap = new_gender:gsub("^%l", string.upper)
|
||||
minetest.chat_send_player(name, S("Your gender is changed to").." "..S(new_gender_cap)..".")
|
||||
|
@ -374,6 +373,13 @@ function playerz.update_model(player, model_name, force)
|
|||
playerz.set_model(player, model_name)
|
||||
end
|
||||
|
||||
function playerz.compose_model_textures(player)
|
||||
local cloth, hat = playerz.compose_cloth(player)
|
||||
local model = playerz.get_gender_model(playerz.get_gender(player))
|
||||
playerz.registered_models[model].textures[1] = cloth
|
||||
playerz.registered_models[model].textures[2] = hat or "blank.png"
|
||||
end
|
||||
|
||||
function playerz.set_textures(player, textures)
|
||||
local name = player:get_player_name()
|
||||
local model = models[playerz.get_model(player)]
|
||||
|
@ -554,10 +560,8 @@ minetest.register_globalstep(function(dtime)
|
|||
end)
|
||||
|
||||
function playerz.set_texture(player)
|
||||
local cloth = playerz.compose_cloth(player)
|
||||
local gender = playerz.get_gender(player)
|
||||
local gender_model = playerz.get_gender_model(gender)
|
||||
playerz.registered_models[gender_model].textures[1] = cloth
|
||||
playerz.compose_model_textures(player)
|
||||
local gender_model = playerz.get_gender_model(playerz.get_gender(player))
|
||||
playerz.update_model(player, gender_model, false)
|
||||
playerz.set_textures(player, models[gender_model].textures)
|
||||
end
|
||||
|
|
|
@ -26,8 +26,10 @@ function playerz.register_cloth(name, def)
|
|||
tooltip = S("Upper")
|
||||
elseif def.groups["cloth"] == 3 then
|
||||
tooltip = S("Lower")
|
||||
else
|
||||
elseif def.groups["cloth"] == 4 then
|
||||
tooltip = S("Footwear")
|
||||
elseif def.groups["cloth"] == 5 then
|
||||
tooltip = S("Hat")
|
||||
end
|
||||
tooltip = "(" .. tooltip .. ")"
|
||||
if def.gender == "male" then
|
||||
|
@ -144,7 +146,7 @@ playerz.cloth_pos = {
|
|||
function playerz.compose_cloth(player)
|
||||
local inv = player:get_inventory()
|
||||
local inv_list = inv:get_list("cloths")
|
||||
local upper_ItemStack, lower_ItemStack, footwear_ItemStack, head_ItemStack
|
||||
local upper_ItemStack, lower_ItemStack, footwear_ItemStack, head_ItemStack, hat_ItemStack
|
||||
local underwear = false
|
||||
local attached_cloth = {}
|
||||
for i = 1, #inv_list do
|
||||
|
@ -157,18 +159,20 @@ function playerz.compose_cloth(player)
|
|||
head_ItemStack = cloth_itemstack._cloth_texture
|
||||
elseif cloth_type == 2 then
|
||||
upper_ItemStack = cloth_itemstack._cloth_texture
|
||||
underwear = true
|
||||
elseif cloth_type == 3 then
|
||||
lower_ItemStack = cloth_itemstack._cloth_texture
|
||||
underwear = true
|
||||
elseif cloth_type == 4 then
|
||||
footwear_ItemStack = cloth_itemstack._cloth_texture
|
||||
elseif cloth_type == 5 then
|
||||
hat_ItemStack = cloth_itemstack._cloth_texture
|
||||
end
|
||||
if cloth_itemstack._cloth_attach then
|
||||
attached_cloth[#attached_cloth+1] = cloth_itemstack._cloth_attach
|
||||
end
|
||||
end
|
||||
if not(underwear) then
|
||||
lower_ItemStack = "cloth_lower_underwear_default.png"
|
||||
upper_ItemStack = "cloth_upper_underwear_default.png"
|
||||
end
|
||||
local _base_texture = playerz.get_base_texture_table(player)
|
||||
local base_texture = playerz.compose_base_texture(_base_texture, {
|
||||
|
@ -203,5 +207,135 @@ function playerz.compose_cloth(player)
|
|||
cloth = cloth .. ":"..playerz.cloth_pos[attached_cloth_type].."="..attached_itemstack._cloth_texture
|
||||
end
|
||||
end
|
||||
return cloth
|
||||
return cloth, hat_ItemStack
|
||||
end
|
||||
|
||||
--Appearance Form
|
||||
|
||||
local _contexts = {}
|
||||
|
||||
local function get_context(name, field)
|
||||
if not _contexts[name] then
|
||||
_contexts[name] = {}
|
||||
end
|
||||
return _contexts[name][field]
|
||||
end
|
||||
|
||||
local function set_context(name, field, value)
|
||||
if not _contexts[name] then
|
||||
_contexts[name] = {}
|
||||
end
|
||||
_contexts[name][field] = value
|
||||
end
|
||||
|
||||
function playerz.set_closet_context(player_name, pos)
|
||||
set_context(player_name, "closet", true)
|
||||
set_context(player_name, "pos", pos)
|
||||
end
|
||||
|
||||
function playerz.reset_closet_context(player_name)
|
||||
set_context(player_name, "closet", false)
|
||||
set_context(player_name, "pos", nil)
|
||||
end
|
||||
|
||||
--Appearance Inventory Page
|
||||
|
||||
sfinv.register_page("sfinv:appearance", {
|
||||
title = S("Appearance"),
|
||||
get = function(self, player, context)
|
||||
return sfinv.make_formspec(player, context, [[
|
||||
image[0.5,0.5;2,3.5;]]..minetest.formspec_escape(playerz.compose_preview(player, playerz.get_gender(player)))..[[]
|
||||
list[current_player;cloths;2.5,0.125;2,4]
|
||||
]], true)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
_contexts[player:get_player_name()] = nil
|
||||
end)
|
||||
|
||||
-- Allow only "cloth" groups to put/move
|
||||
|
||||
minetest.register_allow_player_inventory_action(function(player, action, inventory, inventory_info)
|
||||
local stack, from_inv, to_index
|
||||
if action == "move" and inventory_info.to_list == "cloths" then
|
||||
--for moving inside the 'cloths' inventory-->
|
||||
if inventory_info.from_list == inventory_info.to_list then
|
||||
return 1
|
||||
end
|
||||
--for moving items from player inventory list 'main' to 'cloths'-->
|
||||
from_inv = "main"
|
||||
to_index = inventory_info.to_index
|
||||
stack = inventory:get_stack(inventory_info.from_list, inventory_info.from_index)
|
||||
elseif action == "put" and inventory_info.listname == "cloths" then
|
||||
--for moving from node inventory 'closet' to player inventory 'cloths'
|
||||
from_inv = "closet"
|
||||
to_index = inventory_info.index
|
||||
stack = inventory_info.stack
|
||||
else
|
||||
return
|
||||
end
|
||||
if stack then
|
||||
local stack_name = stack:get_name()
|
||||
local item_group = minetest.get_item_group(stack_name , "cloth")
|
||||
if item_group == 0 then --not a cloth
|
||||
return 0
|
||||
end
|
||||
--search for another cloth of the same type
|
||||
local player_inv = player:get_inventory()
|
||||
local cloth_list = player_inv:get_list("cloths")
|
||||
for i = 1, #cloth_list do
|
||||
local cloth_name = cloth_list[i]:get_name()
|
||||
local cloth_type = minetest.get_item_group(cloth_name, "cloth")
|
||||
if cloth_type == item_group then
|
||||
if player_inv:get_stack("cloths", to_index):get_count() == 0 then --if put on an empty slot
|
||||
if from_inv == "main" then
|
||||
if player_inv:room_for_item("main", cloth_name) then
|
||||
player_inv:remove_item("cloths", cloth_name)
|
||||
player_inv:add_item("main", cloth_name)
|
||||
return 1
|
||||
end
|
||||
else --closet inventory
|
||||
local closetz_inv = minetest.get_inventory({ type="node", pos=get_context(player:get_player_name(), "pos")})
|
||||
if closetz_inv:room_for_item("closet", cloth_name) then
|
||||
player_inv:remove_item("cloths", cloth_name)
|
||||
closetz_inv:add_item("closet", cloth_name)
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end)
|
||||
|
||||
minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info)
|
||||
local update_cloths
|
||||
if (action == "move" and inventory_info.to_list == "cloths") then
|
||||
--for moving items from player inventory list 'main' to 'cloths'
|
||||
if inventory_info.from_list == inventory_info.to_list then --for moving inside the 'cloths' inventory
|
||||
update_cloths = false
|
||||
else
|
||||
update_cloths = true
|
||||
end
|
||||
elseif (action == "move" and inventory_info.to_list == "main" and inventory_info.from_list == "cloths") then
|
||||
update_cloths = true
|
||||
elseif (action == "put" or action == "take") and inventory_info.listname == "cloths" then
|
||||
update_cloths = true
|
||||
else
|
||||
return
|
||||
end
|
||||
if update_cloths then
|
||||
playerz.set_texture(player)
|
||||
local player_name = player:get_player_name()
|
||||
if get_context(player_name, "closet") then
|
||||
minetest.show_formspec(player_name,
|
||||
"closetz:container", closetz.container.get_container_formspec(get_context(player_name, "pos"), player))
|
||||
else
|
||||
sfinv.set_page(player, "sfinv:appearance")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
|