Skip to content

Instantly share code, notes, and snippets.

@johnbartholomew
Forked from Brianetta/cheatMission.lua
Created December 15, 2012 19:15
Show Gist options
  • Save johnbartholomew/4298295 to your computer and use it in GitHub Desktop.
Save johnbartholomew/4298295 to your computer and use it in GitHub Desktop.
Translate:Add({
English = {
cheats = 'Cheats!',
}
})
local ui = Engine.ui
local t = Translate:GetTranslator()
local cheatMission = function (loaded)
local cheats = {
{'Add cash', function () Game.player:AddMoney(100000) end},
{'Refuel (prop tank)', function () Game.player:SetFuelPercent() end},
{'Refuel (1t H)', function () Game.player:AddEquip('HYDROGEN') end},
{'Refuel (1t Mil)', function () Game.player:AddEquip('MILITARY_FUEL') end},
{'Repair hull', function () Game.player:SetHullPercent() end},
{'Fit autopilot', function () Game.player:AddEquip('AUTOPILOT') end},
{'Fit atmospheric shield', function () Game.player:AddEquip('ATMOSPHERIC_SHIELDING') end},
{'Destroy combat target', function () if Game.player:GetCombatTarget() then Game.player:GetCombatTarget():Explode() end end},
}
local CheatList = ui:VBox()
for key,cheat in pairs(cheats) do
local cheatButton = ui:Button():SetInnerWidget(ui:Label(cheat[1]))
cheatButton.onClick:Connect(cheat[2])
CheatList:PackEnd(cheatButton)
end
local cheats = function (ref)
return CheatList
end
Mission.RegisterClick('cheats', function (ref) return CheatList end)
local missionData = {
type = 'cheats',
client = Character.New({name = 'Alpha Tester'}),
due = Game.time,
reward = 0,
status = 'ACTIVE',
}
if Game.time < 5 then Timer:CallAt(5,function () Mission.Add(missionData) end) end
end
Event.Register("onGameStart", cheatMission)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment