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 types
targets = {TargetType.Data, TargetType.Hackable},
Name |
value |
Description
|
None |
0 |
No target. USe for apps which don't require any target at all.
|
Data |
1 |
Any data points currently visible to the player
|
Interaction |
2 |
Physical interactions in the levels
|
Hackable |
4 |
Hackable devices in player's current networks
|
Character |
8 |
People
|
Name |
Description
|
always |
App is always displayed 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 one of the target types for the app.
|
States
Name |
Description
|
unavailable |
The player doesn't have this app yet
|
disabled |
App can't be used at the moment, for example no network connection
|
off |
"App is not doing anything
|
on |
App is switched on and running in the background
|
alert |
"App displays alert to notify the player about something
|
|