Page 1 of 3

[MOD] cannons with a lot of features! [2.5] [cannons]

PostPosted: Sat Nov 16, 2013 08:20
by addi
cannons is a mod for the game minetest written by Kingarthurs Team
(Semmett9, eythen, and addi)

if you have some muni and some gunpowder in the cannon
you can shot the cannon if you punch it with a torch.

the cannonball will damage the other players.
if it wears armor the damage will be calculated.

at the moment there are 5 diffrent types of cannonballs
  • wooden ball: small range, less damage
  • stone ball: more range, less damage
  • iron ball:huge range, huge damage

and 2 balls that can be dissabled in settings.txt (for a run on a server to avoid griefing):
  • exploding ball: this destroyes all nodes in a radius of 1 (can be dissabled by setting the cannons.enable_explosion = false)
  • fire ball: if it hits a node wich is able to burn it set it burn. (can be dissabled by setting the cannons.enable_fire = false)

configure cannons

create a file caled cannons.conf in your world dir.

add the folowing lines to it:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
enable_explosion = "true"
enable_fire = "true"

now you can change it. eg. if you want to disable fire then cange enable_fire = "true" to enable_fire = "false"

thats all :-)
Dependencies
  • default
  • bucket
  • fire(optional)

minimal minetest = 0.4.8
NEW FEATURES FOR VERSION 2.1
  • changed craft reziep for steel ball, because it conflicted with another mod
  • the config can made now in world dir (cannons.conf)

NEW FEATURES FOR VERSION 2.0
  • real 3d sound effect
  • added new sounds
  • particles (thanks to hybrid dog)
  • mesecons support(optional)
  • locks mod support (optional)
  • moreores support (optional)


optional features:
+ locked shareable cannon

+ mesecons supported cannons

+ mithril cannon and cannonball


get cannons
relases are in the Downloads tab)

its also aviable as a git repo:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
$ git clone https://bitbucket.org/kingarthursteam/cannons.git



Craft Rezieps


Bucket with salt:
Image

Salt (shapeless):
Image

Gunpowder (schapeless):
Image

cannon & bronce cannon:
Image


Wooden stand:
Image

Stone Stand:
Image

## Screenshots
Image
Image
Image

Create your own Cannonball!


Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local ball_wood={
    physical = false,
    timer=0,
    textures = {"cannons_wood_bullet.png"},
    lastpos={},
    damage=20,
    range=1,
    gravity=10,
    velocity=40,
    name="cannons:wood_bullet",
    collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
    on_player_hit = function(self,pos,player)
        local playername = player:get_player_name()
        player:punch(self.object, 1.0, {
            full_punch_interval=1.0,
            damage_groups={fleshy=self.damage},
            }, nil)
        self.object:remove()
        minetest.chat_send_all(playername .." tried to catch a cannonball")
    end,
    on_mob_hit = function(self,pos,mob)
        mob:punch(self.object, 1.0, {
            full_punch_interval=1.0,
            damage_groups={fleshy=self.damage},
            }, nil)
        self.object:remove()
    end,
    on_node_hit = function(self,pos,node)
        if node.name == "default:dirt_with_grass" then           
            minetest.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
            minetest.sound_play("cannons_hit",
                {pos = pos, gain = 1.0, max_hear_distance = 32,})
            self.object:remove()
        elseif node.name == "default:water_source" then
        minetest.sound_play("cannons_splash",
            {pos = pos, gain = 1.0, max_hear_distance = 32,})
            self.object:remove()
        else
        minetest.sound_play("cannons_hit",
            {pos = pos, gain = 1.0, max_hear_distance = 32,})
            self.object:remove()
        end
    end,

}
cannons.register_muni("cannons:ball_wood",ball_wood)
Have fun! :-)


License:
LGPLv3


Credits:
Evergreen for the Salt texture
Semmett9 for realy much
eythen for some more or less stupid ideas
and to me ;-P for writing the whole topic

PostPosted: Sat Nov 16, 2013 12:58
by addi
Hybrid Dog wrote:You could use particles instead of objects.

but particles cannot cause damage or destroing things
but maybe ill use particles if it hits or destroyes a node

PostPosted: Sat Nov 16, 2013 12:59
by fairiestoy
Well, you could precalculate the route and simulate the impact. With a short delay respectively, would be senseless if you fire and already see the explosion.

PostPosted: Sat Nov 16, 2013 13:12
by Evergreen
Ah, now I see what my texture was for. A little credit would be nice though. ;)

PostPosted: Sat Nov 16, 2013 13:15
by Krock
Cool mod, good job :)

PostPosted: Sat Nov 16, 2013 13:40
by addi
Hybrid Dog wrote:You could use particles instead of objects.
fairiestoy wrote:Well, you could precalculate the route and simulate the impact. With a short delay respectively, would be senseless if you fire and already see the explosion.

just a question.
whats the evil with using objects?
Evergreen wrote:Ah, now I see what my texture was for. A little credit would be nice though. ;)

sorry i forgott.
Evergreen has made the realy great texture for the salt shaker :-D
Krock wrote:Cool mod, good job :)

thanks

PostPosted: Sat Nov 16, 2013 17:36
by Element
so does the cannon destroy nodes

PostPosted: Sat Nov 16, 2013 22:11
by jenova99sephiros
Good mod

PostPosted: Sun Nov 17, 2013 00:45
by addi
Element wrote:so does the cannon destroy nodes

at the moment there are 5 diffrent types of cannonballs
  • wooden ball: small range, less damage
  • stone ball: more range, less damage
  • iron ball:huge range, huge damage

and 2 balls that can be dissabled in settings.txt:
  • exploding ball: this destroyes all nodes in a radius of 1 (can be dissabled by setting the cannons.enable_explosion = false)
  • fire ball: if it hits a node wich is able to burn it set it burn. (can be dissabled by setting the cannons.enable_fire = false)

Hybrid Dog wrote:
addi wrote:
Hybrid Dog wrote:You could use particles instead of objects.
fairiestoy wrote:Well, you could precalculate the route and simulate the impact. With a short delay respectively, would be senseless if you fire and already see the explosion.

just a question.
whats the evil with using objects?
they cause a lot of lag and on_step doesn't work really good for removing things in a ray


fairiestoy wrote:Well, you could precalculate the route and simulate the impact. With a short delay respectively, would be senseless if you fire and already see the explosion.

this only works for a shot without gravity yet:
https://github.com/HybridDog/extrablocks/blob/master/mining_lasers.lua

there are not thousands of that objects and the craft reziepe is expensive so i dont think it gets the server too much lagg.
also it dose not remove all nodes on his flying way. there is only 1 ball wich removes nodes if they hit one. but only one time. i alredy tested it wich realy much of that in a singleplayer world and it works without causing lagg.
so i think its all ok. maybe i can add a cool down for the cannons so can not much balls be in the air. but that cooldown timer may causes lagg too.

jenova99sephiros wrote:Good mod

thanks

PostPosted: Sun Nov 17, 2013 01:05
by philipbenr
+100 I have been waiting for something like this for quite some time now.

PostPosted: Sun Nov 17, 2013 12:34
by addi
Hybrid Dog wrote:
addi wrote:
Element wrote:so does the cannon destroy nodes

at the moment there are 5 diffrent types of cannonballs
  • wooden ball: small range, less damage
  • stone ball: more range, less damage
  • iron ball:huge range, huge damage

and 2 balls that can be dissabled in settings.txt:
  • exploding ball: this destroyes all nodes in a radius of 1 (can be dissabled by setting the cannons.enable_explosion = false)
  • fire ball: if it hits a node wich is able to burn it set it burn. (can be dissabled by setting the cannons.enable_fire = false)

Hybrid Dog wrote:they cause a lot of lag and on_step doesn't work really good for removing things in a ray



this only works for a shot without gravity yet:
https://github.com/HybridDog/extrablocks/blob/master/mining_lasers.lua

there are not thousands of that objects and the craft reziepe is expensive so i dont think it gets the server too much lagg.
also it dose not remove all nodes on his flying way. there is only 1 ball wich removes nodes if they hit one. but only one time. i alredy tested it wich realy much of that in a singleplayer world and it works without causing lagg.
so i think its all ok. maybe i can add a cool down for the cannons so can not much balls be in the air. but that cooldown timer may causes lagg too.

You can edit the code to remove only the first touched node.

currently there is only one cannonball wich removes nodes: the "exploding ball"
you can edit the range self by changing the range param in the cannonballs.lua

maybe in the next version i will add another cannonball wich only removes/destroys 1 node.

PostPosted: Thu Nov 28, 2013 17:09
by Tedypig
Very nice mod, but I have a question. Do the cannon balls damage/kill mobs? Seeing how I only play single-player now (lack of internet at the moment) killing mobs and decoration are the only reasons I would have to get this (and of course cranking up the exploding ball damage and effing up some mountains. Lol.). Thanks.


EDIT: Also, how hard would it be to add Mesecon support? Alot of mobs heading your way? No problem, hit the button on the wall and fire ALL of your cannons at once! Just a suggestion. :)

PostPosted: Thu Nov 28, 2013 21:27
by addi
Tedypig wrote:Very nice mod, but I have a question. Do the cannon balls damage/kill mobs? Seeing how I only play single-player now (lack of internet at the moment) killing mobs and decoration are the only reasons I would have to get this (and of course cranking up the exploding ball damage and effing up some mountains. Lol.). Thanks.

yes it damages also mobs, i tested it with mobf. but the mobs have a bit more health than players so it could be that you hit them 2 or more times.
Tedypig wrote:EDIT: Also, how hard would it be to add Mesecon support? Alot of mobs heading your way? No problem, hit the button on the wall and fire ALL of your cannons at once! Just a suggestion. :)

yes i already thought about this.

this will be a feature for version 2 of this mod ;-)

PostPosted: Thu Nov 28, 2013 23:03
by Tedypig
addi wrote:
Tedypig wrote:Very nice mod, but I have a question. Do the cannon balls damage/kill mobs? Seeing how I only play single-player now (lack of internet at the moment) killing mobs and decoration are the only reasons I would have to get this (and of course cranking up the exploding ball damage and effing up some mountains. Lol.). Thanks.

yes it damages also mobs, i tested it with mobf. but the mobs have a bit more health than players so it could be that you hit them 2 or more times.
Tedypig wrote:EDIT: Also, how hard would it be to add Mesecon support? Alot of mobs heading your way? No problem, hit the button on the wall and fire ALL of your cannons at once! Just a suggestion. :)

yes i already thought about this.

this will be a feature for version 2 of this mod ;-)


Sweet, thank you. And AWESOME! I can't wait!

PostPosted: Sun Dec 01, 2013 16:38
by addi
without words:
Image
Image
Image

Sorry, no release, because there are actual some ugly bugs i have to fix

PostPosted: Tue Dec 03, 2013 02:33
by Tedypig
Nice, just nice. Lol. I cannot wait!

PostPosted: Wed Dec 04, 2013 04:13
by PandemoniuM
This is an incredible mod. Im reading documentation for the API and Im trying to see what options there would be for allowing the user to 'aim' the cannon.

Does the API support changing the Pitch and Yaw of a block (or in this case, cannon)? Or are there any mods that have something like rotating pitch/yaw that i could reference?

This is a great mod though, incredible work.

PostPosted: Wed Dec 04, 2013 16:08
by addi
PandemoniuM wrote:This is an incredible mod. Im reading documentation for the API and Im trying to see what options there would be for allowing the user to 'aim' the cannon.

Does the API support changing the Pitch and Yaw of a block (or in this case, cannon)? Or are there any mods that have something like rotating pitch/yaw that i could reference?

This is a great mod though, incredible work.
the api can (currently) only create cannonballs.
it allwos you to change the physics by changing some parameters
and it calls the 3 functions

on_node_hit
on_mob_hit
on_player_hit

with that you can do all things that the minetest modding api allows.
including rotationchange and positionchange.

to change the rotation you can lock into the screwdriver mod how that works

if you want to change the cannon itself, its possible to do this by the Minetest Modding api directly editiing the code of this mod or with another mod and overwrite it with register_node(":cannons:cannon",{})

PostPosted: Wed Dec 04, 2013 21:24
by PandemoniuM
very cool, i will check out rotationchange and positionchange. Thanks a ton

PostPosted: Wed Dec 04, 2013 21:40
by PandemoniuM
Is there anywhere that has documentation on rotationchange and positionchange? I cant find a single thing regarding those on the API wiki.


(EDIT: Found the screwdriver mod, so ill mess around with that and see what I can come up with, thanks again)

PostPosted: Thu Dec 05, 2013 16:52
by Tedypig
I have an idea to go along with aiming. Remember... I can't code, so it may not be possible. How about rightclick and you're "in" the cannon (like a boat, on an ostrich, etc...) and while "in" the cannon you can freely look around and on_left_click you can shoot where pointedthing is looking. You could still use the gravity and such so you would have arc your shot like a real cannon. If this is possible, it would be an epic addition to this mod. :-)

PostPosted: Thu Dec 05, 2013 17:26
by PandemoniuM
The hardest part with this is the Cannon is a block so there are limitations on how it can manuvuer, etc. I encountered this when I put a listener on the Cannon to always be scanning for players within a 60 block radius. On fire, it will 'aim' towards the player, but the issue is that it only does

|
------
|

and not

\ | /
------
/ | \

So to fix this, im in the middle of essentially taking the helicopter mod replacing the cannon with a helicopter version that the user can sit in and aim (or at least allow my unmanned turret to truly aim and fixate on players)

My turret is sweet, it shoots rockets from the helicopter mod with the radius code of the 'Gunz' mod (turret).

I made a gun that when fired will build a huge 80x80 fort that has 4 walls that are 8-11 tree blocks high (nice staggered palisade wall), and a 'tall_tower' on each of the corners, and misc houses/warehouses in the middle area. So I threw the new cannon/turret ive been working on to spawn above each palisade wall log. The tower itself is probably 80x80, so thats a lot of badass turrets. Gotta protect your stuff you know what i mean? :D

But my goal is to have 2 turrets: 1 designed to kill mobs/players, and 1 to shoot only at helicopters within a certain range (sweet anti aircraft shit like http://www.senate.gov/artandhistory/history/resources/graphic/xlarge/01_28_05(18-19-08)_antiaircraft_xl.jpg

PostPosted: Thu Dec 05, 2013 17:32
by PandemoniuM
Im not releasing any of this stuff, i found this project on Saturday so im relatively new. I *WILL* clean up and create my own self contained mod so as to not disrupt the mods that Im playing around with. So I'll be posting stuff sometime in the next month, but I really want to get some conceptual stuff done first :D

My end game goal is to build a howitzer that can bomb people from hundreds of blocks away. I mean whats the point of building a city if it cant be shelled by your enemies!?! Players start a town, raise an army, join teams, and wage wars on ever changing fronts :D

PostPosted: Thu Dec 05, 2013 22:23
by addi
VERSION 2.0 RELASED

NEW FEATURES FOR VERSION 2.0
  • real 3d sound effect
  • added new sounds
  • particles (thanks to hybrid dog)
  • mesecons support(optional)
  • locks mod support (optional)
  • moreores support (optional)


optional features:
[spoiler=locked shareable cannon]
this cannon is locked and can be shared with other players.
to get this feature install Sokomines locks mod
[/spoiler]
[spoiler=mesecons supported cannons]
on each high(1/on) signal the cannon fires (if it have gunpowder and muni) to the last position.
to get this feature install the mesecons mod
[/spoiler]
[spoiler=mithril cannon and cannonball]
it just adds a mithril cannon and a mithril cannonball wich has more damage, but less range than steel ball
to get this feature install the moreores mod
[/spoiler]

get cannons
relases are in the Downloads tab)

its also aviable as a git repo:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
$ git clone https://kingarthursteam@bitbucket.org/kingarthursteam/canons.git


-------------------------------------------------------------------------------------------------------------------------------------------
Tedypig wrote:I have an idea to go along with aiming. Remember... I can't code, so it may not be possible. How about rightclick and you're "in" the cannon (like a boat, on an ostrich, etc...) and while "in" the cannon you can freely look around and on_left_click you can shoot where pointedthing is looking. You could still use the gravity and such so you would have arc your shot like a real cannon. If this is possible, it would be an epic addition to this mod. :-)

i see one problem there. currently you get the inventory if you rightclick it to insert muni and gunpowder.
so if i do it its a complete rewrite so i think this belongs in a diffrent mod.
also it will lose the mesecons support than

but maybe stu's shooter mod is what you are looking for:
https://forum.minetest.net/viewtopic.php?id=7846

@PandemoniuM : that what you want to do is a huge project :)
i wish you good luck

PostPosted: Fri Dec 06, 2013 03:09
by PandemoniuM
Feels so complete. Very great work again. That cannon punch noise is perfect

PostPosted: Sat Jan 18, 2014 22:47
by Achilles
Nice mod, i really like the idea of cannons in Minetest especially as i was planning to build a huge wall around a town to defend it.

Is there any way of making the cannon automatic so that if anyone other than the person who made it gets in range of the cannon they will be killed- A bit like dispensers in Minecraft.

You could also change the mod so that you could add the name of a client/player who you don't want the cannons to fire at.

Just a couple of hints but otherwise i love the mod, thanks :)

PostPosted: Sun Jan 19, 2014 02:22
by addi
Achilles wrote:Nice mod, i really like the idea of cannons in Minetest especially as i was planning to build a huge wall around a town to defend it.

Is there any way of making the cannon automatic so that if anyone other than the person who made it gets in range of the cannon they will be killed- A bit like dispensers in Minecraft.

You could also change the mod so that you could add the name of a client/player who you don't want the cannons to fire at.

Just a couple of hints but otherwise i love the mod, thanks :)

thanks :)
i dont know what the dispensers mod is doing, but you can combine this with the mesecons mod:
its possible to build some mesecons wires to the cannon and a player detector wich detects the "enemy" and give a impulse to the cannon(s). than the cannon will shot to the last possition they had shot.

Re: [MOD] cannons with a lot of NEW features! [2.0] [cannons

PostPosted: Thu May 15, 2014 21:52
by dgm5555
Great mod. Few questions
How do you break the cannon?
I take it "muni" is ammunition. It took me a little while to figure out that stacks of cannon balls are not able to be used for ammunition - you have to use a single ball.

Re: [MOD] cannons with a lot of NEW features! [2.0] [cannons

PostPosted: Fri May 16, 2014 03:23
by addi
you can break (dig) the cannon only if they is empty (no muni and no gunpowder).

have you ever sean a cannon, that shoots a stack of balls? only a single ball can be shooted all other is unreal. stacks only designed to save space in chests or for decoration.

Re: [MOD] cannons with a lot of NEW features! [2.0] [cannons

PostPosted: Fri May 16, 2014 17:30
by dgm5555
addi wrote:have you ever sean a cannon, that shoots a stack of balls? only a single ball can be shooted all other is unreal. stacks only designed to save space in chests or for decoration.

Well there was grapeshot and cannister shot, so yes cannons *can* shoot multiple balls (though I presumed the stack didn't refer to those). However in my defence I've never seen a cannon you could load with 99 balls, so an entirely unknown (perhaps just to me) "semi-automatic cannon" has been modelled - check out the magazine on that baby!!! So from real-world experience it would be reasonable to think that the cannon would be using balls from a stack (though admittedly these would usually be placed next to the cannon for firing or in the hold for storage rather than actually 'attached' to the cannon :-p

PS On that note (just for my curiosity) why did you create your cannon as a kind of turret and in two parts - I've never seen anything similar for a 'full-sized' cannon (as opposed to a more modern turret gun, or one of the smaller portable cannon that were developed), and would have thought the recoil would knock it over if it was built. Not that I particularly mind, it just seems a bit strange to have to dig a hole in the ground or the deck to sink the frame (not a carriage as no wheels) of the cannon into (to maintain a more realistic low centre of gravity), then have to attach the cannon barrel separately.

PPS I guess this ruins my next non-reality suggestion for a fireworks version - I'd really like to be able to trigger my ship to fire all cannons at once (as you've allowed with mesecons), but instead of cannon balls it fires an exploding ball with fireworks (like an average fireworks rocket). [Actually don't worry, someones allready done fireworks, so I'll probably just modify the fireworks mod https://forum.minetest.net/viewtopic.php?id=3473to to have a display around my ship]

PPPS, where do I find the optional bucket and fire mods, and what are they used for?

LOL
David