Merge remote-tracking branch 'origin/MC1.7' into MC1.10
This commit is contained in:
commit
9c42c54101
15 changed files with 147 additions and 152 deletions
|
@ -16,7 +16,7 @@ public class ItemBlockDecorative extends ItemBlockAbstractBase {
|
|||
public ItemBlockDecorative(Block block) {
|
||||
super(block);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("warpdrive.decoration");
|
||||
setUnlocalizedName("warpdrive.decoration.decorative");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
|
@ -1092,9 +1092,10 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy implements ISta
|
|||
|
||||
@Override
|
||||
public ITextComponent getStatus() {
|
||||
final String strIsolationRate = String.format("%.1f", isolationRate * 100.0D);
|
||||
return super.getStatus()
|
||||
.appendSibling((cooldownTime_ticks > 0) ? new TextComponentString("\n").appendSibling(new TextComponentTranslation("warpdrive.ship.status_line.cooling", cooldownTime_ticks / 20)) : new TextComponentString(""))
|
||||
.appendSibling((isolationBlocksCount > 0) ? new TextComponentString("\n").appendSibling(new TextComponentTranslation("warpdrive.ship.status_line.isolation", isolationBlocksCount, isolationRate * 100.0)) : new TextComponentString(""));
|
||||
.appendSibling((isolationBlocksCount > 0) ? new TextComponentString("\n").appendSibling(new TextComponentTranslation("warpdrive.ship.status_line.isolation", isolationBlocksCount, strIsolationRate)) : new TextComponentString(""));
|
||||
}
|
||||
|
||||
public ITextComponent getBoundingBoxStatus() {
|
||||
|
|
|
@ -289,10 +289,10 @@ public class AcceleratorSetup extends GlobalPosition {
|
|||
|
||||
// count main magnets
|
||||
final int indexTier = (trajectoryPoint.type & TrajectoryPoint.MASK_TIERS) - 1;
|
||||
if ((trajectoryPoint.type & TrajectoryPoint.MAGNETS_HORIZONTAL) != 0) {
|
||||
if ((trajectoryPoint.type & TrajectoryPoint.MAGNETS_HORIZONTAL) != 0 && indexTier >= 0) {
|
||||
countMagnets[indexTier] += 2;
|
||||
}
|
||||
if ((trajectoryPoint.type & TrajectoryPoint.MAGNETS_VERTICAL) != 0) {
|
||||
if ((trajectoryPoint.type & TrajectoryPoint.MAGNETS_VERTICAL) != 0 && indexTier >= 0) {
|
||||
countMagnets[indexTier] += 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -576,7 +576,7 @@ warpdrive.ship.attached_players=Verbundene Spieler: %1$s
|
|||
warpdrive.ship.player_attached=Du bist jetzt mit dem Schiff %1$s verbunden.\nVerbundene Spieler sind %2$s
|
||||
warpdrive.ship.player_detached=Du wurdest vom Schiff %1$s getrennt.\nVerbundene Spieler sind %2$s
|
||||
warpdrive.ship.status_line.cooling=%1$d s Abklingzeit verbleibend.
|
||||
warpdrive.ship.status_line.isolation=%1$d aktive Isolations Blöcke bieten %2$2.1f%% Absorption.
|
||||
warpdrive.ship.status_line.isolation=%1$d aktive Isolations Blöcke bieten %2$s%% Absorption.
|
||||
|
||||
warpdrive.energy.status_line=Das Energie Level ist %1$s / %2$s EU.
|
||||
warpdrive.energy.side.changed_to_input=%1$s Seite auf Energiezufuhr Modus gestellt!
|
||||
|
|
|
@ -574,7 +574,7 @@ warpdrive.ship.attached_players=Attached players: %1$s
|
|||
warpdrive.ship.player_attached=You're now attached to ship %1$s.\nAttached players are %2$s
|
||||
warpdrive.ship.player_detached=You've been detached from ship %1$s.\nAttached players are %2$s
|
||||
warpdrive.ship.status_line.cooling=%1$d s left of cooldown.
|
||||
warpdrive.ship.status_line.isolation=%1$d active isolation blocks providing %2$2.1f%% absorption.
|
||||
warpdrive.ship.status_line.isolation=%1$d active isolation blocks providing %2$s%% absorption.
|
||||
|
||||
warpdrive.energy.status_line=Energy level is %1$s / %2$s EU.
|
||||
warpdrive.energy.side.changed_to_input=%1$s side changed to energy Input mode!
|
||||
|
|
|
@ -574,7 +574,7 @@ warpdrive.ship.attached_players=Joueurs attachés: %1$s
|
|||
warpdrive.ship.player_attached=Tu es désormais attaché au vaisseau %1$s.\nLes joueurs attachés sont %2$s
|
||||
warpdrive.ship.player_detached=Tu es désormais détaché du vaisseau %1$s.\nLes joueurs attachés sont %2$s
|
||||
warpdrive.ship.status_line.cooling=Encore %1$d s de refroidissement.
|
||||
warpdrive.ship.status_line.isolation=Les %1$d blocs d'isolations actifs fournissent %2$2.1f%% d'absorption.
|
||||
warpdrive.ship.status_line.isolation=Les %1$d blocs d'isolations actifs fournissent %2$s%% d'absorption.
|
||||
|
||||
warpdrive.energy.status_line=Le niveau d'énergie est de %1$s / %2$s EU.
|
||||
warpdrive.energy.side.changed_to_input=Le coté %1$s est en mode Réception d'énergie!
|
||||
|
|
|
@ -571,7 +571,7 @@ warpdrive.ship.attached_players=Aangesloten Spelers: %1$s
|
|||
warpdrive.ship.player_attached=Je bent nu aangesloten op schip %1$s.\nDe aangesloten spelers zijn %2$s
|
||||
warpdrive.ship.player_detached=Je bent nu afgesloten op schip %1$s.\nDe aangesloten spelers zijn %2$s
|
||||
warpdrive.ship.status_line.cooling=%1$d seconden over van afkoeling
|
||||
warpdrive.ship.status_line.isolation=%1$d actieve isolatie-blokken geven %2$2.1f%% absorptie.
|
||||
warpdrive.ship.status_line.isolation=%1$d actieve isolatie-blokken geven %2$s%% absorptie.
|
||||
|
||||
warpdrive.energy.status_line=Energielevel is op %1$s / %2$s EU.
|
||||
warpdrive.energy.side.changed_to_input=%1$s kant verandert naar energie input modus!
|
||||
|
|
|
@ -574,7 +574,7 @@ warpdrive.ship.attached_players=Прирепленные игроки: %1$s
|
|||
warpdrive.ship.player_attached=Вы были прикреплены к кораблю %1$s.\nПрикрепленные игроки: %2$s
|
||||
warpdrive.ship.player_detached=Вы были откреплены от корабля %1$s.\nПрикрепленные игроки: %2$s
|
||||
warpdrive.ship.status_line.cooling=Осталось %1$d с до остывания.
|
||||
warpdrive.ship.status_line.isolation=%1$d активных блоков изоляции предоставляют %2$2.1f%% поглощения.
|
||||
warpdrive.ship.status_line.isolation=%1$d активных блоков изоляции предоставляют %2$s%% поглощения.
|
||||
|
||||
warpdrive.energy.status_line=Содержит энергии: %1$s / %2$s EU.
|
||||
warpdrive.energy.side.changed_to_input=%1$s side changed to energy Input mode!
|
||||
|
|
|
@ -571,7 +571,7 @@ warpdrive.ship.attached_players=所属的玩家: %1$s
|
|||
warpdrive.ship.player_attached=你在飞船 %1$s上.\n属于%2$s
|
||||
warpdrive.ship.player_detached=你已经脱离了飞船 %1$s.\n属于%2$s
|
||||
warpdrive.ship.status_line.cooling=%1$d s 冷却时间
|
||||
warpdrive.ship.status_line.isolation=%1$d有效的隔离方块提供%2$2.1f%%吸收.
|
||||
warpdrive.ship.status_line.isolation=%1$d有效的隔离方块提供%2$s%%吸收.
|
||||
|
||||
warpdrive.energy.status_line=能量水平%1$s / %2$s EU.
|
||||
warpdrive.energy.side.changed_to_input=%1$s侧面更改为能量输入模式!
|
||||
|
|
|
@ -569,7 +569,7 @@ warpdrive.ship.attached_players=屬於: %1$s
|
|||
warpdrive.ship.player_attached=您現在已連接到船艦 %1$s.\n這艘船艦屬於 %2$s
|
||||
warpdrive.ship.player_detached=您現在已從船艦分離 %1$s.\n這艘船艦屬於 %2$s
|
||||
warpdrive.ship.status_line.cooling=%1$d s 升降梯的冷卻中。
|
||||
warpdrive.ship.status_line.isolation=%1$d 主動隔離塊由 %2$2.1f%% 吸收。
|
||||
warpdrive.ship.status_line.isolation=%1$d 主動隔離塊由 %2$s%% 吸收。
|
||||
|
||||
warpdrive.energy.status_line=能量填充 %1$s / %2$s EU.
|
||||
warpdrive.energy.side.changed_to_input=%1$s 側面變為能量輸入模式!
|
||||
|
|
|
@ -985,7 +985,7 @@ local function data_register(name, callbackRead, callbackSave, callbackName)
|
|||
callbackSave = function() end
|
||||
end
|
||||
|
||||
-- name callback is nill when not defined
|
||||
-- name callback is nil when not defined
|
||||
|
||||
data_handlers[name] = { read = callbackRead, save = callbackSave, name = callbackName }
|
||||
end
|
||||
|
|
|
@ -7,33 +7,38 @@ local data
|
|||
|
||||
----------- Reactor support
|
||||
|
||||
local reactor_output = 0
|
||||
local reactor = nil
|
||||
local reactor
|
||||
local reactorlasers = {}
|
||||
|
||||
local reactor_mode = 0
|
||||
local reactor_rate = 100
|
||||
local reactor_targetStability = 50
|
||||
local reactor_laserAmount = 10000
|
||||
|
||||
local reactor_output = 0
|
||||
|
||||
function reactor_read(parData)
|
||||
data = parData
|
||||
if data.reactor_mode == nil then data.reactor_mode = 0 end
|
||||
if data.reactor_rate == nil then data.reactor_rate = 100 end
|
||||
if data.reactor_targetStability == nil then data.reactor_targetStability = 50 end
|
||||
if data.reactor_laserAmount == nil then data.reactor_laserAmount = 10000 end
|
||||
end
|
||||
|
||||
function reactor_boot()
|
||||
if reactor ~= nil then
|
||||
w.writeLn("Booting Reactor...")
|
||||
local _, _, _, strMode, _ = reactor.state()
|
||||
if strMode == "OFF" then
|
||||
data.reactor_mode = 0
|
||||
elseif strMode == "MANUAL" then
|
||||
data.reactor_mode = 1
|
||||
elseif strMode == "ABOVE" then
|
||||
data.reactor_mode = 2
|
||||
elseif strMode == "RATE" then
|
||||
data.reactor_mode = 3
|
||||
if strMode == "off" then
|
||||
reactor_mode = 0
|
||||
elseif strMode == "unlimited" then
|
||||
reactor_mode = 1
|
||||
elseif strMode == "above" then
|
||||
reactor_mode = 2
|
||||
elseif strMode == "at_rate" then
|
||||
reactor_mode = 3
|
||||
else
|
||||
data.reactor_mode = 0
|
||||
reactor_mode = 0
|
||||
end
|
||||
_, reactor_rate = reactor.releaseRate()
|
||||
reactor_targetStability = 100.0 - reactor.instabilityTarget()
|
||||
reactor_laserAmount = reactor.stabilizerEnergy()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -48,43 +53,35 @@ function reactor_key(character, keycode)
|
|||
reactor_laser()
|
||||
return true
|
||||
elseif character == 'o' or character == 'O' then -- O
|
||||
data.reactor_mode = (data.reactor_mode + 1) % 4
|
||||
reactor_mode = (reactor_mode + 1) % 4
|
||||
reactor_setMode()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == 'g' or character == 'G' then -- G
|
||||
data.reactor_rate = data.reactor_rate - 1000
|
||||
reactor_rate = reactor_rate - 1000
|
||||
reactor_setMode()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == 't' or character == 'T' then -- T
|
||||
data.reactor_rate = data.reactor_rate + 1000
|
||||
reactor_rate = reactor_rate + 1000
|
||||
reactor_setMode()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == 'j' or character == 'J' then -- J
|
||||
data.reactor_laserAmount = data.reactor_laserAmount - 500
|
||||
reactor_laserAmount = reactor_laserAmount - 500
|
||||
reactor_setLaser()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == 'u' or character == 'U' then -- U
|
||||
data.reactor_laserAmount = data.reactor_laserAmount + 500
|
||||
reactor_laserAmount = reactor_laserAmount + 500
|
||||
reactor_setLaser()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == '-' then -- -
|
||||
data.reactor_targetStability = data.reactor_targetStability - 1
|
||||
reactor_targetStability = reactor_targetStability - 1
|
||||
reactor_setTargetStability()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == '+' then -- +
|
||||
data.reactor_targetStability = data.reactor_targetStability + 1
|
||||
reactor_targetStability = reactor_targetStability + 1
|
||||
reactor_setTargetStability()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == 'c' or character == 'C' then -- C
|
||||
reactor_config()
|
||||
w.data_save()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
@ -104,7 +101,7 @@ function reactor_page()
|
|||
for key, instability in pairs(instabilities) do
|
||||
w.setCursorPos(12, 2 + key)
|
||||
local stability = math.floor((100.0 - instability) * 10) / 10.0
|
||||
if stability >= data.reactor_targetStability then
|
||||
if stability >= reactor_targetStability then
|
||||
w.setColorSuccess()
|
||||
else
|
||||
w.setColorWarning()
|
||||
|
@ -155,7 +152,7 @@ function reactor_page()
|
|||
local energy = reactorlaser.wrap.energy()
|
||||
if not reactorlaser.wrap.hasReactor() then
|
||||
w.setColorDisabled()
|
||||
elseif energy > 3 * data.reactor_laserAmount then
|
||||
elseif energy > 3 * reactor_laserAmount then
|
||||
w.setColorSuccess()
|
||||
else
|
||||
w.setColorWarning()
|
||||
|
@ -170,21 +167,21 @@ function reactor_page()
|
|||
w.write(" -----------------------------------------------")
|
||||
w.setCursorPos(1, 11)
|
||||
w.write("Output mode : ")
|
||||
if data.reactor_mode == 0 then
|
||||
if reactor_mode == 0 then
|
||||
w.setColorDisabled()
|
||||
w.write("hold")
|
||||
elseif data.reactor_mode == 1 then
|
||||
elseif reactor_mode == 1 then
|
||||
w.write("manual/unlimited")
|
||||
elseif data.reactor_mode == 2 then
|
||||
w.write("surplus above " .. data.reactor_rate .. " RF")
|
||||
elseif reactor_mode == 2 then
|
||||
w.write("surplus above " .. reactor_rate .. " RF")
|
||||
else
|
||||
w.write("rated at " .. data.reactor_rate .. " RF")
|
||||
w.write("rated at " .. reactor_rate .. " RF")
|
||||
end
|
||||
w.setColorNormal()
|
||||
w.setCursorPos( 1, 12)
|
||||
w.write("Target stability: " .. data.reactor_targetStability .. "%")
|
||||
w.write("Target stability: " .. reactor_targetStability .. "%")
|
||||
w.setCursorPos(30, 12)
|
||||
w.write("Laser amount: " .. data.reactor_laserAmount)
|
||||
w.write("Laser amount: " .. reactor_laserAmount)
|
||||
|
||||
w.setColorControl()
|
||||
w.setCursorPos(1, 14)
|
||||
|
@ -195,43 +192,43 @@ function reactor_page()
|
|||
end
|
||||
|
||||
function reactor_setMode()
|
||||
if data.reactor_rate < 1 then
|
||||
data.reactor_rate = 1
|
||||
elseif data.reactor_rate > 100000 then
|
||||
data.reactor_rate = 100000
|
||||
if reactor_rate < 1 then
|
||||
reactor_rate = 1
|
||||
elseif reactor_rate > 100000 then
|
||||
reactor_rate = 100000
|
||||
end
|
||||
if reactor ~= nil then
|
||||
if data.reactor_mode == 0 then
|
||||
if reactor_mode == 0 then
|
||||
reactor.release(false)
|
||||
elseif data.reactor_mode == 1 then
|
||||
elseif reactor_mode == 1 then
|
||||
reactor.release(true)
|
||||
elseif data.reactor_mode == 2 then
|
||||
reactor.releaseAbove(data.reactor_rate)
|
||||
elseif reactor_mode == 2 then
|
||||
reactor.releaseAbove(reactor_rate)
|
||||
else
|
||||
reactor.releaseRate(data.reactor_rate)
|
||||
reactor.releaseRate(reactor_rate)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function reactor_setLaser()
|
||||
if data.reactor_laserAmount < 1 then
|
||||
data.reactor_laserAmount = 1
|
||||
elseif data.reactor_laserAmount > 100000 then
|
||||
data.reactor_laserAmount = 100000
|
||||
if reactor_laserAmount < 1 then
|
||||
reactor_laserAmount = 1
|
||||
elseif reactor_laserAmount > 100000 then
|
||||
reactor_laserAmount = 100000
|
||||
end
|
||||
if reactor ~= nill then
|
||||
data.reactor_laserAmount = reactor.stabilizerEnergy(data.reactor_laserAmount)
|
||||
if reactor ~= nil then
|
||||
reactor_laserAmount = reactor.stabilizerEnergy(reactor_laserAmount)
|
||||
end
|
||||
end
|
||||
|
||||
function reactor_setTargetStability()
|
||||
if data.reactor_targetStability < 1.0 then
|
||||
data.reactor_targetStability = 1.0
|
||||
elseif data.reactor_targetStability > 100.0 then
|
||||
data.reactor_targetStability = 100.0
|
||||
if reactor_targetStability < 1.0 then
|
||||
reactor_targetStability = 1.0
|
||||
elseif reactor_targetStability > 100.0 then
|
||||
reactor_targetStability = 100.0
|
||||
end
|
||||
if reactor ~= nill then
|
||||
data.reactor_targetStability = 100.0 - reactor.instabilityTarget(100.0 - data.reactor_targetStability)
|
||||
if reactor ~= nil then
|
||||
reactor_targetStability = 100.0 - reactor.instabilityTarget(100.0 - reactor_targetStability)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -251,7 +248,7 @@ end
|
|||
function reactor_laser(side)
|
||||
for key, reactorlaser in pairs(reactorlasers) do
|
||||
if (side == nil) or (reactorlaser.side == side) then
|
||||
reactorlaser.wrap.stabilize(data.reactor_laserAmount)
|
||||
reactorlaser.wrap.stabilize(reactor_laserAmount)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -267,7 +264,7 @@ function reactor_pulse(output)
|
|||
for key, instability in pairs(instabilities) do
|
||||
w.setCursorPos(12, 2 + key)
|
||||
local stability = math.floor((100.0 - instability) * 10) / 10
|
||||
if stability >= data.reactor_targetStability then
|
||||
if stability >= reactor_targetStability then
|
||||
w.setColorSuccess()
|
||||
else
|
||||
w.setColorWarning()
|
||||
|
@ -302,7 +299,7 @@ function reactor_pulse(output)
|
|||
end
|
||||
if not reactorlaser.wrap.hasReactor() then
|
||||
w.setColorDisabled()
|
||||
elseif energy > 3 * data.reactor_laserAmount then
|
||||
elseif energy > 3 * reactor_laserAmount then
|
||||
w.setColorSuccess()
|
||||
else
|
||||
w.setColorWarning()
|
||||
|
@ -325,22 +322,22 @@ function reactor_config()
|
|||
else
|
||||
w.setColorNormal()
|
||||
w.setCursorPos(1, 4)
|
||||
w.write("Reactor output rate (" .. w.format_integer(data.reactor_rate) .. " RF): ")
|
||||
data.reactor_rate = w.input_readInteger(data.reactor_rate)
|
||||
w.write("Reactor output rate (" .. w.format_integer(reactor_rate) .. " RF): ")
|
||||
reactor_rate = w.input_readInteger(reactor_rate)
|
||||
reactor_setMode()
|
||||
w.setCursorPos(1, 5)
|
||||
w.write("Reactor output rate set")
|
||||
|
||||
w.setCursorPos(1, 7)
|
||||
w.write("Laser energy level (" .. w.format_integer(data.reactor_laserAmount) .. "): ")
|
||||
data.reactor_laserAmount = w.input_readInteger(data.reactor_laserAmount)
|
||||
w.write("Laser energy level (" .. w.format_integer(reactor_laserAmount) .. "): ")
|
||||
reactor_laserAmount = w.input_readInteger(reactor_laserAmount)
|
||||
reactor_setLaser()
|
||||
w.setCursorPos(1, 8)
|
||||
w.write("Laser energy level set")
|
||||
|
||||
w.setCursorPos(1, 10)
|
||||
w.write("Reactor target stability (" .. w.format_integer(data.reactor_targetStability) .. "%): ")
|
||||
data.reactor_targetStability = w.input_readInteger(data.reactor_targetStability)
|
||||
w.write("Reactor target stability (" .. w.format_integer(reactor_targetStability) .. "%): ")
|
||||
reactor_targetStability = w.input_readInteger(reactor_targetStability)
|
||||
reactor_setTargetStability()
|
||||
w.setCursorPos(1, 11)
|
||||
w.write("Reactor target stability set")
|
||||
|
|
|
@ -179,7 +179,7 @@ function ffield_projector_key(character, keycode)
|
|||
return true
|
||||
elseif character == 'e' or character == 'E' then
|
||||
local projector = ffield_projector_getSelected()
|
||||
if projector ~= nil and projector.device ~= nill then
|
||||
if projector ~= nil and projector.device ~= nil then
|
||||
ffield_enable(projector)
|
||||
end
|
||||
return true
|
||||
|
|
|
@ -962,7 +962,7 @@ local function data_register(name, callbackRead, callbackSave, callbackName)
|
|||
callbackSave = function() end
|
||||
end
|
||||
|
||||
-- name callback is nill when not defined
|
||||
-- name callback is nil when not defined
|
||||
|
||||
data_handlers[name] = { read = callbackRead, save = callbackSave, name = callbackName }
|
||||
end
|
||||
|
|
|
@ -6,33 +6,38 @@ local data
|
|||
|
||||
----------- Reactor support
|
||||
|
||||
local reactor_output = 0
|
||||
local reactor = nil
|
||||
local reactor
|
||||
local reactorlasers = {}
|
||||
|
||||
local reactor_mode = 0
|
||||
local reactor_rate = 100
|
||||
local reactor_targetStability = 50
|
||||
local reactor_laserAmount = 10000
|
||||
|
||||
local reactor_output = 0
|
||||
|
||||
function reactor_read(parData)
|
||||
data = parData
|
||||
if data.reactor_mode == nil then data.reactor_mode = 0 end
|
||||
if data.reactor_rate == nil then data.reactor_rate = 100 end
|
||||
if data.reactor_targetStability == nil then data.reactor_targetStability = 50 end
|
||||
if data.reactor_laserAmount == nil then data.reactor_laserAmount = 10000 end
|
||||
end
|
||||
|
||||
function reactor_boot()
|
||||
if reactor ~= nil then
|
||||
w.writeLn("Booting Reactor...")
|
||||
local _, _, _, strMode, _ = reactor.state()
|
||||
if strMode == "OFF" then
|
||||
data.reactor_mode = 0
|
||||
elseif strMode == "MANUAL" then
|
||||
data.reactor_mode = 1
|
||||
elseif strMode == "ABOVE" then
|
||||
data.reactor_mode = 2
|
||||
elseif strMode == "RATE" then
|
||||
data.reactor_mode = 3
|
||||
if strMode == "off" then
|
||||
reactor_mode = 0
|
||||
elseif strMode == "unlimited" then
|
||||
reactor_mode = 1
|
||||
elseif strMode == "above" then
|
||||
reactor_mode = 2
|
||||
elseif strMode == "at_rate" then
|
||||
reactor_mode = 3
|
||||
else
|
||||
data.reactor_mode = 0
|
||||
reactor_mode = 0
|
||||
end
|
||||
_, reactor_rate = reactor.releaseRate()
|
||||
reactor_targetStability = 100.0 - reactor.instabilityTarget()
|
||||
reactor_laserAmount = reactor.stabilizerEnergy()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -47,43 +52,35 @@ function reactor_key(character, keycode)
|
|||
reactor_laser()
|
||||
return true
|
||||
elseif character == 'o' or character == 'O' then -- O
|
||||
data.reactor_mode = (data.reactor_mode + 1) % 4
|
||||
reactor_mode = (reactor_mode + 1) % 4
|
||||
reactor_setMode()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == 'g' or character == 'G' then -- G
|
||||
data.reactor_rate = data.reactor_rate - 1000
|
||||
reactor_rate = reactor_rate - 1000
|
||||
reactor_setMode()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == 't' or character == 'T' then -- T
|
||||
data.reactor_rate = data.reactor_rate + 1000
|
||||
reactor_rate = reactor_rate + 1000
|
||||
reactor_setMode()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == 'j' or character == 'J' then -- J
|
||||
data.reactor_laserAmount = data.reactor_laserAmount - 500
|
||||
reactor_laserAmount = reactor_laserAmount - 500
|
||||
reactor_setLaser()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == 'u' or character == 'U' then -- U
|
||||
data.reactor_laserAmount = data.reactor_laserAmount + 500
|
||||
reactor_laserAmount = reactor_laserAmount + 500
|
||||
reactor_setLaser()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == '-' then -- -
|
||||
data.reactor_targetStability = data.reactor_targetStability - 1
|
||||
reactor_targetStability = reactor_targetStability - 1
|
||||
reactor_setTargetStability()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == '+' then -- +
|
||||
data.reactor_targetStability = data.reactor_targetStability + 1
|
||||
reactor_targetStability = reactor_targetStability + 1
|
||||
reactor_setTargetStability()
|
||||
w.data_save()
|
||||
return true
|
||||
elseif character == 'c' or character == 'C' then -- C
|
||||
reactor_config()
|
||||
w.data_save()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
@ -103,7 +100,7 @@ function reactor_page()
|
|||
for key, instability in pairs(instabilities) do
|
||||
w.setCursorPos(12, 2 + key)
|
||||
local stability = math.floor((100.0 - instability) * 10) / 10.0
|
||||
if stability >= data.reactor_targetStability then
|
||||
if stability >= reactor_targetStability then
|
||||
w.setColorSuccess()
|
||||
else
|
||||
w.setColorWarning()
|
||||
|
@ -154,7 +151,7 @@ function reactor_page()
|
|||
local energy = reactorlaser.wrap.energy()
|
||||
if not reactorlaser.wrap.hasReactor() then
|
||||
w.setColorDisabled()
|
||||
elseif energy > 3 * data.reactor_laserAmount then
|
||||
elseif energy > 3 * reactor_laserAmount then
|
||||
w.setColorSuccess()
|
||||
else
|
||||
w.setColorWarning()
|
||||
|
@ -169,21 +166,21 @@ function reactor_page()
|
|||
w.write(" -----------------------------------------------")
|
||||
w.setCursorPos(1, 11)
|
||||
w.write("Output mode : ")
|
||||
if data.reactor_mode == 0 then
|
||||
if reactor_mode == 0 then
|
||||
w.setColorDisabled()
|
||||
w.write("hold")
|
||||
elseif data.reactor_mode == 1 then
|
||||
elseif reactor_mode == 1 then
|
||||
w.write("manual/unlimited")
|
||||
elseif data.reactor_mode == 2 then
|
||||
w.write("surplus above " .. data.reactor_rate .. " RF")
|
||||
elseif reactor_mode == 2 then
|
||||
w.write("surplus above " .. reactor_rate .. " RF")
|
||||
else
|
||||
w.write("rated at " .. data.reactor_rate .. " RF")
|
||||
w.write("rated at " .. reactor_rate .. " RF")
|
||||
end
|
||||
w.setColorNormal()
|
||||
w.setCursorPos( 1, 12)
|
||||
w.write("Target stability: " .. data.reactor_targetStability .. "%")
|
||||
w.write("Target stability: " .. reactor_targetStability .. "%")
|
||||
w.setCursorPos(30, 12)
|
||||
w.write("Laser amount: " .. data.reactor_laserAmount)
|
||||
w.write("Laser amount: " .. reactor_laserAmount)
|
||||
|
||||
w.setColorControl()
|
||||
w.setCursorPos(1, 18)
|
||||
|
@ -194,43 +191,43 @@ function reactor_page()
|
|||
end
|
||||
|
||||
function reactor_setMode()
|
||||
if data.reactor_rate < 1 then
|
||||
data.reactor_rate = 1
|
||||
elseif data.reactor_rate > 100000 then
|
||||
data.reactor_rate = 100000
|
||||
if reactor_rate < 1 then
|
||||
reactor_rate = 1
|
||||
elseif reactor_rate > 100000 then
|
||||
reactor_rate = 100000
|
||||
end
|
||||
if reactor ~= nil then
|
||||
if data.reactor_mode == 0 then
|
||||
if reactor_mode == 0 then
|
||||
reactor.release(false)
|
||||
elseif data.reactor_mode == 1 then
|
||||
elseif reactor_mode == 1 then
|
||||
reactor.release(true)
|
||||
elseif data.reactor_mode == 2 then
|
||||
reactor.releaseAbove(data.reactor_rate)
|
||||
elseif reactor_mode == 2 then
|
||||
reactor.releaseAbove(reactor_rate)
|
||||
else
|
||||
reactor.releaseRate(data.reactor_rate)
|
||||
reactor.releaseRate(reactor_rate)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function reactor_setLaser()
|
||||
if data.reactor_laserAmount < 1 then
|
||||
data.reactor_laserAmount = 1
|
||||
elseif data.reactor_laserAmount > 100000 then
|
||||
data.reactor_laserAmount = 100000
|
||||
if reactor_laserAmount < 1 then
|
||||
reactor_laserAmount = 1
|
||||
elseif reactor_laserAmount > 100000 then
|
||||
reactor_laserAmount = 100000
|
||||
end
|
||||
if reactor ~= nill then
|
||||
data.reactor_laserAmount = reactor.stabilizerEnergy(data.reactor_laserAmount)
|
||||
if reactor ~= nil then
|
||||
reactor_laserAmount = reactor.stabilizerEnergy(reactor_laserAmount)
|
||||
end
|
||||
end
|
||||
|
||||
function reactor_setTargetStability()
|
||||
if data.reactor_targetStability < 1.0 then
|
||||
data.reactor_targetStability = 1.0
|
||||
elseif data.reactor_targetStability > 100.0 then
|
||||
data.reactor_targetStability = 100.0
|
||||
if reactor_targetStability < 1.0 then
|
||||
reactor_targetStability = 1.0
|
||||
elseif reactor_targetStability > 100.0 then
|
||||
reactor_targetStability = 100.0
|
||||
end
|
||||
if reactor ~= nill then
|
||||
data.reactor_targetStability = 100.0 - reactor.instabilityTarget(100.0 - data.reactor_targetStability)
|
||||
if reactor ~= nil then
|
||||
reactor_targetStability = 100.0 - reactor.instabilityTarget(100.0 - reactor_targetStability)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -250,7 +247,7 @@ end
|
|||
function reactor_laser(side)
|
||||
for key, reactorlaser in pairs(reactorlasers) do
|
||||
if (side == nil) or (reactorlaser.side == side) then
|
||||
reactorlaser.wrap.stabilize(data.reactor_laserAmount)
|
||||
reactorlaser.wrap.stabilize(reactor_laserAmount)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -269,7 +266,7 @@ function reactor_pulse(output)
|
|||
for key, instability in pairs(instabilities) do
|
||||
w.setCursorPos(12, 2 + key)
|
||||
local stability = math.floor((100.0 - instability) * 10) / 10
|
||||
if stability >= data.reactor_targetStability then
|
||||
if stability >= reactor_targetStability then
|
||||
w.setColorSuccess()
|
||||
else
|
||||
w.setColorWarning()
|
||||
|
@ -306,7 +303,7 @@ function reactor_pulse(output)
|
|||
end
|
||||
if not reactorlaser.wrap.hasReactor() then
|
||||
w.setColorDisabled()
|
||||
elseif energy > 3 * data.reactor_laserAmount then
|
||||
elseif energy > 3 * reactor_laserAmount then
|
||||
w.setColorSuccess()
|
||||
else
|
||||
w.setColorWarning()
|
||||
|
@ -330,22 +327,22 @@ function reactor_config()
|
|||
else
|
||||
w.setColorNormal()
|
||||
w.setCursorPos(1, 4)
|
||||
w.write("Reactor output rate (" .. w.format_integer(data.reactor_rate) .. " RF): ")
|
||||
data.reactor_rate = w.input_readInteger(data.reactor_rate)
|
||||
w.write("Reactor output rate (" .. w.format_integer(reactor_rate) .. " RF): ")
|
||||
reactor_rate = w.input_readInteger(reactor_rate)
|
||||
reactor_setMode()
|
||||
w.setCursorPos(1, 5)
|
||||
w.write("Reactor output rate set")
|
||||
|
||||
w.setCursorPos(1, 7)
|
||||
w.write("Laser energy level (" .. w.format_integer(data.reactor_laserAmount) .. "): ")
|
||||
data.reactor_laserAmount = w.input_readInteger(data.reactor_laserAmount)
|
||||
w.write("Laser energy level (" .. w.format_integer(reactor_laserAmount) .. "): ")
|
||||
reactor_laserAmount = w.input_readInteger(reactor_laserAmount)
|
||||
reactor_setLaser()
|
||||
w.setCursorPos(1, 8)
|
||||
w.write("Laser energy level set")
|
||||
|
||||
w.setCursorPos(1, 10)
|
||||
w.write("Reactor target stability (" .. w.format_integer(data.reactor_targetStability) .. "%): ")
|
||||
data.reactor_targetStability = w.input_readInteger(data.reactor_targetStability)
|
||||
w.write("Reactor target stability (" .. w.format_integer(reactor_targetStability) .. "%): ")
|
||||
reactor_targetStability = w.input_readInteger(reactor_targetStability)
|
||||
reactor_setTargetStability()
|
||||
w.setCursorPos(1, 11)
|
||||
w.write("Reactor target stability set")
|
||||
|
|
Loading…
Reference in a new issue