Initial Commit

This commit is contained in:
ROllerozxa 2025-01-07 00:48:01 +01:00
commit c2563cff2c
3 changed files with 60 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 ROllerozxa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

36
init.lua Normal file
View File

@ -0,0 +1,36 @@
local function has_cloud_control(player)
return player:get_meta():contains("clouds_enabled")
end
local function get_clouds_enabled(player)
return player:get_meta():get_int("clouds_enabled") == 1
end
local function set_clouds_enabled(player, enabled)
return player:get_meta():set_int("clouds_enabled", enabled and 1 or 0)
end
core.register_chatcommand("toggle_clouds", {
params = "",
description = "Toggle clouds on or off for yourself",
func = function(name)
local player = core.get_player_by_name(name)
local clouds_enabled = get_clouds_enabled(player)
local new_state = not clouds_enabled
set_clouds_enabled(player, new_state)
player:set_sky{clouds = new_state}
return true,
"Clouds have been " .. (new_state and "enabled" or "disabled") .. "."
end,
})
core.register_on_joinplayer(function(player)
if has_cloud_control(player) then
player:set_sky{ clouds = get_clouds_enabled(player) }
end
end)

3
mod.conf Normal file
View File

@ -0,0 +1,3 @@
title = Cloud Control
name = cloud_control
description = Control whether clouds are enabled on per-player basis