updates
This commit is contained in:
parent
cff6c8d5aa
commit
3520b15132
@ -25,4 +25,5 @@
|
||||
## Alpha v0.2.1
|
||||
|
||||
- Loot -Xeno333
|
||||
- Weather API -Xeno333
|
||||
- Weather API -Xeno333
|
||||
- Hail damage -Xeno333
|
@ -129,6 +129,7 @@ Present if `weather.is_loaded` is set to `true`.
|
||||
- `weather.default_on_change(player, name, players_weather)` Default `on_change` call back, called between every change to try to clean up.
|
||||
- `weather.register_weather(def)` Regsiter a `Weather Definition`. Note: If a on_change sets a sound it must store the handle for it in `players_weather.sound_handle` before returning. Also this function should NOT modify things that are not restored in `weather.default_on_change` (See source code.)
|
||||
- `weather.get_weather_at_pos(pos)` Return the index to weather in `weather.weathers` that matches the current global weather and local weather.
|
||||
- `weather.weather_hight` Hight of spawning for weather particles.
|
||||
|
||||
## Weather Definition
|
||||
|
||||
@ -140,7 +141,8 @@ Present if `weather.is_loaded` is set to `true`.
|
||||
max = 0
|
||||
}
|
||||
},
|
||||
on_change = function(player, name, players_weather) end, -- Code can only modify things that will be restored in weather.default_on_change or sounds.
|
||||
on_change = function(player, players_weather) end, -- Code can only modify things that will be restored in weather.default_on_change or sounds.
|
||||
on_step = function(player), -- Code that is run once per weather step (1 second)
|
||||
particlespawner =
|
||||
{
|
||||
amount = 500,
|
||||
|
@ -98,4 +98,5 @@ dofile(path.."/src/player_inv.lua")
|
||||
dofile(path.."/src/player.lua")
|
||||
dofile(path.."/src/privs.lua")
|
||||
dofile(path.."/src/achievements.lua")
|
||||
dofile(path.."/src/chat_commands.lua")
|
||||
|
||||
|
9
mods/1042_core/src/chat_commands.lua
Normal file
9
mods/1042_core/src/chat_commands.lua
Normal file
@ -0,0 +1,9 @@
|
||||
-- chat_commands.lua
|
||||
|
||||
core.register_chatcommand("killme", {
|
||||
description = "Kill slef instantly.",
|
||||
func = function(name)
|
||||
core.get_player_by_name(name):set_hp(0)
|
||||
return true
|
||||
end
|
||||
})
|
@ -1,4 +1,4 @@
|
||||
core_1042.player_huds = {} -- Needs moved to API for player tabless #fixme
|
||||
core_1042.player_huds = {}
|
||||
local player_huds = core_1042.player_huds
|
||||
local aux1_cooldown = {}
|
||||
|
||||
|
@ -285,7 +285,7 @@ core.register_node("1042_nodes:iron_nugget", {
|
||||
core_1042.register_loot({name = "1042_nodes:iron_nugget", max_count = 16})
|
||||
|
||||
|
||||
-- #FIXME
|
||||
-- #fixme
|
||||
core.register_node("1042_nodes:anvil", {
|
||||
description = "Anvil (WIP)",
|
||||
drawtype = "mesh",
|
||||
|
@ -20,6 +20,7 @@ dofile(core.get_modpath("1042_weather") .. "/weathers.lua")
|
||||
local time_between_changes = 60*5
|
||||
local time_to_next_change = 0
|
||||
local timer = 0
|
||||
local weather_hight = weather.weather_hight
|
||||
|
||||
core.register_globalstep(function(dtime)
|
||||
timer = timer + dtime
|
||||
@ -47,12 +48,16 @@ core.register_globalstep(function(dtime)
|
||||
players_weather.weather = the_weather
|
||||
end
|
||||
|
||||
if the_weather.on_step then
|
||||
the_weather.on_step(player)
|
||||
end
|
||||
|
||||
local def = the_weather.particlespawner
|
||||
if def then
|
||||
local pos = player:get_pos()
|
||||
def.pos = {
|
||||
min = vector.new(pos.x-16,pos.y+16,pos.z-16),
|
||||
max = vector.new(pos.x+16,pos.y+16,pos.z+16),
|
||||
min = vector.new(pos.x-16,pos.y+weather_hight,pos.z-16),
|
||||
max = vector.new(pos.x+16,pos.y+weather_hight,pos.z+16),
|
||||
bias = 0
|
||||
}
|
||||
def.playername = name
|
||||
@ -78,6 +83,8 @@ end)
|
||||
|
||||
core.register_chatcommand("change_weather", {
|
||||
privs = {["creative"] = true},
|
||||
params = "<weather/help>",
|
||||
description = "Change the global weather selection to param or random if none is supplied. May not be the weather desired as that depends on biome.",
|
||||
func = function(name, param)
|
||||
local index = weather.rand:next(1, #weather.weathers)
|
||||
|
||||
@ -102,4 +109,11 @@ core.register_chatcommand("change_weather", {
|
||||
weather.weather_index = index
|
||||
return true, "Setting weather to " .. weather.weathers[weather.weather_index].name
|
||||
end
|
||||
})
|
||||
|
||||
core.register_chatcommand("weather", {
|
||||
description = "Show current global weather.",
|
||||
func = function()
|
||||
return true, "Global weather is " .. weather.weathers[weather.weather_index].name
|
||||
end
|
||||
})
|
@ -41,6 +41,15 @@ weather.register_weather({
|
||||
|
||||
texture = "1042_plain_node.png^[colorize:#dddddd:144"
|
||||
},
|
||||
on_step = function(player)
|
||||
local pos = player:get_pos()
|
||||
local ray = core.raycast(vector.new(pos.x, pos.y+1, pos.z), vector.new(pos.x, pos.y+weather.weather_hight, pos.z), false, false)
|
||||
|
||||
local node = ray:next()
|
||||
if not node then
|
||||
player:set_hp(player:get_hp()-1, "Hail")
|
||||
end
|
||||
end,
|
||||
on_change = function(player, name, players_weather)
|
||||
-- Sky changes
|
||||
player:set_sun(
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
|
||||
weather.players_weather = {}
|
||||
weather.weather_hight = 16
|
||||
|
||||
core.register_on_joinplayer(function(player)
|
||||
weather.players_weather[player:get_player_name()] = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user