DayZ 1.24
Loading...
Searching...
No Matches
DayZSpectator Class Reference
Inheritance diagram for DayZSpectator:
[legend]
Collaboration diagram for DayZSpectator:
[legend]

Private Member Functions

void DayZSpectator ()
 
override void EOnFrame (IEntity other, float timeSlice)
 

Private Attributes

float m_SpeedMultiplier = 1.0
 
float m_SendUpdateAcc = 0.0
 

Detailed Description

Definition at line 1 of file DayZSpectator.c.

Constructor & Destructor Documentation

◆ DayZSpectator()

void DayZSpectator::DayZSpectator ( )
inlineprivate

Definition at line 7 of file DayZSpectator.c.

8 {
9 SetEventMask(EntityEvent.FRAME);
10 }
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:44

Member Function Documentation

◆ EOnFrame()

override void DayZSpectator::EOnFrame ( IEntity other,
float timeSlice )
inlineprivate

Definition at line 12 of file DayZSpectator.c.

13 {
14 if (GetUApi().GetInputByID(UACarShiftGearUp).LocalPress())
16 if (GetUApi().GetInputByID(UACarShiftGearDown).LocalPress())
18
19 float speed = 5.0 * m_SpeedMultiplier;
20 if (GetUApi().GetInputByID(UATurbo).LocalValue())
21 speed *= 2;
22
23 float forward = GetUApi().GetInputByID(UAMoveForward).LocalValue() - GetUApi().GetInputByID(UAMoveBack).LocalValue();
24 float strafe = GetUApi().GetInputByID(UAMoveRight).LocalValue() - GetUApi().GetInputByID(UAMoveLeft).LocalValue();
25
26 vector direction = GetDirection();
28
33 float yMin = GetGame().SurfaceRoadY(newPos[0], newPos[2]);
34 if (newPos[1] < yMin)
35 newPos[1] = yMin;
36
38
39 float yawDiff = GetUApi().GetInputByID(UAAimLeft).LocalValue() - GetUApi().GetInputByID(UAAimRight).LocalValue();
40 float pitchDiff = GetUApi().GetInputByID(UAAimDown).LocalValue() - GetUApi().GetInputByID(UAAimUp).LocalValue();
45 if (newOrient[1] < -89)
46 newOrient[1] = -89;
47 if (newOrient[1] > 89)
48 newOrient[1] = 89;
49
50 SetOrientation(newOrient);
51
52 if (m_SendUpdateAcc > 0.5)
53 {
54 GetGame().UpdateSpectatorPosition(newPos);
56 }
57
59 }
vector GetOrientation()
proto native UAInputAPI GetUApi()
class JsonUndergroundAreaTriggerData GetPosition
float m_SendUpdateAcc
float m_SpeedMultiplier
Definition EnMath.c:7
static const vector Up
Definition EnConvert.c:107
proto native CGame GetGame()
proto native void SetPosition(vector position)
Set the world position of the Effect.
Definition Effect.c:420
static const float RAD2DEG
Definition EnMath.c:16

References GetGame(), GetOrientation(), GetPosition, GetUApi(), m_SendUpdateAcc, m_SpeedMultiplier, Math::RAD2DEG, SetPosition(), and vector::Up.

Member Data Documentation

◆ m_SendUpdateAcc

float DayZSpectator::m_SendUpdateAcc = 0.0
private

Definition at line 5 of file DayZSpectator.c.

Referenced by EOnFrame().

◆ m_SpeedMultiplier

float DayZSpectator::m_SpeedMultiplier = 1.0
private

Definition at line 3 of file DayZSpectator.c.

Referenced by EOnFrame().


The documentation for this class was generated from the following file: