Learning by example: Melon Cannon

  • So, My girlfriend and I decided to follow along with the potato cannon example and then this happened:


    We got around to wondering what else we could fit into a cannon to launch around the map, and set out looking for a more exciting projectile.

    Yeah, these should do.


    But then we realized cramming a melon into something designed for a potato created a certain scale problem, so we set out to create a new launcher, maybe some kind of shoulder-mounted apparatus.

    There we go.


    So a few tweaks to the source and then, Melons away!


    But why stop there?
    That was pretty fun for a few minutes, but then we started thinking, how can we make this even more exciting?
    So upon careful examination of a watermelon, we noticed they're large enough to fit all kinds of things inside, like oh say, a bunch of dynamite. We call them Firemelons!


    So we set up the ability to switch ammo types via a right click, made sure the plugin checks and consumes the type of ammo selected, and set up some timers for the newly explosive melons.
    It was finally time to go out and test.


    So there you go, we decided to make this post just to provide an example of learning by example. If you want to make plugins, follow along with the examples, and use your imagination.


    A few notes if you actually want to play with this thing:


    • Consumes ammo, which must be in an inventory slot, it won't recognize ammo in a hotbar slot. (might fix this later)


    • Secondary fire, (Right Click) to change ammo type between Watermelons and Firemelons


    • Completely untested in a multiplayer environment. Firemelons will explode and will damage players, buildings, environment, etc.


    • Firemelons have 2 firing methods. We wanted melons to explode on impact if it would hit something close enough, so we used a raycast to determine this. In this case, the melon travels more like a rocket than in a trajectory. Otherwise the "potato launch" method is used. A possible in-game explanation for this is that the item "Dynamite" has the behind-the-scenes item name "tnt." Trinitrotoluene (TNT) was introduced as a safer alternative to Dynamite which is nitroglycerin based and extremely shock-sensitive. So assuming a firemelon could use either, TNT melons would not explode on impact whereas Dynamite melons would, so long as you found a way to stabilize it so it doesn't combust before it leaves the barrel of a cannon. Good luck with that. Don't try that at home without seeking professional assistance first, preferably from a licensed behavioral therapist.


    • Use at your own risk


    • Not recommended for use indoors.


    • Aim away from face.


    Installation:
    Extract or move the zip contents into your plugins folder. When done it should look like this:



    Rising World
    └plugins
    __└MelonCannon
    ____├assets
    ____└ MelonCannon.jar

    Files

    • MelonCannon.zip

      (2.68 MB, downloaded 431 times, last: )

    Edited 2 times, last by AllieCat: fixed spelling error ().

  • needs to be a way to restrict the fire melons for servers that ban tnt. The ones that don't want damage :) I would love to use this on my server but desire a way to turn off the firemelon. or maybe make them like grenades, only does damage to players and npc. I think just being able to turn off the firemelon would be better though. It works well as you have it, even in multi player. Does to much damage to not be able to restrict the firemelons though.

  • needs to be a way to restrict the fire melons for servers that ban tnt. The ones that don't want damage :) I would love to use this on my server but desire a way to turn off the firemelon. or maybe make them like grenades, only does damage to players and npc. I think just being able to turn off the firemelon would be better though. It works well as you have it, even in multi player. Does to much damage to not be able to restrict the firemelons though.

    Thanks for the suggestion!
    We really only intended this to be a learning project for us, but yeah it would be nice to be able to customize it a bit for multiplayer servers. We'll get started on that and let you know when we have an update! I'm probably thinking we could set up a customization file for the mod, editable with a text editor, that way you could configure the plugin as you see fit. I'll let you know how it goes.

  • Update!


    As sharkbitefischer suggested, the plugin has been updated!
    Those who downloaded the plugin before will just have to download it again and overwrite the old one.
    The plugin now ships with a prefs.txt file which has a few options for you to configure how the firemelons work.


    Firemelons are now available in one of 4 different types:
    Hard melons - Firemelons will damage everything
    Soft melons - Firemelons damage players and npcs but not buildings or terrain
    Show melnos - Still explodes, but doesn't damage anything. (new default setting)
    Firework melons - Firemelons are crafted with fireworks instead of dynamite/tnt and have firework effects!


    If you want exciting and exploding melons without fear of possible consequences, the firework melons are probably what you want:


    Here's a peek at the included prefs.txt file:

    Feel free to let me know if you have questions or concerns!


    Anyway, go have fun blowing up some melons!

  • how about adding another kind of ammo like jack-o-lanterns too ? :evil: they could be set for different sized explosions. call it flaming jack :)

    :D I like how you think! Haha!


    Thanks for the suggestion too about version numbers and posting the plugin in the plugins thread. I think I will, but at first it was made just for giggles and I wanted to avoid double posting. But since people seem to like it, I'll make a post where people can find it easier.

  • something weird. When I log out with the cannon still in my hand and then log back in, it looks like it is in my left hand and flipped around until I change hot slot and back again. then it appears correctly.


    Ok this seems to be caused by lag. I have a bad internet connection so am slow to load. When fully loaded it corrects it's self.


    sorry for the scare :)

  • This looks awesome, well done! :thumbup:

    Wow, I'm not sure how I missed this before, I must have scrolled right past it! Sorry!
    That's some great praise coming from you @red51 Thanks for the nice compliment! :D


    something weird. When I log out with the cannon still in my hand and then log back in, it looks like it is in my left hand and flipped around until I change hot slot and back again. then it appears correctly.


    Ok this seems to be caused by lag. I have a bad internet connection so am slow to load. When fully loaded it corrects it's self.


    sorry for the scare :)

    :P Ok, no harm done. Glad it's working!

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!