mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-29 02:14:47 +00:00
Fix several global definitions
There were a couple of programs which were defining global variables, or referencing undefined ones. This fixes all problems in the main rom files.
This commit is contained in:
parent
1ab5094b7f
commit
e664eb26a9
@ -62,7 +62,7 @@ function drawLine( startX, startY, endX, endY, nColour )
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local minX = math.min( startX, endX )
|
local minX, maxX, minY, maxY = math.min( startX, endX )
|
||||||
if minX == startX then
|
if minX == startX then
|
||||||
minY = startY
|
minY = startY
|
||||||
maxX = endX
|
maxX = endX
|
||||||
@ -122,7 +122,7 @@ function drawBox( startX, startY, endX, endY, nColour )
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local minX = math.min( startX, endX )
|
local minX, maxX, minY, maxY = math.min( startX, endX )
|
||||||
if minX == startX then
|
if minX == startX then
|
||||||
minY = startY
|
minY = startY
|
||||||
maxX = endX
|
maxX = endX
|
||||||
@ -166,7 +166,7 @@ function drawFilledBox( startX, startY, endX, endY, nColour )
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local minX = math.min( startX, endX )
|
local minX, maxX, minY, maxY = math.min( startX, endX )
|
||||||
if minX == startX then
|
if minX == startX then
|
||||||
minY = startY
|
minY = startY
|
||||||
maxX = endX
|
maxX = endX
|
||||||
|
@ -210,7 +210,7 @@ function multishell.getCurrent()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function multishell.launch( tProgramEnv, sProgramPath, ... )
|
function multishell.launch( tProgramEnv, sProgramPath, ... )
|
||||||
if type( tProgramArgs ) ~= "table" then
|
if type( tProgramEnv ) ~= "table" then
|
||||||
error( "bad argument #1 (expected table, got " .. type( tProgramEnv ) .. ")", 2 )
|
error( "bad argument #1 (expected table, got " .. type( tProgramEnv ) .. ")", 2 )
|
||||||
end
|
end
|
||||||
if type( sProgramPath ) ~= "string" then
|
if type( sProgramPath ) ~= "string" then
|
||||||
@ -264,7 +264,7 @@ while #tProcesses > 0 do
|
|||||||
-- Switch process
|
-- Switch process
|
||||||
local tabStart = 1
|
local tabStart = 1
|
||||||
for n=1,#tProcesses do
|
for n=1,#tProcesses do
|
||||||
tabEnd = tabStart + string.len( tProcesses[n].sTitle ) + 1
|
local tabEnd = tabStart + string.len( tProcesses[n].sTitle ) + 1
|
||||||
if x >= tabStart and x <= tabEnd then
|
if x >= tabStart and x <= tabEnd then
|
||||||
selectProcess( n )
|
selectProcess( n )
|
||||||
redrawMenu()
|
redrawMenu()
|
||||||
|
@ -197,7 +197,7 @@ local function loadLevel(nNum)
|
|||||||
fLevel = fs.open(sLevelD,"r")
|
fLevel = fs.open(sLevelD,"r")
|
||||||
fLevel.readLine()
|
fLevel.readLine()
|
||||||
for Line=2,Lines-1 do
|
for Line=2,Lines-1 do
|
||||||
sLine = fLevel.readLine()
|
local sLine = fLevel.readLine()
|
||||||
local chars = string.len(sLine)
|
local chars = string.len(sLine)
|
||||||
for char = 1, chars do
|
for char = 1, chars do
|
||||||
local el = string.sub(sLine,char,char)
|
local el = string.sub(sLine,char,char)
|
||||||
@ -313,7 +313,7 @@ local function drawMap()
|
|||||||
term.setBackgroundColor(cG)
|
term.setBackgroundColor(cG)
|
||||||
term.setCursorPos(XOrgin+x,YOrgin+y+1)
|
term.setCursorPos(XOrgin+x,YOrgin+y+1)
|
||||||
|
|
||||||
sSide = string.sub(st,1,1)
|
local sSide = string.sub(st,1,1)
|
||||||
if sSide == "a" then
|
if sSide == "a" then
|
||||||
print("^")
|
print("^")
|
||||||
elseif sSide == "b" then
|
elseif sSide == "b" then
|
||||||
@ -348,7 +348,7 @@ local function drawMap()
|
|||||||
term.setBackgroundColor(Cr)
|
term.setBackgroundColor(Cr)
|
||||||
term.setTextColor(colors.white)
|
term.setTextColor(colors.white)
|
||||||
term.setCursorPos(XOrgin+x,YOrgin+y+1)
|
term.setCursorPos(XOrgin+x,YOrgin+y+1)
|
||||||
sSide = string.sub(rb,1,1)
|
local sSide = string.sub(rb,1,1)
|
||||||
if sSide == "a" then
|
if sSide == "a" then
|
||||||
print("^")
|
print("^")
|
||||||
elseif sSide == "b" then
|
elseif sSide == "b" then
|
||||||
|
@ -276,7 +276,6 @@ local tMonsters = {
|
|||||||
local tRecipes = {
|
local tRecipes = {
|
||||||
["some planks"] = { "some wood" },
|
["some planks"] = { "some wood" },
|
||||||
["some sticks"] = { "some planks" },
|
["some sticks"] = { "some planks" },
|
||||||
["some sticks"] = { "some planks" },
|
|
||||||
["a crafting table"] = { "some planks" },
|
["a crafting table"] = { "some planks" },
|
||||||
["a furnace"] = { "some stone" },
|
["a furnace"] = { "some stone" },
|
||||||
["some torches"] = { "some sticks", "some coal" },
|
["some torches"] = { "some sticks", "some coal" },
|
||||||
@ -753,7 +752,6 @@ function commands.dig( _sDir, _sTool )
|
|||||||
tTool = inventory[ sTool ]
|
tTool = inventory[ sTool ]
|
||||||
end
|
end
|
||||||
|
|
||||||
local room = getRoom( x, y, z )
|
|
||||||
local bActuallyDigging = (room.exits[ _sDir ] ~= true)
|
local bActuallyDigging = (room.exits[ _sDir ] ~= true)
|
||||||
if bActuallyDigging then
|
if bActuallyDigging then
|
||||||
if sTool == nil or tTool.toolType ~= "pick" then
|
if sTool == nil or tTool.toolType ~= "pick" then
|
||||||
|
@ -87,11 +87,6 @@ elseif sCommand == "host" then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Close the channel
|
|
||||||
print( "Closing channel" )
|
|
||||||
modem.close( gps.CHANNEL_GPS )
|
|
||||||
|
|
||||||
else
|
else
|
||||||
-- "gps somethingelse"
|
-- "gps somethingelse"
|
||||||
-- Error
|
-- Error
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
local tArgs = { ... }
|
local tArgs = { ... }
|
||||||
|
local sTopic
|
||||||
if #tArgs > 0 then
|
if #tArgs > 0 then
|
||||||
sTopic = tArgs[1]
|
sTopic = tArgs[1]
|
||||||
else
|
else
|
||||||
|
@ -473,7 +473,7 @@ local function playGame()
|
|||||||
if testBlockAt(curBlock,curX,curY+1,curRot) then
|
if testBlockAt(curBlock,curX,curY+1,curRot) then
|
||||||
pitBlock(curBlock,curX,curY,curRot)
|
pitBlock(curBlock,curX,curY,curRot)
|
||||||
--detect rows that clear
|
--detect rows that clear
|
||||||
clearRows(rows)
|
clearRows()
|
||||||
|
|
||||||
curBlock=next
|
curBlock=next
|
||||||
curX=4
|
curX=4
|
||||||
|
@ -58,7 +58,7 @@ if sCommand == "host" then
|
|||||||
|
|
||||||
local tUsers = {}
|
local tUsers = {}
|
||||||
local nUsers = 0
|
local nUsers = 0
|
||||||
function send( sText, nUserID )
|
local function send( sText, nUserID )
|
||||||
if nUserID then
|
if nUserID then
|
||||||
local tUser = tUsers[ nUserID ]
|
local tUser = tUsers[ nUserID ]
|
||||||
if tUser then
|
if tUser then
|
||||||
@ -81,7 +81,7 @@ if sCommand == "host" then
|
|||||||
|
|
||||||
-- Setup ping pong
|
-- Setup ping pong
|
||||||
local tPingPongTimer = {}
|
local tPingPongTimer = {}
|
||||||
function ping( nUserID )
|
local function ping( nUserID )
|
||||||
local tUser = tUsers[ nUserID ]
|
local tUser = tUsers[ nUserID ]
|
||||||
rednet.send( tUser.nID, {
|
rednet.send( tUser.nID, {
|
||||||
sType = "ping to client",
|
sType = "ping to client",
|
||||||
@ -93,7 +93,7 @@ if sCommand == "host" then
|
|||||||
tPingPongTimer[ timer ] = nUserID
|
tPingPongTimer[ timer ] = nUserID
|
||||||
end
|
end
|
||||||
|
|
||||||
function printUsers()
|
local function printUsers()
|
||||||
local x,y = term.getCursorPos()
|
local x,y = term.getCursorPos()
|
||||||
term.setCursorPos( 1, y - 1 )
|
term.setCursorPos( 1, y - 1 )
|
||||||
term.clearLine()
|
term.clearLine()
|
||||||
@ -274,7 +274,7 @@ elseif sCommand == "join" then
|
|||||||
local bPingPonged = true
|
local bPingPonged = true
|
||||||
local pingPongTimer = os.startTimer( 0 )
|
local pingPongTimer = os.startTimer( 0 )
|
||||||
|
|
||||||
function ping()
|
local function ping()
|
||||||
rednet.send( nHostID, {
|
rednet.send( nHostID, {
|
||||||
sType = "ping to server",
|
sType = "ping to server",
|
||||||
nUserID = nUserID,
|
nUserID = nUserID,
|
||||||
@ -296,7 +296,7 @@ elseif sCommand == "join" then
|
|||||||
term.redirect( promptWindow )
|
term.redirect( promptWindow )
|
||||||
promptWindow.restoreCursor()
|
promptWindow.restoreCursor()
|
||||||
|
|
||||||
function drawTitle()
|
local function drawTitle()
|
||||||
local x,y = titleWindow.getCursorPos()
|
local x,y = titleWindow.getCursorPos()
|
||||||
local w,h = titleWindow.getSize()
|
local w,h = titleWindow.getSize()
|
||||||
local sTitle = sUsername.." on "..sHostname
|
local sTitle = sUsername.." on "..sHostname
|
||||||
@ -307,7 +307,7 @@ elseif sCommand == "join" then
|
|||||||
promptWindow.restoreCursor()
|
promptWindow.restoreCursor()
|
||||||
end
|
end
|
||||||
|
|
||||||
function printMessage( sMessage )
|
local function printMessage( sMessage )
|
||||||
term.redirect( historyWindow )
|
term.redirect( historyWindow )
|
||||||
print()
|
print()
|
||||||
if string.match( sMessage, "^%*" ) then
|
if string.match( sMessage, "^%*" ) then
|
||||||
|
Loading…
Reference in New Issue
Block a user