From 1c3f8c7807a95fa754abe620758cba90b491667d Mon Sep 17 00:00:00 2001 From: LemADEC Date: Sat, 23 Aug 2014 13:04:29 +0200 Subject: [PATCH] Bug fixes & core version bump Bumped core version due to interfaces changes Fixed cloaking lua script due to cleanup (frequency isn't needed) Fixed radar ping script (it would never find anything) Improved radar scripts to accept any radar connection Fixed laser lift pushing down entities already on the ground Fixed laser lift laser effect --- .../warpdrive/lua/cloakingdevicecore/cloak1 | 1 - .../warpdrive/lua/cloakingdevicecore/cloak2 | 1 - src/assets/warpdrive/lua/radar/ping | 27 +++++--- src/assets/warpdrive/lua/radar/scan | 64 +++++++++++-------- .../WarpDrive/machines/TileEntityLift.java | 4 +- src/cr0s/WarpDriveCore/WCDummyContainer.java | 2 +- 6 files changed, 60 insertions(+), 39 deletions(-) diff --git a/src/assets/warpdrive/lua/cloakingdevicecore/cloak1 b/src/assets/warpdrive/lua/cloakingdevicecore/cloak1 index 291b310c..6ad590e4 100644 --- a/src/assets/warpdrive/lua/cloakingdevicecore/cloak1 +++ b/src/assets/warpdrive/lua/cloakingdevicecore/cloak1 @@ -18,7 +18,6 @@ if warp == nil then term.setTextColor(colors.white) term.write("No cloak core detected") else - warp.setFieldFrequency(1337) warp.setFieldTier(0) warp.enableCloakingField() if warp.isAssemblyValid() then diff --git a/src/assets/warpdrive/lua/cloakingdevicecore/cloak2 b/src/assets/warpdrive/lua/cloakingdevicecore/cloak2 index 7d5be518..7318e27a 100644 --- a/src/assets/warpdrive/lua/cloakingdevicecore/cloak2 +++ b/src/assets/warpdrive/lua/cloakingdevicecore/cloak2 @@ -18,7 +18,6 @@ if warp == nil then term.setTextColor(colors.white) term.write("No cloak core detected") else - warp.setFieldFrequency(1337) warp.setFieldTier(2) warp.enableCloakingField() if warp.isAssemblyValid() then diff --git a/src/assets/warpdrive/lua/radar/ping b/src/assets/warpdrive/lua/radar/ping index c3dd4cf0..f791d506 100644 --- a/src/assets/warpdrive/lua/radar/ping +++ b/src/assets/warpdrive/lua/radar/ping @@ -1,4 +1,16 @@ -side = "bottom" +if not term.isColor() then + print("Advanced computer required") + exit() +end + +sides = peripheral.getNames() +mininglasers = {} +for key,side in pairs(sides) do + if peripheral.getType(side) == "radar" then + print("Wrapping " .. side) + radar = peripheral.wrap(side) + end +end local argv = { ... } if #argv ~= 1 then @@ -13,10 +25,8 @@ if radius < 1 or radius > 9999 then return end -radar = peripheral.wrap(side) - if radar.getEnergyLevel() < radius * radius then - print("Low energy level. Sasaj") + print("Low energy level...") return end radar.scanRadius(radius) @@ -25,17 +35,18 @@ sleep(2) print("Scanning...") local seconds = 2 +local count = nil repeat - local count = radar.getResultsCount() - sleep(1) - seconds = seconds + 1 + count = radar.getResultsCount() + sleep(1) + seconds = seconds + 1 until count ~= nil or seconds > 10 print("took "..seconds.." seconds") if count ~= nil then for i=0, count-1 do freq, x, y, z = radar.getResult(i) - print("Shit: "..freq.." ("..x.. " " .. y .. " " .. z .. ")") + print("Ship '"..freq.."' @ ("..x.. " " .. y .. " " .. z .. ")") end else print("Nothing is found =(") diff --git a/src/assets/warpdrive/lua/radar/scan b/src/assets/warpdrive/lua/radar/scan index f8ad2805..35a7e054 100644 --- a/src/assets/warpdrive/lua/radar/scan +++ b/src/assets/warpdrive/lua/radar/scan @@ -1,43 +1,55 @@ -radar = peripheral.wrap("bottom") radius = 500 scale = 50 +if not term.isColor() then + print("Advanced computer required") + exit() +end + +sides = peripheral.getNames() +mininglasers = {} +for key,side in pairs(sides) do + if peripheral.getType(side) == "radar" then + print("Wrapping " .. side) + radar = peripheral.wrap(side) + end +end + w, h = term.getSize() term.clear() function colorScreen(color) for a = 2,w-1 do - for b = 1,h do - paintutils.drawPixel(a,b,color) - end + for b = 1,h do + paintutils.drawPixel(a,b,color) + end end end function textOut(x, y, text, fg, bg) - term.setCursorPos(x, y) - term.setTextColor(fg) - term.setBackgroundColor(bg) - term.write(text) - local xt,yt = term.getCursorPos() - term.setCursorPos(1, yt + 1) + term.setCursorPos(x, y) + term.setTextColor(fg) + term.setBackgroundColor(bg) + term.write(text) + local xt,yt = term.getCursorPos() + term.setCursorPos(1, yt + 1) end function translateXZ(oldX, oldZ, i) - local x = radarX - oldX - local z = radarZ - oldZ - - x = x / (radius / scale) - z = z / (radius / scale) - - x = x + (w / 2) - z = z + (h / 2) - - - x = math.floor(x); - z = math.floor(z); - - return x,z + local x = radarX - oldX + local z = radarZ - oldZ + + x = x / (radius / scale) + z = z / (radius / scale) + + x = x + (w / 2) + z = z + (h / 2) + + x = math.floor(x); + z = math.floor(z); + + return x,z end function drawContact(x, y, z, name, color) @@ -94,8 +106,8 @@ end mrun = true while (mrun) do - radarX, radarY, radarZ = radar.pos(); - scanAndDraw(); + radarX, radarY, radarZ = radar.pos(); + scanAndDraw(); end term.clear(); diff --git a/src/cr0s/WarpDrive/machines/TileEntityLift.java b/src/cr0s/WarpDrive/machines/TileEntityLift.java index 23feaa5e..b922806f 100644 --- a/src/cr0s/WarpDrive/machines/TileEntityLift.java +++ b/src/cr0s/WarpDrive/machines/TileEntityLift.java @@ -117,13 +117,13 @@ public class TileEntityLift extends WarpEnergyTE implements IPeripheral { } } } else if (mode == MODE_DOWN) { - AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xmin, firstUncoveredY + 2, zmin, xmax, yCoord + 2, zmax); + AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xmin, firstUncoveredY + 3, zmin, xmax, yCoord + 2, zmax); List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, aabb); if (list != null) { for (Object o : list) { if (o != null && o instanceof EntityLivingBase && consumeEnergy(WarpDriveConfig.LL_LIFT_ENERGY, true)) { ((EntityLivingBase)o).setPositionAndUpdate(xCoord + 0.5f, firstUncoveredY + 1, zCoord + 0.5f); - WarpDrive.sendLaserPacket(worldObj, new Vector3(this).translate(0.5), new Vector3(xCoord, firstUncoveredY + 1, zCoord).translate(0.5), 1F, 1F, 0F, 40, 0, 100); + WarpDrive.sendLaserPacket(worldObj, new Vector3(this).translate(0.5), new Vector3(xCoord, firstUncoveredY + 0.5, zCoord).translate(0.5), 1F, 1F, 0F, 40, 0, 100); worldObj.playSoundEffect(xCoord + 0.5f, yCoord, zCoord + 0.5f, "warpdrive:hilaser", 4F, 1F); consumeEnergy(WarpDriveConfig.LL_LIFT_ENERGY, true); } diff --git a/src/cr0s/WarpDriveCore/WCDummyContainer.java b/src/cr0s/WarpDriveCore/WCDummyContainer.java index 67a5a150..04cc9653 100644 --- a/src/cr0s/WarpDriveCore/WCDummyContainer.java +++ b/src/cr0s/WarpDriveCore/WCDummyContainer.java @@ -21,7 +21,7 @@ public class WCDummyContainer extends DummyModContainer ModMetadata meta = getMetadata(); meta.modId = "WarpDriveCore"; meta.name = "WarpDriveCore"; - meta.version = "1.0.0.2"; + meta.version = "1.0.0.3"; meta.credits = "Cr0s"; meta.authorList = Arrays.asList("cr0s"); meta.description = "";