function eraser.init()
 local gun_barrel = load_particle("eraser_gun_barrel.obj")
 local gun_light = load_particle("eraser_gun_light.obj")

 local locker = load_particle("eraser_locker.obj")
 local arc = load_particle("eraser_arc.obj")

 local arc_thickness = 1.2

 function eraser.gun(worm)
  worm:shoot(gun_barrel, 1, 3, 0, 0, 0, 0, 0, 0)
  local lights = worm:data().eraser_lights
  if lights then
   lights = lights + 1
   if lights < 100 then
    worm:shoot(gun_light, 1, 0, 0, 0, 0, 0, 0, math.floor(lights/20)+3)
   end
   if lights == 200 then
    lights = 0
   end
  else
   lights = 0
  end
  worm:data().eraser_lights = lights
 end

 function eraser.shoot(worm)
  worm:shoot(locker, 1, 1, 0, 0, 0, 0, 0, 0)
 end

 function eraser.locked(object, target)
  worm = object:player():worm()
  local x1, y1 = worm:pos()
  local angle = object:angle()
  local x2, y2
  if target then
   x2, y2 = target:pos()
  else
   x2, y2 = object:pos()
  end
  local arc_sections = vector_distance(x1, y1, x2, y2) * arc_thickness
  local dx = (x2-x1)/arc_sections
  local dy = (y2-y1)/arc_sections
  local arcx, arcy = angle_vector(angle+90, 10)
  local arc1 = worm:shoot(arc, 1, 0, 0, 0, 0, 0, 0, 0)
  local arc2 = worm:shoot(arc, 1, 0, 0, 0, 0, 0, 0, 0)
  local arc3 = worm:shoot(arc, 1, 0, 0, 0, 0, 0, 0, 0)
  for a=1, arc_sections - 1 do
   local sin = math.sin((a/arc_sections)^0.7*3.14)
   arc1:set_pos(x1+a*dx + sin*arcx, y1+a*dy + sin*arcy)
   arc2:set_pos(x1+a*dx - sin*arcx, y1+a*dy - sin*arcy)
   arc3:set_pos(x1+a*dx + sin*arcx*0.2, y1+a*dy + sin*arcy*0.2)
   arc1 = arc1:shoot(arc, 1, 0, 0, 0, 0, 0, 0, 0.2)
   arc2 = arc2:shoot(arc, 1, 0, 0, 0, 0, 0, 0, 0.2)
   arc3 = arc3:shoot(arc, 1, 0, 0, 0, 0, 0, 0, 0.2)
  end
  arc1:set_pos(x2, y2)
  arc2:set_pos(x2, y2)
  arc3:set_pos(x2, y2)
 end
end
