Create: Computing AgesBrass Docs
Devices

Cannon blocks

The breeches, loader, drill, cast, shells and cartridges of Create Big Cannons read by a computer: open the breech on cue, set each fuze before it goes in, watch a cannon foundry.

Needs Create Big Cannons

Every block on this page belongs to Create Big Cannons. Without that mod, there is no such block, and peripheral.find("sliding_breech") returns nil.

Around a cannon of Create Big Cannons, many blocks have a job: the breech that opens to let munitions in, the Cannon Loader that rams them down the barrel, the fuze that decides when a shell bursts, and, in the foundry, the cast that moulds a barrel and the drill that bores it. A computer reads all of them and sets what a player sets by hand: it opens the breech at the right moment, waits for the loader, gives every shell a fuze time computed for its target, and watches a foundry run unattended. The cannon itself, on its mount, has its own page: Cannon mounts.

Block (in game)peripheral typewhat it reads or sets
Sliding Breech (cast iron, bronze, steel)sliding_breechhow far it is open, whether something keeps it from closing
Screw Breech (steel, nethersteel)screw_breechhow far it is unlocked
Cannon Loadercannon_loaderhow far its rod is out, whether it moves, why it could not
Cannon Drillcannon_drillhow far it has bored, why it stopped, its water
Cannon Castcannon_casthow far the metal has set, why it will not cast, its molten metal
HE, Shrapnel, AP, Drop Mortar, Smoke and Fluid Shellsshellits fuze, which it sets, and its tracer
Big Cartridgebig_cartridgeits Nitropowder, and whether it got wet
Autocannon Ammo Containerautocannon_ammo_containerits tracer spacing, which it sets

Big Cannons has no ComputerCraft peripheral of its own: these methods read what Engineer's Goggles and the blocks' screens show. Against the computer a block is called by its side ("top"...); on a Data Cable (Minicomputer and newer) it gets a name such as shell@12,64,-30. The easiest is peripheral.find:

Brass
local breech = peripheral.find("sliding_breech")
local shell = peripheral.find("shell")
print("breech " .. breech.state())
local fuze = shell.fuze()
if fuze then
  print(fuze.display, fuze.time)
end

Every method reads the block again when it is called, and numbers are rounded to 3 decimals. When something is wrong, the call stops the program with an error you can catch with pcall:

errorwhen
sliding breech removed, shell removed...the block was broken or replaced (its type, with spaces); see below for breeches and shells
peripheral is not loadedthe chunk of the block is not loaded
this version of Create Big Cannons has no getFuzeyour version of Big Cannons lacks that reading (the name at the end is the one missing)
Create Big Cannons error: ...the block itself failed while answering

Two cases where the block is gone without being broken: while a cannon is assembled on its mount, its breech is part of the moving cannon, not a block, so the breech's methods stop with sliding breech removed until the cannon is disassembled; and a shell pushed into a cannon is no longer a block either (shell removed).

Also kinetic blocks. The breeches, the loader and the drill turn: the wrapped block also has the methods of Create kinetic blocks, such as speed(), the speed of its shaft in RPM.

Also a tank or an inventory. The Autocannon Ammo Container is an Inventories too. The drill, the cast and the Fluid Shell hold a fluid but show their tank on some faces only: the drill at the two ends of its pipe, the cast on its top, the Fluid Shell on its head while it has no fuze. Through those faces they are also a Tanks. The drill and the cast have their own tanks(), which reads their tank whichever face touches the computer or the cable; it takes the place of the generic one and returns the same table.

