Creating Apps: Difference between revisions
Jump to navigation
Jump to search
Line 85: | Line 85: | ||
| iconColor || optional || background color for the app icon | | iconColor || optional || background color for the app icon | ||
|- | |- | ||
| | | statusIcons || optional || List of icon images to sue for status window | ||
=== Target types === | === Target types === | ||
Line 121: | Line 118: | ||
| never || App will never be shown in this menu | | never || App will never be shown in this menu | ||
|- | |- | ||
| | | byDefault || App will be set as favourite for this menu by default (but can be removed by player) | ||
|- | |- | ||
| target || App will always display in Radial menu if current target matches the | | target || App will always display in Radial menu if current target matches one of the target types for the app. | ||
|} | |} | ||
Revision as of 14:40, 7 November 2018
Example Lua script
app = { name = "Example App", description = "How to make your first app for Off Grid.", cost = 2, targets = {TargetType.Data}, showInRadial = AppMenuState.target, showInAppWheel = AppMenuState.byDefault, state = AppState.off, icon = "ExampleApp.png", iconColor = Color.Blue, statusIcons = { "option1.png", "option2.png"}, actions = { { name = "DefaultAction", run = function(target) -- In 3rd person mode executing app will always trigger first action end, }, { name = "ExtraAction", run = function(target) -- In radial menu mode if there's more than one action, triggering the app opens a popup menu to select which action to take. end, }, }, options = { someOption = { name = "Some option", enabled = true, }, anotherOption = { name = "Some other option", enabled = false, OnOptionChange = function() -- This runs when the option is toggled. end }, }, Update = function(time) -- Update will run regularly when the app is switched on- end, OnStateChange = function(state) -- This runs when something on game side asks the app to change it's state app.state = state SetState(app.state) end, UpdateActions = function(target) -- If you want to change available actions based on the target player has selected, do it here. end, }
App configuration
App Table | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Name | Required/Optional | Description | ||||||||||||||||||||||||||||||||||||||||
name | required | Name of the app | ||||||||||||||||||||||||||||||||||||||||
description | required | Short description of what the app does | ||||||||||||||||||||||||||||||||||||||||
cost | optional | How many seconds the tracking progress increases when using this app | ||||||||||||||||||||||||||||||||||||||||
targets | optional | List of what target types the app can have | ||||||||||||||||||||||||||||||||||||||||
showInRadial | optional | How the app should be displayed in Radial menu. See menu options. | ||||||||||||||||||||||||||||||||||||||||
showInAppWheel | optional | How the app should be displayed in the AppWheel. See menu options. | ||||||||||||||||||||||||||||||||||||||||
state | required | Current state of the app. | ||||||||||||||||||||||||||||||||||||||||
icon | required | Path to icon image | ||||||||||||||||||||||||||||||||||||||||
iconColor | optional | background color for the app icon | ||||||||||||||||||||||||||||||||||||||||
statusIcons | optional | List of icon images to sue for status window
Target typestargets = {TargetType.Data, TargetType.Hackable},
Menu options
States
|