mirror of
				https://github.com/t-affeldt/regional_weather.git
				synced 2025-10-31 16:15:30 +01:00 
			
		
		
		
	Update file structure
This commit is contained in:
		| @@ -1,5 +1,7 @@ | ||||
| if not minetest.get_modpath("lightning") then return end | ||||
|  | ||||
| local EFFECT_NAME = "regional_weather:lightning" | ||||
|  | ||||
| local LIGHTNING_CHANCE = 20 | ||||
| lightning.auto = false | ||||
|  | ||||
| @@ -42,5 +44,5 @@ local function handle_effect(player_data) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| climate_api.register_effect("regional_weather:lightning", handle_effect, "tick") | ||||
| climate_api.set_effect_cycle("regional_weather:lightning", climate_api.LONG_CYCLE) | ||||
| climate_api.register_effect(EFFECT_NAME, handle_effect, "tick") | ||||
| climate_api.set_effect_cycle(EFFECT_NAME, climate_api.LONG_CYCLE) | ||||
| @@ -1,3 +1,5 @@ | ||||
| local EFFECT_NAME = "regional_weather:speed_buff" | ||||
|  | ||||
| local function handle_effect(player_data) | ||||
| 	for playername, data in ipairs(player_data) do | ||||
| 		local player = minetest.get_player_by_name(playername) | ||||
| @@ -5,17 +7,17 @@ local function handle_effect(player_data) | ||||
| 		for weather, value in pairs(data) do | ||||
| 			product = product * value | ||||
| 		end | ||||
| 		climate_api.utility.add_physics("regional_weather:speed_buff", player, "speed", product) | ||||
| 		climate_api.utility.add_physics(EFFECT_NAME, player, "speed", product) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| local function remove_effect(player_data) | ||||
| 	for playername, data in ipairs(player_data) do | ||||
| 		local player = minetest.get_player_by_name(playername) | ||||
| 		climate_api.utility.remove_physics("regional_weather:speed_buff", player, "speed") | ||||
| 		climate_api.utility.remove_physics(EFFECT_NAME, player, "speed") | ||||
| 	end | ||||
| end | ||||
|  | ||||
| climate_api.register_effect("regional_weather:speed_buff", handle_effect, "tick") | ||||
| climate_api.register_effect("regional_weather:speed_buff", remove_effect, "stop") | ||||
| climate_api.set_effect_cycle("regional_weather:speed_buff", climate_api.SHORT_CYCLE) | ||||
| climate_api.register_effect(EFFECT_NAME, handle_effect, "tick") | ||||
| climate_api.register_effect(EFFECT_NAME, remove_effect, "stop") | ||||
| climate_api.set_effect_cycle(EFFECT_NAME, climate_api.SHORT_CYCLE) | ||||
		Reference in New Issue
	
	Block a user