Methods
breech.progress()The opening of the breech as a fraction: 0.5 is half open. It changes every tick while the shaft turns. Both breeches have it.
breech.state()"closed" at 0, "open" at 1, "partial" anywhere between. Only a fully open Sliding Breech lets a loader through, and only a fully unlocked Screw Breech can be moved away. Both breeches have it.
breech.blocked()true when a munition sits in the breech itself, or a loader's rod passes through it: the breech then does not close, whatever its shaft does (it still opens). Sliding Breech only: the Screw Breech has no blocked.
loader.extension()0 when the rod is all in, up to the number of its poles when it is all out, with fractions while it moves.
loader.moving()true from the moment the rod sets off until it is set down again as blocks. The loader sets off at the tick after its shaft changes, so give it a moment before asking:
loader.problem()The message Create shows for it, such as The Piston is missing some extension Poles or There are too many extension Poles attached to this Piston... (in English here; the game may give it in its own language). A loader with a problem does not move at all.
drill.extension()0 when the drill is all in, more as its bit goes along the cannon, with fractions while it moves.
drill.moving()true from the moment the drill sets off until its rod is set down again as blocks. It stays true while the drill waits on a problem: the rod is out but still, and extension() stops changing.
drill.boring()true while the bit cuts into a cannon block, at the pace the lathe allows; false while it moves through hollow or bored blocks, or waits on a problem.
drill.problem()Why the drill stopped. The problem stays until the drill's speed changes, even once the cause is gone.
drill.tanks()The water of the drill, in the shape of tank.tanks(): one entry, fluid "minecraft:water" or nil when empty, amount and capacity (1000) in mB. It reads the tank whichever face of the drill touches the computer or the cable.
cast.progress()0 while the cast fills: setting only starts once it is full. Then it grows to 1. At the end the cast becomes a Finished Cannon Cast in the same tick, so a program rarely reads 1: it gets cannon cast removed instead, which pcall turns into the signal that the cast is done.
cast.problem()Set when the cast is full of a metal that Big Cannons cannot cast in the shape of one of its layers, with its message: Cannon cast at [x, y, z] does not have a valid recipe for fluid ... and shape .... The cast then does not set: drain it and pour a metal that fits.
cast.tanks()The metal in the cast, in the shape of tank.tanks(): one entry, capacity being the metal the whole cast needs. The cast shows its tank only through its top, where the metal is poured; this reads it whichever face touches the computer or the cable.
shell.fuze()The fuze on the shell. name is its item id ("createbigcannons:timed_fuze"), display its name as the game shows it. time, in ticks, is there for a timed or delayed fuze that has a time; a fuze never set has none, and a Timed Fuze without a time bursts as soon as the shell flies, so set it. distance, in blocks, is there for a Proximity Fuze.
shell.set_fuze_time(ticks)On a Timed Fuze, the time from the shot to the burst, kept between 1 and 495 ticks (almost 25 seconds); its screen moves by steps of 5, a program sets any whole number. On a Delayed Impact or Delayed Inertia Fuze, the delay between the impact and the burst, from 1 to 100 ticks. Returns the value kept. The fuze gets it at the end of the tick, so fuze() in the same tick still shows the old time.
shell.set_fuze_distance(blocks)On a Proximity Fuze, how close to a block (or an entity) the shell bursts, kept between 1 and 32 blocks. Returns the value kept; the fuze gets it at the end of the tick. Any other fuze, or none, stops the program with the shell has no proximity fuze.
shell.tracer()true when a Tracer Tip has been put on the shell (on any face): its flight then shows as a bright trail.
cart.charges()0 for an empty cartridge, up to max_charges() for a full one: the more levels, the stronger the shot.
cart.max_charges()4 with the mod's default data, which sets it.
cart.damp()A cartridge that water reached is damp. With Big Cannons' default settings, damp propellant is weaker, and it does not fire when it is the first propellant behind the shell. Out of the water, it dries by itself after a while.
box.tracer_spacing()1 makes every round a tracer, as long as tracers remain; 6 one round in six.
box.set_tracer_spacing(rounds)Sets the spacing as the container's screen does, at once. The value is kept between 1 and 6; a number with decimals stops the program with bad argument #1 to 'set_tracer_spacing' (number has no integer representation).

Breeches

A breech closes the back of a big cannon. Its shaft opens and closes it: turned one way it opens, the other way it closes, faster with a faster shaft (each tick it moves by RPM / 512 of the way: 0.8 seconds from closed to open at 32 RPM). Without rotation it stays where it is.

  • The Sliding Breech lets munitions through once it is fully open: a Cannon Loader pushes the shell and its charges through it into the barrel. It does not close while a munition or the loader's rod is still in it.
  • The Screw Breech lets nothing through. Once fully unlocked ("open"), a contraption moves it out of the way for loading, then puts it back to be closed.

A cannon is loaded while it is blocks, and assembled and fired with its breech closed. With the breech open as well as the muzzle, the mount refuses to assemble it (Cannon must have exactly one opening and exactly one closed end).

A simple way to drive the breech from a program: put a Gearshift on its shaft, and reverse it with the computer's redstone (rs.set). Each method below says which breeches have it.

#

breech.progress()

→ number

The opening of the breech as a fraction: 0.5 is half open. It changes every tick while the shaft turns. Both breeches have it.

Returns
number
how far the breech is open, from 0 (closed) to 1 (fully open)
Brass
local breech = peripheral.find("sliding_breech")
print(math.floor(breech.progress() * 100) .. " % open")

See also breech.state()

#

breech.state()

→ string

"closed" at 0, "open" at 1, "partial" anywhere between. Only a fully open Sliding Breech lets a loader through, and only a fully unlocked Screw Breech can be moved away. Both breeches have it.

Returns
string
"closed", "partial" or "open"
Brass
rs.set("left", false)   -- the Gearshift on the breech's shaft: no signal opens it
while breech.state() ~= "open" do
  sleep(0.1)
end
print("ready to load")

See also breech.progress() breech.blocked()

#

breech.blocked()

→ boolean

true when a munition sits in the breech itself, or a loader's rod passes through it: the breech then does not close, whatever its shaft does (it still opens). Sliding Breech only: the Screw Breech has no blocked.

Returns
boolean
true when something keeps the breech from closing

Check it before closing, after the rod is back:

Brass
if breech.blocked() then
  print("cannot close: something is left in the breech")
else
  rs.set("left", true)  -- reverse the shaft: the breech closes
end

See also breech.state()

Cannon Loader

The Cannon Loader works like a Mechanical Piston. Piston Extension Poles give its reach, and a Ram Head at its front pushes the munitions lined up in front of it (a shell, then its charges) into the cannon, through the open breech; a Worm Head instead pulls munitions back out of a jammed cannon. Its shaft drives it, one way out and the other way back, at RPM / 512 blocks per tick like a piston: 1.25 blocks per second at 32 RPM.

At the end of its poles it stops and sets its rod down as blocks, like a piston, and stays there until its shaft changes speed or direction. A Sequenced Gearshift moves it by an exact number of blocks, which sequenced_gearshift.move() does from a program.

The cannon must be disassembled (blocks) while it loads, and the rod back out of it before it is assembled again: otherwise the mount refuses (Cannon block at [...] contains a cannon loader part).

#

loader.extension()

→ number

0 when the rod is all in, up to the number of its poles when it is all out, with fractions while it moves.

Returns
number
how far the rod is out, in blocks
Brass
local loader = peripheral.find("cannon_loader")
print("rod out by " .. loader.extension() .. " blocks")

See also cannon_loader.moving()

#

loader.moving()

→ boolean

true from the moment the rod sets off until it is set down again as blocks. The loader sets off at the tick after its shaft changes, so give it a moment before asking:

Returns
boolean
true while the rod moves
Brass
local gear = peripheral.find("sequenced_gearshift")
gear.move(4)        -- push 4 blocks in
sleep(0.2)
while loader.moving() do
  sleep(0.1)
end
print("loaded")

See also cannon_loader.extension() cannon_loader.problem()

#

loader.problem()

→ string

The message Create shows for it, such as The Piston is missing some extension Poles or There are too many extension Poles attached to this Piston... (in English here; the game may give it in its own language). A loader with a problem does not move at all.

Returns
string
why the loader could not set off, nil when its last start went well
Brass
local p = loader.problem()
if p then
  print("loader stuck: " .. p)
end

See also cannon_loader.moving()

Cannon Drill

The Cannon Drill bores a cast cannon block into a barrel. The block turns on a lathe (a Mechanical Bearing holding it, facing the drill), and the drill, a pole mover like the loader with a Cannon Drill Bit at its head, pushes into it along its axis. It needs two things:

  • Water. It holds 1000 mB of water (nothing else), piped in at either end of its pipe. Boring uses it, more as the lathe turns faster.
  • Speed. Its shaft must turn at least as fast as the lathe.

When one is missing, the drill stops where it is and notes the problem. It does not start again by itself once water flows or the lathe slows down: only a change of the drill's own speed makes it try again. A Rotation Speed Controller driving the drill does that from a program (speed_controller.set_target_speed()).

#

drill.extension()

→ number

0 when the drill is all in, more as its bit goes along the cannon, with fractions while it moves.

Returns
number
how far the bit has gone, in blocks
Brass
local drill = peripheral.find("cannon_drill")
print("bit at " .. drill.extension() .. " blocks")

See also cannon_drill.boring()

#

drill.moving()

→ boolean

true from the moment the drill sets off until its rod is set down again as blocks. It stays true while the drill waits on a problem: the rod is out but still, and extension() stops changing.

Returns
boolean
true while the bit is out as a moving contraption

See also cannon_drill.problem()

#

drill.boring()

→ boolean

true while the bit cuts into a cannon block, at the pace the lathe allows; false while it moves through hollow or bored blocks, or waits on a problem.

Returns
boolean
true while the drill bores a block
Brass
print(drill.boring() and "boring" or "idle")

See also cannon_drill.problem()

#

drill.problem()

→ string

Why the drill stopped. The problem stays until the drill's speed changes, even once the cause is gone.

Returns
string
"dry_bore" (no water), "too_weak" (lathe faster than the drill), nil when it works

This keeps a drill going without a player: a Rotation Speed Controller drives it, and whenever it is dry, the program changes its speed by 1 RPM, which makes it try again (if the water is still missing, it stops again at once).

Brass
local drill = peripheral.find("cannon_drill")
local ctrl = peripheral.find("speed_controller")  -- drives the drill, below 256 RPM
local base = ctrl.target_speed()
local step = 0
while true do
  if drill.problem() == "dry_bore" then
    step = 1 - step                                -- any new speed restarts the drill
    ctrl.set_target_speed(base + step)
  end
  sleep(5)
end

See also cannon_drill.tanks()

#

drill.tanks()

→ table

The water of the drill, in the shape of tank.tanks(): one entry, fluid "minecraft:water" or nil when empty, amount and capacity (1000) in mB. It reads the tank whichever face of the drill touches the computer or the cable.

Returns
table
a list with its water tank, {fluid =, amount =, capacity =}
Brass
local water = drill.tanks()[1]
print("water " .. water.amount .. " / " .. water.capacity .. " mB")

See also tank.tanks()

Cannon Cast

A Cannon Cast is a mould of Casting Sand, built layer by layer with cast moulds, one layer for each block of the cannon; layers stacked on each other make one cast, filled with molten metal from above. Every block of the cast answers for the whole cast, so the computer may touch any of them.

Once full, the metal sets: 2 minutes for cast iron or bronze, 3 for steel (the mod's data gives each metal its time). Then the cast turns into a Finished Cannon Cast, which is not a peripheral: from then on the methods stop the program with cannon cast removed. While the block of the cast that holds its metal is missing, they stop it with cannon cast not ready.

#

cast.progress()

→ number

0 while the cast fills: setting only starts once it is full. Then it grows to 1. At the end the cast becomes a Finished Cannon Cast in the same tick, so a program rarely reads 1: it gets cannon cast removed instead, which pcall turns into the signal that the cast is done.

Returns
number
how far the metal has set, from 0 to 1
Brass
local cast = peripheral.find("cannon_cast")
while true do
  local r = pcall(cast.progress)
  if not r.ok then
    print("cast finished (or broken)")
    break
  end
  print(math.floor(r.value * 100) .. " % set")
  sleep(10)
end

See also cannon_cast.tanks()

#

cast.problem()

→ string

Set when the cast is full of a metal that Big Cannons cannot cast in the shape of one of its layers, with its message: Cannon cast at [x, y, z] does not have a valid recipe for fluid ... and shape .... The cast then does not set: drain it and pour a metal that fits.

Returns
string
why the cast will not set, nil when it is fine
Brass
local p = cast.problem()
if p then
  print(p)
end

See also cannon_cast.tanks()

#

cast.tanks()

→ table

The metal in the cast, in the shape of tank.tanks(): one entry, capacity being the metal the whole cast needs. The cast shows its tank only through its top, where the metal is poured; this reads it whichever face touches the computer or the cable.

Returns
table
a list with the molten metal of the whole cast, {fluid =, amount =, capacity =}
Brass
local t = cast.tanks()[1]
print((t.fluid or "empty") .. ": " .. t.amount .. " / " .. t.capacity .. " mB")

See also tank.tanks() cannon_cast.progress()

Shells and fuzes

The HE, Shrapnel, AP, Drop Mortar, Smoke and Fluid Shells are peripherals of type shell while they are placed as blocks, for instance in line in front of a Cannon Loader, waiting to go in. (Projectiles that take no fuze, such as Solid Shot, AP Shot or Mortar Stone, are not peripherals.) A fuze sits on the shell's head, or on its base for some shells, put there by hand or by a Deployer, and decides when the shell bursts. A program reads it, and sets it as the fuze's screen would:

fuzesettingmethodbounds
Timed Fuzetime from the shot to the burstset_fuze_time1 to 495 ticks
Delayed Impact Fuze, Delayed Inertia Fuzedelay from the impact to the burstset_fuze_time1 to 100 ticks
Proximity Fuzehow close to something it burstsset_fuze_distance1 to 32 blocks

Times are in ticks: 20 ticks make a second. When the loader pushes the shell into the cannon, the fuze goes in with it, setting included, and the shell is no longer a block a computer reaches: set the fuze before loading.

#

shell.fuze()

→ table

The fuze on the shell. name is its item id ("createbigcannons:timed_fuze"), display its name as the game shows it. time, in ticks, is there for a timed or delayed fuze that has a time; a fuze never set has none, and a Timed Fuze without a time bursts as soon as the shell flies, so set it. distance, in blocks, is there for a Proximity Fuze.

Returns
table
{name =, display =, time =, distance =}, nil when the shell has no fuze
Brass
local shell = peripheral.find("shell")
local f = shell.fuze()
if f == nil then
  print("no fuze")
elseif f.time then
  print(f.display .. ": " .. f.time / 20 .. " s")
else
  print(f.display)
end

See also shell.set_fuze_time() shell.set_fuze_distance()

#

shell.set_fuze_time(ticks)

→ number

On a Timed Fuze, the time from the shot to the burst, kept between 1 and 495 ticks (almost 25 seconds); its screen moves by steps of 5, a program sets any whole number. On a Delayed Impact or Delayed Inertia Fuze, the delay between the impact and the burst, from 1 to 100 ticks. Returns the value kept. The fuze gets it at the end of the tick, so fuze() in the same tick still shows the old time.

Parameters
ticks number
the time of the fuze, a whole number of ticks
Returns
number
the time kept

Any other fuze, or none, stops the program with the shell has no timed or delayed fuze; a number with decimals with bad argument #1 to 'set_fuze_time' (number has no integer representation).

An airburst. A timed fuze set a little under the flight time bursts the shell above its target. The flight time depends on the cannon, the charges and the angle: fire a few shots with a long fuze, note how long each one flies, and let the program work out the fuze for any distance from those notes:

Brass
-- flight times noted for this cannon and charge: {distance in blocks, ticks}
local FLIGHT = {{100, 40}, {200, 84}, {300, 134}}

-- the fuze time that bursts the shell `early` ticks before it reaches `distance`
local function fuze_for(distance, early)
  for i = 2, #FLIGHT do
    local a, b = FLIGHT[i - 1], FLIGHT[i]
    if distance <= b[1] then
      local t = a[2] + (b[2] - a[2]) * (distance - a[1]) / (b[1] - a[1])
      return math.max(1, math.min(495, math.floor(t - early)))
    end
  end
  return 495
end

print(fuze_for(150, 4))
print(fuze_for(250, 4))
Screen
58
105

In the game, shell.set_fuze_time(fuze_for(distance, 4)) sets it on the shell waiting in front of the loader.

See also shell.fuze()

#

shell.set_fuze_distance(blocks)

→ number

On a Proximity Fuze, how close to a block (or an entity) the shell bursts, kept between 1 and 32 blocks. Returns the value kept; the fuze gets it at the end of the tick. Any other fuze, or none, stops the program with the shell has no proximity fuze.

Parameters
blocks number
the distance, a whole number of blocks
Returns
number
the distance kept
Brass
shell.set_fuze_distance(4)   -- bursts 4 blocks short of what it meets

See also shell.fuze()

#

shell.tracer()

→ boolean

true when a Tracer Tip has been put on the shell (on any face): its flight then shows as a bright trail.

Returns
boolean
true when the shell carries a tracer

Big Cartridge

A Big Cartridge is a single block of propellant for big cannons. It is filled with Nitropowder as an item, before it is placed (by crafting or with a Deployer), one level at a time: the "Power" of its tooltip. Placed as a block, in line before a loader for instance, it is a peripheral.

#

cart.charges()

→ number

0 for an empty cartridge, up to max_charges() for a full one: the more levels, the stronger the shot.

Returns
number
the levels of Nitropowder it holds
Brass
local cart = peripheral.find("big_cartridge")
print("power " .. cart.charges() .. " / " .. cart.max_charges())

See also big_cartridge.max_charges()

#

cart.max_charges()

→ number

4 with the mod's default data, which sets it.

Returns
number
the most levels it holds
#

cart.damp()

→ boolean

A cartridge that water reached is damp. With Big Cannons' default settings, damp propellant is weaker, and it does not fire when it is the first propellant behind the shell. Out of the water, it dries by itself after a while.

Returns
boolean
true when the cartridge got wet
Brass
if cart.damp() then
  print("wet powder: let it dry")
end

Autocannon Ammo Container

An Autocannon Ammo Container holds autocannon rounds and tracer rounds, and feeds an autocannon once it is put on its breech. Its screen sets how often a tracer comes: one every 1 to 6 rounds. Placed as a block, it is a peripheral, and the setting stays in it when it is picked up and put on a breech. It is an Inventories too: slot 1 holds the rounds, slot 2 the tracers (the Creative Autocannon Ammo Container is not an inventory).

#

box.tracer_spacing()

→ number

1 makes every round a tracer, as long as tracers remain; 6 one round in six.

Returns
number
one tracer every that many rounds, from 1 to 6
Brass
local box = peripheral.find("autocannon_ammo_container")
print("a tracer every " .. box.tracer_spacing() .. " rounds")

See also autocannon_ammo_container.set_tracer_spacing()

#

box.set_tracer_spacing(rounds)

→ number

Sets the spacing as the container's screen does, at once. The value is kept between 1 and 6; a number with decimals stops the program with bad argument #1 to 'set_tracer_spacing' (number has no integer representation).

Parameters
rounds number
one tracer every that many rounds, a whole number
Returns
number
the spacing kept, from 1 to 6
Brass
box.set_tracer_spacing(3)

See also autocannon_ammo_container.tracer_spacing()

A cannon that reloads itself

A complete program for a big cannon on a Cannon Mount, with a Sliding Breech and a Cannon Loader behind it. The munitions arrive in line in front of the loader's Ram Head, a shell first (placed by a Deployer, for instance) with its charges behind. On every round the program opens the breech, sets the shell's Timed Fuze, rams the munitions in, pulls the rod back, closes the breech, then assembles, aims and fires.

The build: a Gearshift on the breech's shaft, on the left of the computer (no signal opens, a signal closes: swap true and false if yours turns the other way); a Sequenced Gearshift on the loader's shaft; the mount, the breech, the loader, the gearshift and the shell's place on the computer's Data Cable.

Brass
local gun = peripheral.find("cannon_mount")
local loader = peripheral.find("cannon_loader")
local gear = peripheral.find("sequenced_gearshift")  -- drives the loader
local RAM = 5      -- blocks the rod travels to push the munitions in
local BURST = 60   -- fuze time: the shell bursts 3 seconds after the shot

gun.disassemble()  -- the breech is a block only while the cannon is not assembled
sleep(1)
local breech = peripheral.find("sliding_breech")
assert(breech, "no sliding breech found")

local function set_breech(state)
  rs.set("left", state == "closed")
  while breech.state() ~= state do
    sleep(0.1)
  end
end

local function move_rod(speed)
  gear.move(RAM, speed)
  sleep(0.2)
  while gear.running() or loader.moving() do
    sleep(0.1)
  end
  assert(loader.problem() == nil, loader.problem())
end

while true do
  local shell = peripheral.find("shell")
  if shell == nil then
    print("waiting for a shell in front of the loader")
    sleep(5)
  else
    set_breech("open")
    local fuze = shell.fuze()
    if fuze and fuze.name == "createbigcannons:timed_fuze" then
      shell.set_fuze_time(BURST)
    end
    move_rod(1)    -- the shell and its charges go in
    move_rod(-1)   -- the rod comes back out
    assert(not breech.blocked(), "something is left in the breech")
    set_breech("closed")
    gun.assemble()
    gun.aim(180, 30)
    while not gun.on_target() do
      sleep(0.1)
    end
    gun.fire()
    sleep(2)
    gun.disassemble()
    sleep(1)
  end
end

The fuze is written at the end of the tick, before the loader sets off. To burst the shells over a target at a known distance, replace BURST by the fuze_for of shell.set_fuze_time(), and the angles of aim by those of the target (see Cannon mounts).