-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MetadataStart migrate to Module (#275)
* MetadataStart migrate to Module * Added modules to AircraftTest.lua * Update BIOS.lua Earlier migrated modules changed to be used
- Loading branch information
Showing
4 changed files
with
48 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Scripts/DCS-BIOS/lib/modules/common_modules/MetadataStart.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- This is a special module: its data will always be exported | ||
-- and its export hooks will be called regardless of aircraft. | ||
-- It cannot access any cockpit arguments, because it will also | ||
-- be called when there is no active aircraft. | ||
|
||
module("MetadataStart", package.seeall) | ||
|
||
local Module = require("Module") | ||
|
||
--- @class MetadataStart: Module | ||
--- @field setAircraftName function | ||
local MetadataStart = Module:new("MetadataStart", 0x0000, BIOS.ALL_PLAYABLE_AIRCRAFT) | ||
|
||
-- "data" will be set by the Protocol module | ||
local aircraft_name | ||
|
||
--- @func Sets the name of the aircraft | ||
--- @param new_aircraft_name string | ||
function MetadataStart:setAircraftName(new_aircraft_name) | ||
aircraft_name = new_aircraft_name | ||
end | ||
|
||
MetadataStart:defineString("_ACFT_NAME", function() | ||
return aircraft_name .. string.char(0) | ||
end, 24, "Metadata", "Aircraft Name (or NONE), null-terminated") | ||
|
||
return MetadataStart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters