Compare commits

..

153 Commits

Author SHA1 Message Date
teknomunk f694698b7e Add back shift+punch to immediately drop minecart 2024-10-11 11:22:23 +02:00
teknomunk 4cc54be316 Fix another crash, fix rail tee on texture 2024-10-11 11:22:23 +02:00
teknomunk e61c86c41b Calculate acceleration of trains based on average of acceleration for all carts in the train, make velocity not change on slopes and 45 degree track 2024-10-11 11:22:23 +02:00
teknomunk 212533a561 Prevent trains from slowing on 45 degree track 2024-10-11 11:22:23 +02:00
teknomunk a04969d929 Add guard that prevents crash when itemstack is nil 2024-10-11 11:22:23 +02:00
teknomunk ca5f80a73a Silence debug prints and logging 2024-10-11 11:22:23 +02:00
teknomunk 18c2c23923 Prevent removal of old minecarts 2024-10-11 11:22:23 +02:00
teknomunk 34d13ae59f Add legacy node conversion to vl_legacy and update rails.lua to use it 2024-10-11 11:22:23 +02:00
teknomunk 58cf52bb9e Make activated tnt minecarts glow in the dark, fix crash with lit tnt minecarts 2024-10-11 11:22:23 +02:00
teknomunk ad6a9c7c64 Fix a couple of crashes (TNT minecart trying to update orientation after exploding, trying to punch/push a minecart not on track) 2024-10-11 11:22:23 +02:00
teknomunk 3ac122e2d7 Expand mcl_util.hopper_pull() to mcl_util.hopper_pull_to_inventory() 2024-10-11 11:22:23 +02:00
teknomunk b4e453a634 Add profiling code to force_get_node() 2024-10-11 11:22:23 +02:00
teknomunk fd81e9ff76 Address additional review comments 2024-10-11 11:22:23 +02:00
teknomunk e867617b5a Update API documentation to always use , add compatibility shim to mcl_minecarts.is_rail() and mcl_minecarts.ge_rail_direction() 2024-10-11 11:22:23 +02:00
teknomunk 5e84441870 Rewrite mcl_util.hopper_pull in terms of mcl_util.hopper_pull_to_inventory 2024-10-11 11:22:23 +02:00
teknomunk 568abeddac Correct documentation per review 2024-10-11 11:22:23 +02:00
teknomunk c065f2997b Switch over to using vl_legacy for item conversion in player inventories 2024-10-11 11:22:23 +02:00
teknomunk 701bfae3dd Fix typo 2024-10-11 11:22:23 +02:00
teknomunk 042eb0e62b Register rail conversions 2024-10-11 11:22:23 +02:00
teknomunk 99296d1f42 Implement vl_legacy deprecated function and item conversion APIs 2024-10-11 11:22:23 +02:00
teknomunk e07f6f3d42 Fix crashes 2024-10-11 11:22:23 +02:00
teknomunk 14489a8c4d Make old rails have a drawtype, make update lbm always run 2024-10-11 11:22:23 +02:00
teknomunk 51c7056678 Move the various rails to their own files, code cleanup 2024-10-11 11:22:23 +02:00
teknomunk 1de0382426 Remove undefined global for optional environmental physics 2024-10-11 11:22:23 +02:00
teknomunk 97adcc4f43 Remove Emerge-0 warning that occurs when placing mineshafts 2024-10-11 11:22:23 +02:00
teknomunk 4e05dfad36 Restore 45 degree cart movement, remove warning about unknown global 2024-10-11 11:22:23 +02:00
teknomunk f9dd784fd6 Complete rework of curve/tee rail direction functions 2024-10-11 11:22:23 +02:00
teknomunk 98f980128c Rework rail_dir_curve to significantly reduce code size 2024-10-11 11:22:23 +02:00
teknomunk 9d226c8997 Convert curved rails direction code to use fourdir 2024-10-11 11:22:23 +02:00
teknomunk 64691b989d Change verticle offset for testing reattaching to rail to 0.55, which is a bit more than the stair step height 2024-10-11 11:22:23 +02:00
teknomunk fb8e9d0b1b Fix cart detaching without unregistering from everything 2024-10-11 11:22:23 +02:00
teknomunk 686c1fb604 Fix typo, set use_texture_alpha = clip for all rail 2024-10-11 11:22:23 +02:00
teknomunk 1d1e3a00ae Fix several undefined global warnings, fix cart movement when over maximum speed, fix cart reattachment to sloped track 2024-10-11 11:22:23 +02:00
teknomunk f60e528614 Revert changed made to debug minecart-updates integration into tsm_railcorridors 2024-10-11 11:22:23 +02:00
teknomunk 36883fbde5 Make punch move minecarts a little, comment out more debug prints 2024-10-11 11:22:23 +02:00
teknomunk 8bea1b5250 Fix visual artifacts on the sides of rails 2024-10-11 11:22:23 +02:00
teknomunk 7ed3723a55 Stop carts from reversing when they stop, make stopped carts try to start moving in the direction the player is facing 2024-10-11 11:22:23 +02:00
teknomunk b3ade392bd Fix crash after entering a minecart not on rails 2024-10-11 11:22:23 +02:00
teknomunk 3388ef08cf Fix placed rail conversion, start automatic inventory rail conversion 2024-10-11 11:22:23 +02:00
teknomunk 9eb66743ae Fix players repelling carts with new player metadata system 2024-10-11 11:22:23 +02:00
teknomunk 7a2cd02369 Cleanup debug prints 2024-10-11 11:22:23 +02:00
teknomunk 678a635836 Add documentation for newly exposed attach_driver 2024-10-11 11:22:23 +02:00
teknomunk e2d920003a Add persistent player-specific metadata into mcl_playerinfo, simple cart reattachment (only exists if the luaentity for the cart exists when the player logs in) 2024-10-11 11:22:23 +02:00
teknomunk ab73d4249e More fixes for minecart-hopper movement 2024-10-11 11:22:23 +02:00
teknomunk 2dd9cd434c Get rail placement creating corners that lead into a downward sloped rail 2024-10-11 11:22:23 +02:00
teknomunk fd6ecf84d3 Create mcl_util.metadata_timer, fix crashes, add checks to prevent hoppers from pulling from carts that are not in the square above it 2024-10-11 11:22:23 +02:00
teknomunk 94b8c7fdf1 Fix hopper-minecart interaction, convert ipairs(table) to use for i=1,#table instead 2024-10-11 11:22:23 +02:00
teknomunk 87ba7c6535 Update mineshafts for new rail and minecarts, add loot to generated chest and hopper minecarts (and remove notes about a hack) 2024-10-11 11:22:23 +02:00
teknomunk 3fc35d1ea4 Give carts a small vertical lift when pushed to allow them to get back on rails 2024-10-11 11:22:23 +02:00
teknomunk 57080d0a3d Stop rail from being placed directly above rail (floating in air) 2024-10-11 11:22:23 +02:00
teknomunk 645d1a9f5b Fix sloped power,activator and detector rails, remove debug print 2024-10-11 11:22:23 +02:00
teknomunk 7c4dd8a4be Modify mcl_entity_invs to add support for save/load items hooks in entities, add save/load hooks to minecarts to store item list in the minecart data and not in the entity data so that respawn doesn't destroy items 2024-10-11 11:22:23 +02:00
teknomunk 30ae3000b9 Add documentation on the rail 2024-10-11 11:22:23 +02:00
teknomunk 1e39bf641a Add documentation on file structure and overviewes of each file 2024-10-11 11:22:23 +02:00
teknomunk 4601df5b84 Fix crashes, fix link in documentation 2024-10-11 11:22:23 +02:00
teknomunk e7b8214acf More documentation, add myself to copyright list in README.txt 2024-10-11 11:22:23 +02:00
teknomunk a5d510b95d More minor changes to API.md, start overall implementation documentation 2024-10-11 11:22:23 +02:00
teknomunk dc815e1873 Fix table of contents 2024-10-11 11:22:23 +02:00
teknomunk 542bae8417 Finish writing API documentation, remove drop_railcarts (replaced by try_detach_minecart), rename constants to ALL CAPS for consistency, change mcl_minecarts. to mod. for API function definitions 2024-10-11 11:22:23 +02:00
teknomunk 2f950a2974 Nearly finish API documentation, create mcl_minecarts.add_blocks_to_map() 2024-10-11 11:22:23 +02:00
teknomunk ff6badbcd0 Continue writing API documentation, update call signatures for a couple of API functions 2024-10-11 11:22:23 +02:00
teknomunk c77e3d0c26 Change document formatting, finally move cactus cart dropping to node definition for mcl_core:cactus 2024-10-11 11:22:23 +02:00
teknomunk 2aed569b85 Correct crashes/item duplication with dropping carts, start API documentation 2024-10-11 11:22:23 +02:00
teknomunk e136489339 Fix cart controls, cart pushing 2024-10-11 11:22:23 +02:00
teknomunk a71ad474f9 Fix typo in rail replacement mapping, fix several crashes 2024-10-11 11:22:23 +02:00
teknomunk 94cd9dbc73 Implement movement thru tee rails 2024-10-11 11:22:23 +02:00
teknomunk 54a73b76e7 Tune respawn distance limit 2024-10-11 11:22:23 +02:00
teknomunk cdce542f16 Fix crashes 2024-10-11 11:22:23 +02:00
teknomunk d1daed118a Remove memory leak for cart data, check distance to players before respawning distant carts to prevent adding entities that are immediately inactivated 2024-10-11 11:22:23 +02:00
teknomunk 6f951000ae Implement offline/out of range minecart movement and fix minecart respawning, remove railtype tracking 2024-10-11 11:22:23 +02:00
teknomunk 81664096ca Remove do_movement dependency on the existence of a cart luaentity 2024-10-11 11:22:23 +02:00
teknomunk 435cd88ceb Fix undefined global warning, move player off to the side of a cart when dismounting so trains don't get pushed apart when getting out 2024-10-11 11:22:23 +02:00
teknomunk a68e973cac Make trains containing a player in a minecart function, minor cleanup in mcl_playerinfo 2024-10-11 11:22:23 +02:00
teknomunk 65c5f30e32 Fix crashes in train logic, allow breaking apart trains 2024-10-11 11:22:23 +02:00
teknomunk f3d4e96c83 Implement train reversing 2024-10-11 11:22:23 +02:00
teknomunk 4e1fac94d0 Repair vectors in cart data, mostly fix train movement bugs (still possible to have a furnace minecart flip, without the train also flipping) 2024-10-11 11:22:23 +02:00
teknomunk 58a2858ab2 Add cart entity respawn/destroy to match cart data (partially working) 2024-10-11 11:22:23 +02:00
teknomunk 9e63976f37 Give furnace minecart minimum velocity when lit, add train separation code, update logging code, add sequence number to entity staticdata to allow respawn/despawn when carts move when the entity is unloaded 2024-10-11 11:22:23 +02:00
teknomunk d1782923ae Fix rail detach crash, make tnt minecarts explode if they hit something hard (off rails) 2024-10-11 11:22:23 +02:00
teknomunk 10a9c932c3 Make sure carts get detatch if the rail under them is removed 2024-10-11 11:22:23 +02:00
teknomunk 74e3f4c9c8 Fixish reorganizing, initial train implementation 2024-10-11 11:22:23 +02:00
teknomunk dcce34871b Major reorganization, start setup for trains 2024-10-11 11:22:23 +02:00
teknomunk 7c5f2f4dfb Make sure carts that collide move in the same direction the colliding cart was 2024-10-11 11:22:23 +02:00
teknomunk 74791e7219 Add utilities to convert between an ObjectRef, it's active object id and a 128bit uuid, move minecart data from entity staticdata to mod storage to eventually allow updating carts when out of range of players and also track what carts are alive, implement on-rail cart collisions 2024-10-11 11:22:23 +02:00
teknomunk af9e01350e Harden against unknown nodes 2024-10-11 11:22:23 +02:00
teknomunk da674131ec Allow players to push minecarts that are not on track 2024-10-11 11:22:23 +02:00
teknomunk 34de252d97 Fix rails in creative inventory, make minecart with tnt not crash server when exploding, make minecart with tnt slightly more powerful than regular tnt 2024-10-11 11:22:23 +02:00
teknomunk ead9da6d14 Fix rail movement regressions 2024-10-11 11:22:23 +02:00
teknomunk 4879899e06 Move cart code to its own file, more code cleanup, add aliases for old track items 2024-10-11 11:22:23 +02:00
teknomunk 2f4ac9a02d Cleanup code, restore uphill/downhill cart movement, completely remove old rail 2024-10-11 11:22:23 +02:00
teknomunk 17a27e9169 Get rail reattachment (especially after jumps) working correctly 2024-10-11 11:22:23 +02:00
teknomunk b356da9472 Make legacy rail update apply to all old rail types, add basic detached railcart physics with a stub to use mcl_physics when it gets merged 2024-10-11 11:22:23 +02:00
teknomunk 9524b8313a Silence unmaskable print statements 2024-10-11 11:22:23 +02:00
teknomunk 4b66ae64eb Add immortal item entity support, add legacy rail conversion that uses immortal item drops for corners/tees/crosses that are no longer possible 2024-10-11 11:22:23 +02:00
teknomunk d4234f0c4d Fix more rail connection bugs 2024-10-11 11:22:23 +02:00
teknomunk d8ea7659f2 Get sloped connections working correctly 2024-10-11 11:22:23 +02:00
teknomunk 299a6c4177 Re-enable rule for powering rail from underneath, have stairs block minecart movement, fix crash when lightning strikes a minecart 2024-10-11 11:22:23 +02:00
teknomunk 9d9a0d2faa Fix mcl_util.table_merge where a standard value overwrites a table, fix base definition usage, implement behavior difference when there is a solid block after a straight piece of track (this will eventually allow minecarts to fly off the end of the track) 2024-10-11 11:22:23 +02:00
teknomunk 5877854f3a Update all rail types to new version 2024-10-11 11:22:23 +02:00
teknomunk 659bf8fed9 Reorganize 2024-10-11 11:22:23 +02:00
teknomunk 1598f7fa80 Finish reverting 08b41a3b39 2024-10-11 11:22:23 +02:00
teknomunk 78ee4481c9 Enable new track with get_next_dir handlers 2024-10-11 11:22:23 +02:00
teknomunk da4058ad2c Change connection rules again to allow building parallel track, tees and crosses), start implementing rail rules callbacks 2024-10-11 11:22:23 +02:00
teknomunk 6a6405366a Add sloped rail 2024-10-11 11:22:23 +02:00
teknomunk bcbb319129 Fix rail visuals, add switch operation 2024-10-11 11:22:23 +02:00
teknomunk 68f7eb509a Implement initial rail connection logic (no vertical track yet), experiment with texture modifiers and gravel underlay for display (not working) 2024-10-11 11:22:23 +02:00
teknomunk fde18b5020 Start implementing new rail nodes 2024-10-11 11:22:23 +02:00
teknomunk d5bdd46529 Implement minecart with command block 2024-10-11 11:22:23 +02:00
teknomunk d729c702f7 Create mesecons command API and modify commandblock to use it 2024-10-11 11:22:23 +02:00
teknomunk 960a053485 Disable punch to move minecarts, implement punch to drop minecart, enable basic cart keyboard controls (accelerate and brake) 2024-10-11 11:22:23 +02:00
teknomunk 8cfe8c8247 Remove cart oscillation when pushed 2024-10-11 11:22:23 +02:00
teknomunk 2cf5510549 Limit top speed of furnace minecarts to 4 blocks/second, limit total fuel time to 27 minutes 2024-10-11 11:22:23 +02:00
teknomunk a819d5e6da Fix bug with furnace minecart at max velocity (stopped until fuel ran out), move _fueltime into staticdata 2024-10-11 11:22:23 +02:00
teknomunk 4097c5a5d5 Fix call signature of mcl_util.hopper_pull_to_inventory, move cart-specific behaviors to _mcl_minecarts_on_step handlers, fix typo, change distance used in rail reattach code, move cart_id generation 2024-10-11 11:22:23 +02:00
teknomunk 9b0e387ffa Add groups to minecart entities (for containers), fix cart node watch handling, relocate hopper_push_to_mc in mcl_hopper/init.lua, implement hopper-to-minecart push using enter/leave hooks for both straight and bent hoppers 2024-10-11 11:22:23 +02:00
teknomunk 232769e5fb Add API function to remove node watch 2024-10-11 11:22:23 +02:00
teknomunk 55a13cba60 Refactor enter/leave hook processing, add node watches for implementing hopper-to-minecart functionality (should properly handle heavy server lag without missing any time), temporarily disable hopper push/pull to minecart in mcl_hoppers, prepare to move minecart-specific on_step behavior out of main on_step function and to a minecart-specific handler 2024-10-11 11:22:23 +02:00
teknomunk 46bb715645 Start adding hooks for implpementing minecart with command block 2024-10-11 11:22:23 +02:00
teknomunk 5871d2996a Make minecarts solid and add players pushing 2024-10-11 11:22:23 +02:00
teknomunk 7021eb3787 Fix forwards/backwars tilt in all directions 2024-10-11 11:22:23 +02:00
teknomunk f61c6a8c30 Prevent players from entering minecarts when sneaking, prevents players from causing MineClone2/MineClone2#3188 2024-10-11 11:22:23 +02:00
teknomunk a5d8fcdfc3 Increase default track friction, disable right-click to exit minecarts 2024-10-11 11:22:23 +02:00
teknomunk aa3f9dfe54 Initial tuning of acceleration/gravity, fix crash when entering an activator rail, detach mobs from cart on active activator rail, remove commented out code no longer needed 2024-10-11 11:22:23 +02:00
teknomunk 98034e25dd Move code that handles below-rail hoppers to handle_cart_enter, implement timestep-independent cart physics (will need tuning punch, power rail and gravityaccelerations to make game fun) 2024-10-11 11:22:23 +02:00
teknomunk c200ef25b4 Mostly fix carts stopping between powered rails (there is still some strangeness with acceleration physics) 2024-10-11 11:22:23 +02:00
teknomunk ca917b1d22 Fix diagonal movement 2024-10-11 11:22:23 +02:00
teknomunk 97ddc79b90 Add diagonal track movement on zig-zag track, rewrite mcl_minecarts:get_rail_direction 2024-10-11 11:22:23 +02:00
teknomunk 8e4f902371 Make TNT minecarts available in creative menu 2024-10-11 11:22:23 +02:00
teknomunk b17a5bb61d Implement custom item dropper handlers, implement droppers placing minecarts 2024-10-11 11:22:23 +02:00
teknomunk 36cfa11e71 Hopper minecarts pull from containers above rail 2024-10-11 11:22:23 +02:00
teknomunk 1d03823da3 Rework in preparation to add code to pull from containers into the hopper minecart 2024-10-11 11:22:23 +02:00
teknomunk 0575f0a1a4 Move fiction constant to top of file, suppress cart flips when direction reverses due to gravity or end of track 2024-10-11 11:22:23 +02:00
teknomunk 5b93a54a00 Add code to reattach carts to rail when data corruption occurs, fix bug in last commit that caused carts to bury into the ground 2024-10-11 11:22:23 +02:00
teknomunk 02e7bcaa1e Remove dip into the ground that occured when gravity caused the cart to reverse directions 2024-10-11 11:22:23 +02:00
teknomunk 836ecc0c92 Implement gravity, move orientation update to own function, fix cart stopping in process_acceleration 2024-10-11 11:22:23 +02:00
teknomunk 6ed22cd835 Change connected railcar behavior to fix unreliable end of track stopping, set maximum acceleration of powered rails to 8 blocks per second (per https://minecraft.fandom.com/wiki/Powered_Rail), stop powered rails from powering the block underneath it (allows below rail hopper to work while the rail is powered like in https://www.youtube.com/watch?v=szjO0-duTAk), modify mcl_hoppers to allow triggering a hopper pull once the minecart is stopped on top of the hopper and wait before allowing the cart to move to allow redstone circuits time to process 2024-10-11 11:22:23 +02:00
teknomunk 92685d615e Make minecart always stop at correct location at end of track, fix crash when placing chest minecart after changing how staticdata is handled 2024-10-11 11:22:23 +02:00
teknomunk 9cb9fe0cb4 Modify do_movement_step to move to always move to the edge of the current rail segment before updating the direction to prevent oscillations at corners, fix end of track stop location with new movement behavior, disable experimental controls, swap code to detach the driver on float with a call to detach_driver() 2024-10-11 11:22:23 +02:00
teknomunk 513cfbf115 Add DEBUG flag, stop small do_movement_step's from occuring (this improves but doesn't eliminate the bug I with the a6be179ed commit), add recovery when staticdata field gets lost 2024-10-11 11:22:23 +02:00
teknomunk 561cc43088 Fix initial_properties for minecarts 2024-10-11 11:22:23 +02:00
teknomunk 72027ff10a Change left,right and back vectors to matrix math results with no branching 2024-10-11 11:22:23 +02:00
teknomunk a333b160bb Remove now unused properties from minecart definition, convert more vectors to use vector.new syntax 2024-10-11 11:22:23 +02:00
teknomunk 727d1929bb Complete rewrite of minecart movement that resolves MineClone2/MineClone2#2446 and MineClone2/MineClone2#247 (comment) but has a bug where carts will synchronize movements that I am still investigating 2024-10-11 11:22:23 +02:00
teknomunk 7753f314f4 Change staticdata serialization (with migration from old data), disable debugging code used to investigate MineClone2/MineClone2#2446 2024-10-11 11:22:23 +02:00
teknomunk 68efb66aaf Change to vector.new from {x=...}, relocate movement code to own function for future changes 2024-10-11 11:22:23 +02:00
the-real-herowl fd6cac5f0c Merge pull request 'Fix fog tint in overworld, apply memory leak fix, fix rain->clear clouds' (#4669) from weather-fixes into master
Reviewed-on: VoxeLibre/VoxeLibre#4669
Reviewed-by: kno10 <kno10@noreply.git.minetest.land>
2024-10-11 07:14:01 +02:00
teknomunk e864cc19ed Make fog_tint_type = "default" when weather is present to match behavior at 0.87.2 2024-10-09 01:05:20 +02:00
teknomunk 66c3c014a1 Make sure fog tints are preserved during weather is present 2024-10-09 01:05:20 +02:00
teknomunk 7807093b50 Another correction to color interpolation, change day color from layer position 0.15 to 0.50 2024-10-09 01:05:20 +02:00
teknomunk f6c3f4bd16 Correct value clamping 2024-10-09 01:05:20 +02:00
teknomunk 96a03b1923 Remove posibility of nil sky colors in overworld, add line break 2024-10-09 01:05:20 +02:00
teknomunk 2145470f63 Fix clouds during rain->clear weather transition 2024-10-09 01:05:20 +02:00
teknomunk 2ca0ccd8fe Fix fog tint in overworld, apply memory leak fix from rain.lua to snow.lua and thunder.lua 2024-10-09 01:05:20 +02:00
5 changed files with 66 additions and 38 deletions

View File

@ -157,6 +157,7 @@ function mcl_weather.rain.clear()
mcl_weather.rain.remove_sound(player)
mcl_weather.rain.remove_player(player)
mcl_weather.remove_spawners_player(player)
player:set_clouds({color="#FFF0EF"})
end
end

View File

@ -2,6 +2,7 @@
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
local NIGHT_VISION_RATIO = 0.45
local DEBUG = false
-- Settings
local minimum_update_interval = { 250e3 }
@ -190,8 +191,8 @@ end
function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors)
-- Clamp current_val to valid range
current_val = math.min(minval, current_val)
current_val = math.max(maxval, current_val)
current_val = math.max(minval, current_val)
current_val = math.min(maxval, current_val)
-- Rescale current_val from a number between minval and maxval to a number between 1 and #colors
local scaled_value = (current_val - minval) / (maxval - minval) * (#colors - 1) + 1.0
@ -199,7 +200,7 @@ function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors)
-- Get the first color's values
local index1 = math.floor(scaled_value)
local color1 = colors[index1]
local frac1 = scaled_value - index1
local frac1 = 1.0 - (scaled_value - index1)
-- Get the second color's values
local index2 = math.min(index1 + 1, #colors) -- clamp to maximum color index (will occur if index1 == #colors)
@ -207,11 +208,32 @@ function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors)
local color2 = colors[index2]
-- Interpolate between color1 and color2
return {
local res = {
r = math.floor(frac1 * color1.r + frac2 * color2.r),
g = math.floor(frac1 * color1.g + frac2 * color2.g),
b = math.floor(frac1 * color1.b + frac2 * color2.b),
}
if DEBUG then
minetest.log(dump({
minval = minval,
maxval = maxval,
current_val = current_val,
colors = colors,
res = res,
scaled_value = scaled_value,
frac1 = frac1,
index1 = index1,
color1 = color1,
frac2 = frac2,
index2 = index2,
color2 = color2,
}))
end
return res
end
-- Simple getter. Either returns user given players list or get all connected players if none provided

View File

@ -40,18 +40,21 @@ function dimension_handlers.overworld(player, sky_data)
end
-- Use overworld defaults
local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15)
local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5)
local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27)
local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1)
sky_data.sky = {
type = "regular",
sky_color = {
day_sky = day_color,
day_horizon = day_color,
dawn_sky = dawn_color,
dawn_horizon = dawn_color,
night_sky = night_color,
night_horizon = night_color,
day_sky = day_color or "#7BA4FF",
day_horizon = day_color or "#C0D8FF",
dawn_sky = dawn_color or "7BA4FF",
dawn_horizon = dawn_color or "#C0D8FF",
night_sky = night_color or "000000",
night_horizon = night_color or "4A6790",
fog_sun_tint = "#ff5f33",
fog_moon_tint = nil,
fog_tint_type = "custom",
},
clouds = true,
}
@ -75,18 +78,15 @@ function dimension_handlers.overworld(player, sky_data)
local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5)
local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75)
local night_color = mcl_weather.skycolor.get_sky_layer_color(0)
sky_data.sky = {
type = "regular",
sky_color = {
day_sky = day_color,
day_horizon = day_color,
dawn_sky = dawn_color,
dawn_horizon = dawn_color,
night_sky = night_color,
night_horizon = night_color,
},
clouds = true,
}
table.update(sky_data.sky.sky_color,{
day_sky = day_color or "#7BA4FF",
day_horizon = day_color or "#C0D8FF",
dawn_sky = dawn_color or "7BA4FF",
dawn_horizon = dawn_color or "#C0D8FF",
night_sky = night_color or "000000",
night_horizon = night_color or "4A6790",
fog_tint_type = "default",
})
sky_data.sun = {visible = false, sunrise_visible = false}
sky_data.moon = {visible = false}
sky_data.stars = {visible = false}
@ -164,7 +164,8 @@ function dimension_handlers.nether(player, sky_data)
end
function dimension_handlers.void(player, sky_data)
sky_data.sky = { type = "plain",
sky_data.sky = {
type = "plain",
base_color = "#000000",
clouds = false,
}

View File

@ -75,13 +75,15 @@ function mcl_weather.has_snow(pos)
end
function mcl_weather.snow.set_sky_box()
mcl_weather.skycolor.add_layer(
"weather-pack-snow-sky",
{{r=0, g=0, b=0},
{r=85, g=86, b=86},
{r=135, g=135, b=135},
{r=85, g=86, b=86},
{r=0, g=0, b=0}})
if mcl_weather.skycolor.current_layer_name() ~= "weather-pack-snow-sky" then
mcl_weather.skycolor.add_layer(
"weather-pack-snow-sky",
{{r=0, g=0, b=0},
{r=85, g=86, b=86},
{r=135, g=135, b=135},
{r=85, g=86, b=86},
{r=0, g=0, b=0}})
end
mcl_weather.skycolor.active = true
for _, player in pairs(get_connected_players()) do
player:set_clouds({color="#ADADADE8"})

View File

@ -23,13 +23,15 @@ minetest.register_globalstep(function(dtime)
mcl_weather.rain.make_weather()
if mcl_weather.thunder.init_done == false then
mcl_weather.skycolor.add_layer("weather-pack-thunder-sky", {
{r=0, g=0, b=0},
{r=40, g=40, b=40},
{r=85, g=86, b=86},
{r=40, g=40, b=40},
{r=0, g=0, b=0},
})
if mcl_weather.skycolor.current_layer_name() ~= "weather-pack-thunder-sky" then
mcl_weather.skycolor.add_layer("weather-pack-thunder-sky", {
{r=0, g=0, b=0},
{r=40, g=40, b=40},
{r=85, g=86, b=86},
{r=40, g=40, b=40},
{r=0, g=0, b=0},
})
end
mcl_weather.skycolor.active = true
for _, player in pairs(get_connected_players()) do
player:set_clouds({color="#3D3D3FE8"})