Pushable Blocks

Discussion in 'Archived: Plugin Requests' started by Kurusca, Oct 23, 2013.

  1. Offline

    Kurusca

    Looking for a plugin that would allow players to push a block one (and only one) grid square in a predefined direction. This will be usefull in recreating the original Zelda (nes) game puzzles. If you have ever played it, you know that there are several areas that the block needs to be pushed to open a door or reveal a pathway to continue.
     
    JPG2000 likes this.
  2. Offline

    JPG2000

    Kurusca Format it maybee? I know this request is small, but it helps.
     
  3. Offline

    BillyGalbreath

    Pushable is in walking into it or by clicking it?
     
  4. Offline

    Kurusca

    Walk into and keep walking for another second or two. But clicking could work as well.
     
    Jake6177 likes this.
  5. Offline

    _Filip

    This would be very interesting, but I'm working on another plugin and can't take this on, but I'd like to see this.
     
  6. Offline

    BillyGalbreath

    I cant do the "keep walking for another second or two" as the server doesnt see any movement at all for that.

    However, I can do this:

    youtube.com/watch?v=3NcEynN1YP0

    It's a proof of concept demo. Still far away from production use. Let me know what you think.

    Edit:

    I'm almost finished with this. Its turning out very nicely. ^_^

    All done. Heres the end result:



    Bukkit Project still waiting for approval: http://dev.bukkit.org/bukkit-plugins/pushblock/

    Jenkins is up (get build #5): http://jenkins.pl3x.net/job/PushBlock/5/

    Enjoy! ^_^
     
  7. Offline

    Kurusca



    OMG thats PERFECT!! Thank you!!!!!
    3 questions.
    Is it just for Stone or any block?
    Just name it "Pushable" on anvil correct?
    How hard would it be to be able to "link" a 2x2 set of blocks and make that group pushable? (reason i ask is the current scale of my zelda project the blocks are all 2x2. If not, i can adapt. :D)

    lol. Not trying to be picky but one other thing that would complete this plugin perfect for my needs would be the ability to also have a "heavy pushable" block that requires a player to be wearing some item (maybe a diamond helmet or something) to be able to push. If they don't have that item, the block is too heavy to move. But still have the ability to move the regular pushable blocks without wearing the item. I don't know if it is possible or a pain or not.
     
  8. Offline

    blablubbabc

    Hehe, I worked on something similiar over a year ago too, as one of my first plugins, but I didn't finish it.
    some additional feature ideas:
    * being able to define in which directions a block is pushable (-x,+x;-y,+y,-z,+z), maybe even having them only pushable on some sort of path
    * define a maximum amount of pushes a block and/or range, a block can be pushed
    * having the block reset itself after a certain time
    * physics prediction (this is where I think I stopped working on the plugin): I tried to no have the block push-able when it would cause it self or other blocks to break or disappear (for example, pushing signs or torches from a wall)
     
  9. Offline

    Kurusca

    Thankfully, at least me for my needs, don't need something that complex.
    Ideally:
    1. 2x2 set of blocks can be pushed as one
    2. blocks can only be pushed a predifined direction and distance
    3. two different weights of blocks. light can be pushed by hand, heavy requires item to be worn by player.

    :D

    Even as it is, it's an amazing plugin and will be very usefull.
     
  10. Offline

    BillyGalbreath

    I'll work on predefined direction and distance tonight. It should be relatively simple to do. I'll make it so you just add the direction and distance when renaming, so for example if you rename it to "Pushable N 10" it will be able to be pushed north only, up to 10 spaces from original spot.

    This does bring up one concern to me, though. What happens when it hits the last position? Should it automatically reset? Should it break? Should it remain their being stuck forever until someone breaks it?
     
  11. Offline

    Kurusca

    I would say have it stay stuck there until broken. For my use anyway my maps reset when the player leaves the world so won't affect me too much. :)
     
  12. Offline

    BillyGalbreath

    Ok, that changes everything. I'll have to think about this some more as the plugin is not aware of maps resetting and it will remember the last position the block as pushed to regardless.

    Can you give me more details on how the world is reset and what triggers it exactly?
     
  13. Offline

    Kurusca

    Lol. No worries at all. Each map has a template version only accessible by admin. When a player enters the map the server generates a copy of that world for them to play in or destroy. When they leave the world is deleted. Think instances from world of warcraft. Plugin is called adventour. If you get it working in a regular server then adventour takes care of the rest. :) in short, nothing to concern about :)
     
  14. Offline

    BillyGalbreath

    Does the world name ever get re-used? If so, this would cause a conflict of positions. I'll check out that plugin and see if there's an event I can hook into to make PushBlock delete the saved data of the pushed blocks when the world is reset.
     
  15. Offline

    Kurusca

    example: Player logins into server is in "Lobby" world.
    Player enters portal to map named "Zelda"
    Server takes the "Zelda" world/worldguard/plugin info/etc and creates a "Zelda.Playername" world
    Player can play map and break stuff.
    Player leaves map or logs off.
    Server deletes "Zelda.Playername" world.
    All is dandy.


    Havn't had any issues at all with any plugins or mods being affected by adventour. It's just like being sent a .zip file for the whole server and running it. Everything is duplicated for each player map in progress.

    Can whitelist you if you like for a demo.


    no the world is not reused. Is deleted. If a player wants to play again, a new copy is created for them.
     
  16. Offline

    BillyGalbreath

    Ok, I just examined the code to AdvenTour and there is no events to hook into so I can detect when a world is deleted. This causes a huge conflict in the way PushBlocks works, and I cant think of a solution.

    Here's the problem: When you set down a pushable block, its location is saved to block.yml so the plugin can keep track of it between server restarts and so someone can break it to get the pushable version of the block back. When a user pushes the block, that location gets updated in the yml file. If the world gets deleted, that last position remains in the yml file still. So when the world gets created again from the same user (creating the same world.playername world name) the old position is recalled and used. Where AdvenTour "resets" the pushable block is now just a normal block that cant be pushed, and the pushable block is somewhere else (most likely an air block now).

    You can test this out now and see this behavior in the current version of PushBlocks. In order to fix this I would need AdvenTour to use an event system (which would be a total rewrite of their plugin, so not likely they'll do it) so I can know when a world gets deleted so I can delete the saved pushable block data, or even reset it back to the original location so the next time this world loads up the block will be pushable still. Without an event to trigger, theres no way for me to know when the world is deleted.
     
  17. Offline

    Kurusca

    hmmm. What about a server side script to auto delete that information daily? Would be fairly easy to implementmy players only able to run the map ONCE per day.

    Or worst case, switching gears a bit, do you know of any way to make jukebox music follow a player in a large area? Think overworld music from the original zelda.

    Is the save data between restarts needed??? I mean, great feature, but no major reason to be able to save block location data between resets.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  18. Offline

    BillyGalbreath

    I believe if you set the volume loud enough it should be audible for large distances.

    I could add a config option to disable persistent saves so it wont save to a blocks.yml file. The only downside is on server restart all pushable blocks will become normal blocks.

    I'll still have to do some workarounds to make it compatible with AdvenTour as the locations are in memory until the server restarts.

    Here is an example of what the config.yml will look like in the next release. You would want to toggle the last two default values for your use-case.

    Code:
    # Enable debug info in console
    debug-mode: false
     
    # Enable colors in console output
    color-logs: true
     
    # Turn this off to disable persistent saves.
    # WARNING: Turning this off WILL cause all pushable blocks
    # to become normal non-pushable blocks on server restart!
    use-persistent-saves: true
     
    # Reset blocks to original position when world is unloaded.
    # This is useful for instanced maps like with AdvenTour plugin.
    reset-on-unload-world: false
    
     
  19. Offline

    Kurusca

    Well, disabling the persistent save wouldnt really be a problem i think? The template world will not have the blocks moved as it is never used (except for editing the world, and I can replace the blocks to be moveable again if needed). So as long as the TEMPLATE blocks havnt been moved, they should remain moveable between restarts yes?

    I think I might be confusing myself. LOL

    my apologies that this has become so complicated. If you don't want the headache then no worries.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  20. Offline

    BillyGalbreath

    No headaches here ^_^ I love a challenge. Broaden the horizons a little bit :p

    The biggest thing to remember here is the plugin doesnt care what block is what or where it is. It just remembers a reference to a location. This adds huge amounts of expandability and usability across multitude of use-cases, but it can also be somewhat a limiting factor, like in our case here.

    No worries, though. I'll figure this one out. ^_^
     
  21. Offline

    Kurusca

    ok. I hope other servers utilize this plugin as well. I will definitely be telling my sister server about it. I think they will love it!
     
  22. Offline

    BillyGalbreath

  23. Offline

    Kurusca

    Will load it up after work today. Hate closing one day and opening the next. :(
    Will post results and such asap.

    Unfortunantly, not working. Works ok when i load the template world "Train". When i leave that world back to the lobby world "world" and go into either an instance of it (Train.Kurusca) or back into the template "Train", they are standard blocks. :(

    **EDIT** Also, they cannot be pushed south.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
    BillyGalbreath likes this.
  24. Offline

    valithor2

    I would suggest not using a anvil to change the name until you find a way to make it to where the data is saved through world resets I would instead use blocks that are not normally used in the map to be pushable blocks like the monster spawn stone or sponges. This would allow for a easier way to classify what blocks are pushable and most of the blocks you can choose do not normally spawn so there would be no conflict.
     
  25. Offline

    BillyGalbreath

  26. Offline

    PumasCast

    Probably could use a sand entity as a block and it could be pushed over and in diagonal surfaces. So not just x y axis. A free moving block.
     

Share This Page