|
|
|
|
|
PlaceObj('XTemplate', { |
|
group = "Zulu Dev", |
|
id = "ModEditorCheats", |
|
save_in = "GameGed", |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "General", |
|
'ActionTranslate', false, |
|
'ActionName', "General", |
|
'OnActionEffect', "popup", |
|
'OnAction', function (self, host, source, ...) |
|
local effect = self.OnActionEffect |
|
local param = self.OnActionParam |
|
if effect == "close" and host and host.window_state ~= "destroying" then |
|
host:Close(param ~= "" and param or nil, source, ...) |
|
elseif effect == "mode" and host then |
|
assert(IsKindOf(host, "XDialog")) |
|
host:SetMode(param) |
|
elseif effect == "back" and host then |
|
assert(IsKindOf(host, "XDialog")) |
|
SetBackDialogMode(host) |
|
elseif effect == "popup" then |
|
local actions_view = GetParentOfKind(source, "XActionsView") |
|
if actions_view then |
|
actions_view:PopupAction(self.ActionId, host, source) |
|
else |
|
XShortcutsTarget:OpenPopupMenu(self.ActionId, terminal.GetMousePos()) |
|
end |
|
else |
|
|
|
end |
|
end, |
|
}, { |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "NewGameMod", |
|
'ActionTranslate', false, |
|
'ActionName', "New game (mod testing)", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatNewModGame", "normal") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "QuickstartMod", |
|
'ActionTranslate', false, |
|
'ActionName', "New game (mod testing) - quickstart", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatNewModGame", "quickstart") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "TestExploration", |
|
'ActionTranslate', false, |
|
'ActionName', "Place test mercs", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatTestExploration") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "Teleport", |
|
'ActionTranslate', false, |
|
'ActionName', "Enable teleport (toggle) Ctrl-T", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatEnable", "Teleport") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "Money", |
|
'ActionTranslate', false, |
|
'ActionName', "Add money", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatActivate", "CheatGetMoney") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "LevelUp", |
|
'ActionTranslate', false, |
|
'ActionName', "Level up selected merc", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatActivate", "CheatLevelUp") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "AddAmmo", |
|
'ActionTranslate', false, |
|
'ActionName', "Add all ammo", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatActivate", "CheatAddAmmo") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "AddMerc", |
|
'ActionTranslate', false, |
|
'ActionName', "Add merc", |
|
'OnActionEffect', "popup", |
|
}, { |
|
PlaceObj('XTemplateForEach', { |
|
'array', function (parent, context) return GetActionsHost(parent).mercs end, |
|
'__context', function (parent, context, item, i, n) |
|
return context |
|
end, |
|
'run_after', function (child, context, item, i, n, last) |
|
child.ActionId = item |
|
child.ActionName = item |
|
child.OnAction = function (self, host, source) |
|
host:Op("GedOpTriggerCheat", "root", "CheatAddMerc", item) |
|
end |
|
end, |
|
}, { |
|
PlaceObj('XTemplateAction', { |
|
'ActionTranslate', false, |
|
}), |
|
}), |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "AddItem", |
|
'ActionTranslate', false, |
|
'ActionName', "Add inventory item", |
|
'OnActionEffect', "popup", |
|
}, { |
|
PlaceObj('XTemplateForEach', { |
|
'array', function (parent, context) return GetActionsHost(parent).items end, |
|
'__context', function (parent, context, item, i, n) |
|
return context |
|
end, |
|
'run_after', function (child, context, item, i, n, last) |
|
child.ActionId = item |
|
child.ActionName = item |
|
child.OnAction = function (self, host, source) |
|
host:Op("GedOpTriggerCheat", "root", "CheatAddItem", item) |
|
end |
|
end, |
|
}, { |
|
PlaceObj('XTemplateAction', { |
|
'ActionTranslate', false, |
|
}), |
|
}), |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "FlyCameraToggle", |
|
'ActionTranslate', false, |
|
'ActionName', "Fly camera (toggle) Shift-C", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatToggleFlyCamera") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "IsolatedScreenshot", |
|
'ActionTranslate', false, |
|
'ActionName', "Isolated object screenshot (Ctrl-Alt-PrtScr)", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatIsolatedScreenshot") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "ResetMap", |
|
'ActionTranslate', false, |
|
'ActionName', "Reset to mod editor map", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatResetMap") |
|
end, |
|
}), |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "Combat", |
|
'ActionTranslate', false, |
|
'ActionName', "Combat", |
|
'OnActionEffect', "popup", |
|
'OnAction', function (self, host, source, ...) |
|
local effect = self.OnActionEffect |
|
local param = self.OnActionParam |
|
if effect == "close" and host and host.window_state ~= "destroying" then |
|
host:Close(param ~= "" and param or nil, source, ...) |
|
elseif effect == "mode" and host then |
|
assert(IsKindOf(host, "XDialog")) |
|
host:SetMode(param) |
|
elseif effect == "back" and host then |
|
assert(IsKindOf(host, "XDialog")) |
|
SetBackDialogMode(host) |
|
elseif effect == "popup" then |
|
local actions_view = GetParentOfKind(source, "XActionsView") |
|
if actions_view then |
|
actions_view:PopupAction(self.ActionId, host, source) |
|
else |
|
XShortcutsTarget:OpenPopupMenu(self.ActionId, terminal.GetMousePos()) |
|
end |
|
else |
|
|
|
end |
|
end, |
|
}, { |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "GodMode", |
|
'ActionTranslate', false, |
|
'ActionName', "God mode (toggle)", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatEnable", "GodMode", "player1") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "InfiniteAP", |
|
'ActionTranslate', false, |
|
'ActionName', "Infinite AP (toggle)", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatEnable", "InfiniteAP", "player1") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "AlwaysHit", |
|
'ActionTranslate', false, |
|
'ActionName', "Always hit (toggle)", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatEnable", "AlwaysHit") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "AlwaysMiss", |
|
'ActionTranslate', false, |
|
'ActionName', "Always miss (toggle)", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatEnable", "AlwaysMiss") |
|
end, |
|
}), |
|
PlaceObj('XTemplateAction', { |
|
'ActionId', "SpawnEnemy", |
|
'ActionTranslate', false, |
|
'ActionName', "Spawn enemy", |
|
'OnAction', function (self, host, source, ...) |
|
host:Op("GedOpTriggerCheat", "root", "CheatSpawnEnemy") |
|
end, |
|
}), |
|
}), |
|
}) |
|
|
|
|