-
Posts
14 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
News
Store
Everything posted by Jan5676
-
Hi, I recently released the sprinklers mod (https://mods.vintagestory.at/show/mod/33016). A question I get asked a lot, if I could make this mod compatible with feature X from another mod. The most requested one is allowing to make sprinklers interact with fluid pipes from other mods. Now I could go, add the mod into my csproj file and start coding, using the other mods' API to make it interact with a pipe. But that's exactly the issue. I believe that when I go and do that, the sprinklers mod will require mod B as a dependency, lowering the ease of installing, as I want this mod to work as a standalone as well. Some ideas I had: Make a parallel mod, using the first ones codebase to specifically separate the dependencies. The issue with this one is, it would require maintenance for each supported mod and make development in the future a mess. Add some sort of conditional "patching", which would run some code to modify classes in case one of the other mods are detected. This seems pretty difficult and out of my personal C# dev knowledge. As I am not the most experienced C# dev, I'd be happy to hear about your ideas to make this work or at least guide me to the right direction to be able to continue developing my mod. Thanks in advance!
-
Sprinklers Mod Feature Requests
Jan5676 replied to Jan5676's topic in [Legacy] Mods & Mod Development
@jupiter878lorem I released a new Mod Version which contains your requested variables. -
Sprinklers Mod Feature Requests
Jan5676 replied to Jan5676's topic in [Legacy] Mods & Mod Development
Beware however, that acres placed near water blocks may prevent them from going below a certain hydration value, possibly preventing the lower of the variables from being reached. -
Sprinklers Mod Feature Requests
Jan5676 replied to Jan5676's topic in [Legacy] Mods & Mod Development
@jupiter878lorem Okay that shouldn't be a problem to implement. The bugs mainly stem from acres either not actually reaching 100% (effectively as if the watering call on them was skipped) or them never going below 100% ever again. That's something that happened a while ago, maybe I accidentally fixed it with some other changes I will cap it a 99% tho, because watering at 100% would make them never water again due to rounding. -
Sprinklers Mod Feature Requests
Jan5676 replied to Jan5676's topic in [Legacy] Mods & Mod Development
@jupiter878lorem Can you elaborate on that? What I assume is that you mean the 2 latching variables for when the sprinkler activates/hibernates right? In that case I could add 2 new vars: minActivationThreshold=0.85 #Minimum 1%, as acres in code never TRULY reach 0% after their initial creation maxActivationThreshold=0.95 #Would be capped at max 95% as otherwise it would cause some weird bugs with acre Percentages I had in the past -
Hi, this is the corresponding forum thread to my Sprinklers Mod. If you have any feature requests, please add them as a comment here. If you have any BUG reports, add them to the Github issue tracker instead. I know something like a sprinkler mod might be a bit controversial because it automates an important aspect of the game away, but I still wanted to make it just to please impatient people like me or my friends. The currently requested features/changes taken from the mod pages comments are: Will most likely do: (added with v0.9.2) Remove the current 3 sprinkler Tiers, replacing them with directly upgradable copper based sprinklers. My approach for the upgrades is directly taken from Stardew Valley, but I understand that for the sake of realism and also ease of crafting, it would make more sense to make all the sprinklers based on copper, bronze, brass or lead. This change WILL break your current sprinklers placed in the world, so please be aware of that. The new Sprinkler tiers will just be called like their tier is (e.g. T1-Sprinkler) and keep the ranges of their previous counterparts. My idea for crafting those would be like this: Tier 1: Takes any type of copper based metal, 1 rod, 8 nails and strips, 1 bucket, 2 rusty gears (Makes up for a total of 3 Ingots) Tier 2: Replace the rod in the middle with the previous tier sprinkler and add 1 more gear, 1 bucket (Takes 40 Liters instead of 20) Tier 3: Same as Tier 2 but instead of rusty gears, it will be a single temporal gear (Will take 60 Liters) Tier 4: A little different approach, requiring Jonas parts and other stuff only to be found in the more dangerous and hidden places. I don't really have a concrete concept for a recipe for now, but they will require a Tier 3 sprinkler. Their range will be 8 and their capacity will be 100) (added with v0.9.4) Add more manual ways to add water to the sprinklers (e.g. buckets and jugs) (added with v1.0.0) Ceiling mounted Sprinklers. Similarly to the way you'd force slabs to stick to one direction, you can put a sprinkler into the crafting grid and turn it upside-down. This way you could mount them to a ceiling and make them water the blocks below. I am however not really sure how much downwards range they should probably have. I was thinking about them watering the same range but 3-4 blocks below. I would like to keep them on one height and not covering both, as that would require polling more blocks which could have an impact on performance Sounds interesting, but will be more work: (optional) Sprinkler Wear. Add a durability to the sprinklers so they will need to be repaired from time to time. This will probably kill the convenience for most players, but I recognize this could be an interesting addition for some. I will implement this but gate it behind a config variable which defaults to false. Questions for people who want this implemented: How should this work exactly? Either have durability like a tool (which would need to carry over to the item version to prevent cheesing) or maybe a very low random chance of it breaking, with an animation of it acting up. How should it be repaired? One suggestion I read is using a wrench on it, maybe there could be another failure where theres a pipe blockage only resolvable with some kind of chemical you'd have to mix together. One way to prevent or slow wear could be putting sprinklers in a greenhouse where much less stuff is flying around able to block the pipes and stuff of them. Probably won't do: Make those sprinklers be able to extinguish burning blocks. (This would require polling too many blocks in its area to actually be useful, because this increases the area from a plane to a cube, thus making the performance worse on a factor of 3) Make the sprinklers able to handle fast forwarding and time skipping. What I mean by that is that when you sleep or add time via a command, the sprinklers will not activate more often, they are bound to a certain game tick interval and ONLY if the chunks are loaded. If you leave a chunk and come back some time later, the crops may have decayed because the sprinklers only activate while loaded. (The reason for why I won't be doing this is because it would require all farmland to be paused and recalculated based on the remaining fluid in the sprinkler + time passed. To be honest, I am neither patient nor motivated enough to try figuring out the API to that extent. If you want to fix this yourself, feel free to open a Merge Request on Github) The only way I could see this working is making plants invincible or acres not being able to drop under 5% moisture while chunks are not loaded. Add some sort of compatibility with pipes from other mods (e.g. "Vintage Engineering" or "Hydrate or Diedrate"). As far as I'm concerned and as the modding API is not as well documented as I'd like it to be, this is something I feel would be possible without making this mod dependent on one of the others. This would greatly decrease accessibility. Also, project setups like those are not within my ballpark, as I am usually a Java Developer where things work quite differently to C#. If someone wants compatibility regardless, feel free to fork my project from Github and get into contact with me once it is done. I will add it as a separate branch/release. Again, if you have an interesting idea which could improve the mod, write a comment and I will add it somewhere in this list. Currently, if anyone wants to help in mod development, if someone is willing to make a better model + animation for the sprinklers, I will thankfully take those. In that case, please DM me in the forum if you have a concept/realized model. Mine, to be perfectly honest, looks like a programmer placeholder at best
-
That sounds pretty good. I just remembered it's not just world loads/Server joins but also required each time a chunk with the Entity is reloaded, but I think that solution should cover it. Will the ElapsedSeconds always be in sync between server in client though? Because I can imagine even a lag of a few millis might generate a different seed.
-
Okay I was able to answer this question myself in case anyone needs this for the future. It's pretty simple actually, just take the Block Entities position in the world, convert it to a Hashcode and feed it as a seed to the RNG. This will however always produce the same seed you load up the world so keep that in mind. If someone has an idea on how to make them completely random so they change their values on each world load please feel free to share!
-
Hi, basically my question is, I want to start a random timer when loading the world inside of a Block Entities Initialize function. When it gets loaded however, I noticed that because Client and Server call them independently of one another that their values will be different. Is there a way to ensure they will both be passed the same random value so they can act in sync?
-
Hi, I am currently developing a code mod, everything seems to be working fine so far, but I have come to the point, where I want to add a little animation to a block. I have created a Model in the VSModelCreator and imported it into the corresponding shapes directory in the mod path. This all works so far, I've now got a model with textures and all. Now I tried adding an animation to the block and it looked good in the Model Creator. I exported the file and now I have a JSON file with models AND an animation. This is the part that I think is probably important: "animations": [ { "name": "sprinklerTurn", "code": "sprinklerTurn", "quantityframes": 30, "onActivityStopped": "PlayTillEnd", "onAnimationEnd": "EaseOut", "keyframes": [...] } ] Now, I want to be able to play this animation on the Block (or rather the BlockEntity) that uses this model. I have already completed the rest of the mod and everything else is working with a Block and BlockEntity CS Class. This is my blocktype file: { "code": "tin_sprinkler", "class": "sprinklersmod.sprinkler", "entityClass": "sprinklersmod.blockEntitySprinkler", "blockmaterial": "wood", "creativeinventory": { "general": [ "*" ] }, "sidesolid": { "all": false }, "sideopaque": { "all": false }, "sounds": { "place": "game:block/planks", "break": "game:block/planks" }, "collisionbox": { "x1": 0.25, "y1": 0, "z1": 0.25, "x2": 0.75, "y2": 0.5, "z2": 0.75 }, "selectionbox": { "x1": 0.25, "y1": 0, "z1": 0.25, "x2": 0.75, "y2": 0.5, "z2": 0.75 }, "shapeByType": { "*": {"base": "block/tinsprinkler"} }, "textures": { "tinbronze": {"base": "game:block/metal/anvil/tinbronze"}, "brass": {"base": "game:block/metal/lantern/brass"} } } Theres still a bit of tweaking to be done here, but I registered the shape and now want to be able to access the animation. I was looking at many places for a way to do this, but I didn't really find much about the topic (only on how to create animations in the first place). So, my question is, how can I run the animation in my BlockEntity class the proper way? Which Class or Function do I need to call to make the block run its animation once? (In the best case asynchronously so it doesn't block the rest of the code from running). Bonus question: I want add a small "sprite" based water sprinkle animation to my block, but I didn't seem to find a way to make parts of a block model invisible unless called by the Keyframes to become visible. Is there a way for that?
-
Hey, I had a really simple idea I tried to implement via a new Block Class, the Sliding Pole. The idea is basically, it acts like a ladder, but increases your downward (sneak) movement by 3 times while slowing you to 1/3 when climbing it. I set the climbable property to true and fiddled a bit with the OnEntityCollide method. There is a default speed modifier applied (entityAgent.SidedPos.Motion) that only counts when actively walking into the block, however I didnt't know how to adjust the default "sneak" and "jump" functionality when hanging or rather hovering on a ladder. The documentation for this unfortunately wasn't very helpful and I feel like climbing behaviour is implemented at another place I don't know about. This is the code I changed: public override void OnEntityCollide(IWorldAccessor world, Entity entity, BlockPos pos, BlockFacing facing, Vec3d collideSpeed, bool isImpact) { if (entity.Properties.CanClimb && entity is EntityAgent) { EntityAgent entityAgent = entity as EntityAgent; if (!new bool?(entityAgent.Controls.Sneak).GetValueOrDefault()) { //Tried setting to 0 when doing nothing, but gravity pulls me down without "climbable" set to false, but overriden if it IS set to true entityAgent.SidedPos.Motion.Y = 0; } else { //Technically works, but I can't really hover entityAgent.SidedPos.Motion.Y = -10.0; } } } I feel like it's difficult to explain the problem without testing it yourself. Ultimately my question would probably be: How is the climbable property implemented into the game and how could I adjust it accordingly?