Skip to content

Instantly share code, notes, and snippets.

@Brianetta
Created November 3, 2012 18:45
Show Gist options
  • Save Brianetta/4008245 to your computer and use it in GitHub Desktop.
Save Brianetta/4008245 to your computer and use it in GitHub Desktop.
New UI cheat menu
local ui = Engine.ui
local CheatList = ui:VBox()
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},
}
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 missionData = {
type = 'cheats',
client = Character.New({name = 'Alpha Tester'}),
}
if Game.time < 5 then Timer:CallAt(5,function () Mission.New(missionData) end) end
end
Mission.RegisterType('cheats','Cheats!', function () return CheatList end)
Event.Register("onGameStart", cheatMission)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment