blob: 5961d839903505639a4112ac1a3afa60313811b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
untyped
global function AiTurret_Init
global function GetMegaTurretLinkedToPanel
global function MegaTurretUsabilityFunc
global function SetUsePromptForPanel
global function RevivableTurret_DamageCallback
global function RevivableTurret_Revive
void function AiTurret_Init()
{
}
entity function GetMegaTurretLinkedToPanel( entity panel )
{
return null
}
string function MegaTurretUsabilityFunc( var turret, var panel )
{
return "pilot"
}
void function SetUsePromptForPanel( var panel, var turret )
{
}
void function RevivableTurret_DamageCallback( entity turret, var damageInfo )
{
if( turret.GetHealth() <= DamageInfo_GetDamage( damageInfo ) )
{
turret.SetHealth( 1 )
turret.SetUsable()
turret.SetUsableByGroup( "pilot" )
turret.SetUsePrompts( "#TURRET_WAKEUP_HOLD_USE", "#TURRET_WAKEUP_PRESS_USE" )
turret.useFunction = RevivableTurret_UseFunction
thread RevivableTurret_Kill( turret )
DamageInfo_SetDamage( damageInfo, 0.0 )
}
}
function RevivableTurret_UseFunction( player , turret )
{
entity tur = expect entity( turret )
thread RevivableTurret_Revive( tur )
return true
}
void function RevivableTurret_Revive( entity turret )
{
turret.SetHealth( turret.GetMaxHealth() )
turret.ClearInvulnerable()
turret.Anim_ScriptedPlay( "deploy" )
wait 1.0
turret.EnableTurret()
turret.DisableNPCFlag( NPC_IGNORE_ALL )
turret.SetNoTarget( false )
}
void function RevivableTurret_Kill( entity turret )
{
turret.EnableNPCFlag( NPC_IGNORE_ALL )
turret.SetNoTarget( true )
turret.SetInvulnerable()
turret.Anim_ScriptedPlay( "undeploy" )
wait 1
turret.SetNoTarget( true )
turret.DisableTurret()
}
|