Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Bizzycola

Members
  • Content Count

    3
  • Joined

  • Last visited

  • Days Won

    1

Bizzycola last won the day on May 4 2014

Bizzycola had the most liked content!

1 Follower

About Bizzycola

  • Rank
    Junior Member
  • Birthday 01/25/1995

Contact Methods

  • Website URL
    http://bizzycola.pcldns.com/
  • Minecraft
    Bizzycola
  • GitHub
    bizzycola

Profile Information

  • Gender
    Male
  • Location
    NSW, Australia
  • Interests
    Programming, video games, OC..

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Well, this all sounds amazing! I can't wait!
  2. If you don't have ICBM Component: http://oc.cil.li/index.php?/topic/64-mc-164oc-12icbm-component/ I created a server and client recently for my own ICBM use. It may not be perfect but it stores waypoints and can even open a silo door(well, it outputs redstone) Here is the server, you may want to remove the thing that requires redstone output to fire: -- explode(seperator, string) function explode(d,p) local t, ll t={} ll=0 if(#p == 1) then return {p} end while true do l=string.find(p,d,ll,true) -- find the next d in the string if l~=nil then -- if "not not" found then.. table.insert(t, string.sub(p,ll,l-1)) -- Save it in our array. ll=l+1 -- save just after where we found it for searching next time. else table.insert(t, string.sub(p,ll)) -- Save what's left in our array. break -- Break at end, as it should be, according to the lua manual. end end return t end local sides = require("sides") local event = require("event") local component = require("component") local icbm = component.icbm_bridge local modem = component.modem local rs = component.redstone modem.open(284) io.write("Listening..\n") while true do local scc, _, from, port, _, message = event.pull(3, "modem_message") if port == 284 then local tbl = explode("::", message) if #tbl > 0 then local cmd = tbl[1] if cmd == "launch" then if not icbm.isConnected() then modem.send(from, port, "Server not connected to launcher bridge.") elseif not icbm.canLaunch() then modem.send(from, port, "Failed to launch: "..icbm.getStatus()) elseif rs.getOutput(sides.top) > 0 then modem.send(from, port, "The silo door is closed.") else local x,y,z = icbm.getTarget() io.write("Missile fired at: "..x..", "..y..", "..z..".\n") icbm.launch() modem.send(from, port, "launch::success") end elseif cmd == "setcoords" then if #tbl < 4 then modem.send(from, port, "Invalid arguments. Usage: setcoords::x,y,z") else if not icbm.isConnected() then modem.send(from, port, "Server not connected to launcher bridge.") else --io.write("Setting target: "..tbl[2].."::"..tbl[3].."::"..tbl[4]..".\n") tbl[2] = string.gsub(tbl[2], "%:", "") tbl[3] = string.gsub(tbl[3], "%:", "") tbl[4] = string.gsub(tbl[4], "%:", "") io.write("Setting target: "..tonumber(tbl[2])..", "..tonumber(tbl[3])..", "..tonumber(tbl[4])..".\n") icbm.setTarget(tonumber(tbl[2]), tonumber(tbl[3]), tonumber(tbl[4])) modem.send(from, port, "setcoords::success") end end elseif cmd == "opendoor" then rs.setOutput(sides.top, 0) modem.send(from, port, "opendoor::success") elseif cmd == "closedoor" then rs.setOutput(sides.top, 255) modem.send(from, port, "closedoor::success") else modem.send(from, port, "Invalid command: "..tbl[1]) end else modem.send(from, port, "No command sent.") end end end Here is the client, you may want to make these more secure too. Change the variable at the top to point to the location you want your marker file to be stored. -- explode(seperator, string) function explode(d,p) local t, ll t={} ll=0 if(#p == 1) then return {p} end while true do l=string.find(p,d,ll,true) -- find the next d in the string if l~=nil then -- if "not not" found then.. table.insert(t, string.sub(p,ll,l-1)) -- Save it in our array. ll=l+1 -- save just after where we found it for searching next time. else table.insert(t, string.sub(p,ll)) -- Save what's left in our array. break -- Break at end, as it should be, according to the lua manual. end end return t end local args = {...} local markerFile = "/mnt/d79/icbm_markers.dat" local serial = require("serialization") local event = require("event") local fs = require("filesystem") local component = require("component") local modem = component.modem modem.open(284) local markers = {} if fs.exists(markerFile) then local fll = io.open(markerFile, "r") local data = fll:read(fs.size(markerFile)) markers = serial.unserialize(data) fll:close() end function launch() print("Launching..") local sent = modem.broadcast(284, "launch::") if not sent then print("Launch failed: failed to send required network message(unknown error occured).") else local scc, _, from, port, _, message = event.pull(3, "modem_message") if not scc then print("Launch inconclusive: The message was sent but the server failed to respond, the missile may or may not have been sent(timeout occured).") else if message == "launch::success" then print("Launch Success: The server has reported that the ICBM has been launched successfully!") else print("Launch Error: "..message) end end end end function openDoor() print("Opening silo...") local sent = modem.broadcast(284, "opendoor::") if not sent then print("Operation failed: failed to send required network message(unknown error occured).") else local scc, _, from, port, _, message = event.pull(3, "modem_message") if not scc then print("Operatin inconclusive: The message was sent but the server failed to respond, the missile may or may not have been sent(timeout occured).\nThis means the door may not have opened. DO NOT LAUNCH.") else if message == "opendoor::success" then print("Door has been opened!") else print("Operation Error: "..message) end end end end function closeDoor() print("Closing silo...") local sent = modem.broadcast(284, "opendoor::") if not sent then print("Operation failed: failed to send required network message(unknown error occured).") else local scc, _, from, port, _, message = event.pull(3, "modem_message") if not scc then print("Operatin inconclusive: The message was sent but the server failed to respond, the missile may or may not have been sent(timeout occured).") else if message == "closedoor::success" then print("Silo has been closed!") else print("Operation Error: "..message) end end end end function setcoords(x,y,z) print("Setting launcher Coordinates("..x..","..y..","..z..")..") local sent = modem.broadcast(284, "setcoords::"..x.."::"..y.."::"..z) if not sent then print("Set Coords Error: The message couldnt't be sent(unknown network error)") else local scc, _, from, port, _, message = event.pull(3, "modem_message") if not scc then print("Set Coords Inconclusive: The network message was sent but the server did not respond(maybe it isn't running?).") else if message == "setcoords::success" then print("The server says the launcher coords were set successfully!") else print("Set Coords Error: "..message) end end end end function createMarker(args) if #args < 5 then print("usage: icbm createmarker [name] [x] [y] [z]") else markers[args[2]] = args[3]..","..args[4]..","..args[5] print("Saved marker '"..args[2].."' ("..args[3]..","..args[4]..","..args[5]..").") end end function listMarkers(markers) for k,v in pairs(markers) do print(k, v) end end function setMarker(args) if #args < 2 then print("Usage: icbm setmarker [name]") else if not markers[args[2]] then print("No marker with that name could be found("..args[2]..")") else local tbl = explode(",", markers[args[2]]) setcoords(tbl[1],tbl[2],tbl[3]) end end end if #args < 1 then print("Usage: icbm [command] (try help)") else if args[1] == "help" then print("Commands:\nlaunch (Launches the ICBM)") print("setcoords [x] [y] [z] (Set the ICBM launcher coords)") print("createmarker [name] [x] [y] [z] (Creates a marker with the specified name and coords)") print("setmarker [name] (Sets the ICBM launcher to the coords stored in the marker with the specified name)") prin("opensilo (opens the missile silo)") prin("closesilo (closes the missile silo)") elseif args[1] == "launch" then launch() elseif args[1] == "setcoords" then if #args < 4 then print("Usage: icbm setcoords [x] [y] [z]") else setcoords(args) end elseif args[1] == "createmarker" then createMarker(args) elseif args[1] == "setmarker" then setMarker(args) elseif args[1] == "listmarkers" then listMarkers(markers) elseif args[1] == "opensilo" then openDoor() elseif args[1] == "closesilo" then closeDoor() else print("Unknown Command.\nUsage: icbm [command] (try help)") end end local fl = io.open(markerFile, "w") fl:write(serial.serialize(markers)) fl:close()
  3. Welcome to the official thread for the one and (quite likely)only ICBM Component mod! This mod adds a new block(or 3 on hard mode) for interfacing with ICBM launcher controllers via OpenComputers. This mod doesn't require ComputerCraft at all! Note: This mod doesn't have it's own Creative tab, the comonent(s) show up in the OpenComputers tab. Download You can get the latest builds from the jenkin's server: http://pc-logix.com/mods/ICBMComponent/artifacts/ You can find the source code on github, here: https://github.com/bizzycola/ICBMComponent/ Easy Mode This is the default mode, it has one single block. The OC ICBM Component Block. This block, when placed next to the launch controller and connected to OC(via a cable or being next to it) will allow you to control the launcher via OC code. Recipe: Iron nugget, Microchip(Tier 1), iron Nugget Microchip(Tier 1), Printed Circuit Board(PCB), Microchip(Tier 1) Iron Nugget, Microchip(Tier 1), Iron Nugget (Note: This is the same recipe as the Tier 1 component in Hard Mode). Hard mode This mode has the same methods and everything as the easy mode, but it instead has 3 tiers of component block, as the ICBM mod has 3 tiers of launchers. In this mode you need higher tiers for higher tier launchers. So, a tier 1 component won't work with a tier 2 or 3 controller, but of course a tier 3 component will work with tier 1 and 2. At this time, all 3 blocks look the same, but have different crafting recipes. To enable hard mode, change the option in the ICBM Component config file. Tier 1 Component Compatible with: Tier 1 launcher Recipe: Iron nugget, Microchip(Tier 1), iron Nugget Microchip(Tier 1), Printed Circuit Board(PCB), Microchip(Tier 1) Iron Nugget, Microchip(Tier 1), Iron Nugget Tier 2 Component Compatible with: Tier 1 and Tier 2 launchers. Recipe: Iron nugget, Microchip(Tier 2), iron Nugget Microchip(Tier 2), Printed Circuit Board(PCB), Microchip(Tier 2) Iron Nugget, Microchip(Tier 2), Iron Nugget Tier 3 Component Compatible with: Tier 1, Tier 2 and Tier 3 launchers. Recipe: Iron nugget, Microchip(Tier 3), iron Nugget Microchip(Tier 3), Printed Circuit Board(PCB), Microchip(Tier 3) Iron Nugget, Microchip(Tier 3), Iron Nugget Okay, so as you can see, to go up a tier, just use the next tier of Microchip. These items used are part of the OpenComputers mod, which is obviously required! Here is the actual block: Methods These are the methods available in the mod: First off, to get the primary component: local component = require("component") local icbm = component.icbm_bridge Now, for the actual methods.. icbm.isConnected() --Returns true if the component is connected to a launcher, false otherwise. If you try to use any other methods when it isn't connect, it'll error. icbm.launch() --Launches the ICBM icbm.canLaunch() --Returns true if the launcher can launch, false otherwise. icbm.getStatus() --Returns a string of the controller status(will contain the error if it cannot launch) icbm.getMissileType() --Returns the name of the missile in the launcher x,y,z = icbm.getTarget() --Returns the coords of the target icbm.setTarget(x,y,z) --Sets the launcher target At this time the mod doesn't have support for turrets, radars, etc, but we're looking into it. Have fun! CREDITS Me --I started the mod and did some stuff Michiyo: Did most of the work, adding config, better detection, etc.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.