]> git.lizzy.rs Git - Crafter.git/commitdiff
Add in command to change weather
authoroilboi <47129783+oilboi@users.noreply.github.com>
Fri, 10 Apr 2020 19:28:18 +0000 (15:28 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Fri, 10 Apr 2020 19:28:18 +0000 (15:28 -0400)
README.md
mods/mob/movement_code.lua
mods/weather/commands.lua [new file with mode: 0644]
mods/weather/init.lua

index 0e1c3f3b96bd8609d1597248a40f7c9f8a56cb11..195d95d648ff7618280f0389e718487a4ddc1e8c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -67,6 +67,8 @@
 - Fix bed bed, boat, book, sapling, wood, minecart, rail, redstone, and boat placement
 - Add sounds to redstone dust
 - make redstone dust an attached node
+- Fixed treecaptitator not cutting down part of tree when lever is powering one of it's nodes
+- Added command for users with "server" privelage to control weather
 ---
 
 
index 8df229c5510c9b4d1f666438f58dda2a018d8565..3b6791d4a87881941dce041854f44d69e577377b 100644 (file)
@@ -45,6 +45,7 @@ pig.jump = function(self)
                                                if walkable then
                                                        local distance = vector.subtract(collision_point,pos).y-self.object:get_properties().collisionbox[2]+0.4
                                                        if distance >= -0.11 then
+                                                               print("Jumping")
                                                                local vel = self.object:get_velocity()
                                                                self.jump_timer = 0.5
                                                                self.object:add_velocity(vector.new(vel.x,5,vel.z))
diff --git a/mods/weather/commands.lua b/mods/weather/commands.lua
new file mode 100644 (file)
index 0000000..f4c982e
--- /dev/null
@@ -0,0 +1,27 @@
+minetest.register_chatcommand("weather", {
+       params = "<mobname>",
+       description = "Spawn a mob",
+       privs = {server = true},
+       func = function( name, weather)
+               if weather == "0" or weather == "clear" then
+                       weather_type = 0
+                       function_send_weather_type()
+                       update_player_sky()
+                       minetest.chat_send_all(name.." has set the weather to clear!")
+               elseif weather == "1" or weather == "snow" then
+                       weather_type = 1
+                       function_send_weather_type()
+                       minetest.chat_send_all(name.." has set the weather to snow!")
+                       update_player_sky()
+               elseif  weather == "2" or weather == "rain" then
+                       weather_type = 2
+                       function_send_weather_type()
+                       update_player_sky()
+                       minetest.chat_send_all(name.." has set the weather to rain!")
+               elseif weather == "" then
+                       minetest.chat_send_player(name, "Possible weather types are: 0,clear,1,snow,2,rain")
+               else
+                       minetest.chat_send_player(name, '"'..weather..'"'.." is not a registered weather type!")
+               end
+       end,
+})
index b31d2cf1270a1163ca11a9ed8b57135cc0457137..5ec9e95c4deb61b56fcc6da6dd384d02052fd55f 100644 (file)
@@ -1,11 +1,13 @@
 local weather_max = 2
-local weather_type = math.random(0,weather_max)
+weather_type = math.random(0,weather_max)
 local weather_timer = 0
 
+local path = minetest.get_modpath(minetest.get_current_modname())
+dofile(path.."/commands.lua")
 
 
 --this updates players skys since it cannot be done clientside
-local update_player_sky = function()
+update_player_sky = function()
        for _,player in ipairs(minetest.get_connected_players()) do
                if weather_type ~= 0 then
                        player:set_sky({
@@ -47,7 +49,7 @@ local update_player_sky = function()
 end
 
 --this tells the client mod to update the weather type
-local function_send_weather_type = function()
+function_send_weather_type = function()
        local channel = minetest.mod_channel_join("weather_type")
        channel:send_all(tostring(weather_type))
        channel:leave()