Files
MOOSE/Moose Test Missions/SPA - Spawning/SPA-130 - Uncontrolled Spawning/SPA-130 - Uncontrolled Spawning.lua
T
FlightControl 52f4051901 Various Fixes
-- Documentation fixes with links not working.
-- MENU_CLIENT_COMMAND had a small glitch, fixed that one too.
-- Implemented new Event Dispatcher.
--
2017-02-04 15:16:32 +01:00

47 lines
1.4 KiB
Lua

---
-- Name: SPA-130 - Uncontrolled Spawning
-- Author: FlightControl
-- Date Created: 04 Feb 2017
--
-- # Situation:
--
-- A plane will be spawned Uncontrolled and later one will be spawned Controlled.
-- Only the Controlled plane will move, the other will remain idle at the parking spot.
--
-- # Test cases:
--
-- 1. Observe the spawning of the UnControlled Plane.
-- 2. Observe the spawning of the Controlled Plane.
-- Create the SPAWN object looking for the group (template) "Plane".
local SpawnPlane = SPAWN:New( "Plane" )
-- Set the spawn mode to UnControlled.
SpawnPlane:InitUnControlled( true )
-- Spawn the UnControlled Group
local UnControlledPlane = SpawnPlane:Spawn()
-- Set the spawn mode back to Controlled.
SpawnPlane:InitUnControlled( false )
local ControlledPlane = SpawnPlane:Spawn()
-- Now, let's create a menu option at a player slot plane...
-- We can only create the menu option if the player has joined the slot ...
local PlayerPlane = CLIENT:FindByName( "PlayerPlane", "Select Menu item to activate UnControlled plane" )
PlayerPlane:Alive(
function( Client, SpawnPlane )
--- @param Functional.Spawn#SPAWN SpawnPlane
local function ActivatePlane( SpawnPlane )
SpawnPlane:InitUnControlled( false )
SpawnPlane:ReSpawn( 1 )
end
local Menu = MENU_CLIENT_COMMAND:New( Client, "Select to activate UnControlled plane", nil, ActivatePlane, SpawnPlane )
end
, SpawnPlane
)