Well now you can!
Major thanks to MegaDood for helping me make this npc come to life!
Gifs portraying the currents in action: show
Enjl suggested diagonals, so I added ANGLES! (v2 onwards)
Adjustable speed! (The bubbles move faster/slower depending on the speed too!)
Adjustable range!
To install:
1) Extract everything into your level folder.
2) If you want to change default settings, open waterCurrentSettings.lua. All of the settings have been documented there.
3) You're done!
Latest Version (V8.2)
Other Versions: show
Important Files: show
npc-752.lua: Modifying stuff in this file may end in the water current not moving the player correctly. Only edit this file with caution and if you can read my very spaghetti code.
waterCurrentManager.lua: The file that governs the visual side of the water currents, the bubbles. Modifying this file may result in the bubbles not appearing correctly. Modifying this value won't affect the gameplay in any way.
waterCurrentSettings.lua: The file that governs the global settings for the water currents. Modifying stuff in this file will at most end in the game throwing errors (for example, if a value is a boolean and you set it as a number).
waterCurrentManager.lua: The file that governs the visual side of the water currents, the bubbles. Modifying this file may result in the bubbles not appearing correctly. Modifying this value won't affect the gameplay in any way.
waterCurrentSettings.lua: The file that governs the global settings for the water currents. Modifying stuff in this file will at most end in the game throwing errors (for example, if a value is a boolean and you set it as a number).
Changelog: show
V1: show
-Released!
V2: show
-Re-did the system for moving the player/spawning the bubbles, now they are compatible with ANGLES!
V3: show
-Added some neat effects to the bubbles, moving them on a sine wave and making them flicker.
V3.1: show
-Fixed a small oversight that made the bubbles only move as a sine wave on the X axis.
-Added a new file, waterManagerSettings.lua. In here you can set global settings for water currents to use.
--allowShadowMarioThroughCurrent: if you want players who used the Shadowstar cheat code to be able to go through the water current, set this to true.
--More settings (probably) coming at a later date.
-Added a new file, waterManagerSettings.lua. In here you can set global settings for water currents to use.
--allowShadowMarioThroughCurrent: if you want players who used the Shadowstar cheat code to be able to go through the water current, set this to true.
--More settings (probably) coming at a later date.
V3.2: show
-Added more options to the waterManagerSettings.lua file:
--showBubblesOutsideWater: If you want the bubbles to appear outside of water, set this to true. Doesn't affect gameplay nor does it make sense logically but whatever.
--affectOutsideWater: If you want the players to be affected by the water current when outside water, set this to true. Doesn't make any sense but whatever.
--showBubblesOutsideWater: If you want the bubbles to appear outside of water, set this to true. Doesn't affect gameplay nor does it make sense logically but whatever.
--affectOutsideWater: If you want the players to be affected by the water current when outside water, set this to true. Doesn't make any sense but whatever.
V4: show
-I realised there was no layer support, soooo:
-Added support for moving layers!
-Also, when you hide a layer that the water currents are in, they stop pushing the player until the layer is shown again! Also, the bubbles stop being produced when the layer is hidden. Just a small little touch.
-I added this just for additional ways to make cool stuffs with the water currents. Have fun with hiding/showing/moving them!
-Added support for moving layers!
-Also, when you hide a layer that the water currents are in, they stop pushing the player until the layer is shown again! Also, the bubbles stop being produced when the layer is hidden. Just a small little touch.
-I added this just for additional ways to make cool stuffs with the water currents. Have fun with hiding/showing/moving them!
V5: show
-Added a system to disable the culling of bubble particles when water current NPCs are off-screen.
-There is a new option inside of waterManagerSettings.lua:
--alwaysCull: If set to true, the particles will always be culled. Increases performance but will make it so if a water current NPC is offscreen, the bubbles won't appear, even though the water current itself can still push the player.
---Additional notes about culling: I implemented some optimization for water currents. When they are offscreen horizontally, they don't render (This system also accounts for the range, so if you have, say, a 12 block long water current and the water current NPC is off-screen, the bubbles will still render!). I didn't yet find a way to do this vertically, so if you put a lot of water currents in a vertical level, be sure to set alwaysCull to true. If you don't, the game will either run slower or bubbles won't render in because of the particle limit. You can always change the limit by going into bubble_particle.ini and setting the "limit" value higher, though be warned that too high of a value will make your level run slower on lower-end machines. [Always account for lower-end machines! Whatever you have, there's probably some gamer out there that has a slower machine, in which case the game can slow down considerably.]
-There is a new option inside of waterManagerSettings.lua:
--alwaysCull: If set to true, the particles will always be culled. Increases performance but will make it so if a water current NPC is offscreen, the bubbles won't appear, even though the water current itself can still push the player.
---Additional notes about culling: I implemented some optimization for water currents. When they are offscreen horizontally, they don't render (This system also accounts for the range, so if you have, say, a 12 block long water current and the water current NPC is off-screen, the bubbles will still render!). I didn't yet find a way to do this vertically, so if you put a lot of water currents in a vertical level, be sure to set alwaysCull to true. If you don't, the game will either run slower or bubbles won't render in because of the particle limit. You can always change the limit by going into bubble_particle.ini and setting the "limit" value higher, though be warned that too high of a value will make your level run slower on lower-end machines. [Always account for lower-end machines! Whatever you have, there's probably some gamer out there that has a slower machine, in which case the game can slow down considerably.]
V6: show
-Added a new extra-setting, the width of the water current.
--Defaults to 32.
--Intended to be changed when the water current is on top of a pipe.
--Defaults to 32.
--Intended to be changed when the water current is on top of a pipe.
V6.1: show
-Fixed a problem where, if the layer a water current is on is hidden and then shown, the bubbles won't appear anymore. (This would happen rarely)
V6.2: show
-Fixed a bug where, if the player was in a forced state (powerup up/down) they would still be moved by the water current, causing them to enter walls.
V6.3: show
-Made it so that if you have the customhurt=1 property in a block, if the player is pushed into it by the water current, they get hurt!
V6.4: show
-Fixed a possible layer bug.
V6.5: show
-Added integration with my Metal Mario npc thingy if you wanna use it.
-There is a new option inside of waterManagerSettings.lua:
--affectMetal: If this is true, it will also affect Metal Mario and stuff. (Check out my other stuff if you want to know how this can be used!)
-There is a new option inside of waterManagerSettings.lua:
--affectMetal: If this is true, it will also affect Metal Mario and stuff. (Check out my other stuff if you want to know how this can be used!)
V7: show
-New major update WOO
-Rewrote the script so it uses the Colliders.lua file for collision checking. This means that it's much more reliable!
-You can now go through inactive switch blocks and the such! Huge thanks to Dragonfan96 for telling me, didn't even think of these cases haha
-It also checks for NPC blocks now so yay!
-No new options in waterManagerSettings.lua this time around but there's some more extra-settings!
--Water Current Width: This one now actually works, it sets the width of the physical current.
--Create Bubbles: If, for any reason, you don't want the bubbles to spawn, this is a good option to enable.
--Use Momentum For Horizontal Movement: If checked, will set the player's horizontal speed instead of moving them manually. This both has the effect of less janky interaction but also makes it really hard to fight the current. Oh and if the power is under 1 it won't work.. blame Redigit for this one.
--Bubble Speed: Sets the speed of the bubbles. If 0.00, will use the power. If anything else than 0, will use this value instead.
-Rewrote the script so it uses the Colliders.lua file for collision checking. This means that it's much more reliable!
-You can now go through inactive switch blocks and the such! Huge thanks to Dragonfan96 for telling me, didn't even think of these cases haha
-It also checks for NPC blocks now so yay!
-No new options in waterManagerSettings.lua this time around but there's some more extra-settings!
--Water Current Width: This one now actually works, it sets the width of the physical current.
--Create Bubbles: If, for any reason, you don't want the bubbles to spawn, this is a good option to enable.
--Use Momentum For Horizontal Movement: If checked, will set the player's horizontal speed instead of moving them manually. This both has the effect of less janky interaction but also makes it really hard to fight the current. Oh and if the power is under 1 it won't work.. blame Redigit for this one.
--Bubble Speed: Sets the speed of the bubbles. If 0.00, will use the power. If anything else than 0, will use this value instead.
V7.1: show
-fixed a bug that i JUST saw oops (i swear i fixed it alreadybut i guess i didnt?????????)
V7.2: show
-haha yeah there's an option to prewarm the bubbles now, which means that the current will start out filled
-currently, there's a problem with the fact that bubbles only appear once the current npc gets spawned; that is, if it's onscreen.
-i dont know how to solve this yet but ill try sometime
-currently, there's a problem with the fact that bubbles only appear once the current npc gets spawned; that is, if it's onscreen.
-i dont know how to solve this yet but ill try sometime
V8: show
- Yo, New Version!
-added an option that controls whether or not npcs that are offscreen are active.
-active, in this case, meaning if they affect the player or show the bubbles.
-oh yea i also fixed the prewarming thing from v7.2, hopefully
-added an option that controls whether or not npcs that are offscreen are active.
-active, in this case, meaning if they affect the player or show the bubbles.
-oh yea i also fixed the prewarming thing from v7.2, hopefully
V8.1: show
- squashed a small bug, oops
- thanks dragonfan96 for reporting it!
- thanks dragonfan96 for reporting it!
V8.2: show
- added a multiplier for how fast the bubbles spawn as well as settings to autocalculate it
- perfect if you have a wide current and want bubbles everywhere and you dont want to rely on a lot of individual currents
- perfect if you have a wide current and want bubbles everywhere and you dont want to rely on a lot of individual currents