Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс DeveloperTeleport

Защищенные статические члены

static void TeleportAtCursor ()
 
static void TeleportAtCursorEx ()
 
static Object GetPlayerRootForTeleporting (PlayerBase player)
 
static void SetPlayerPosition (PlayerBase player, vector position, bool breakSync=false)
 
static void SetPlayerDirection (PlayerBase player, vector direction)
 
static void OnRPC (PlayerBase player, int rpc_type, ParamsReadContext ctx)
 
void OnRPCSetPlayerPosition (PlayerBase player, ParamsReadContext ctx)
 
void OnRPCSetPlayerDirection (PlayerBase player, ParamsReadContext ctx)
 

Статические защищенные данные

static const float TELEPORT_DISTANCE_MAX = 1000
 
static const float TELEPORT_DISTANCE_MAX_EX = 500
 

Подробное описание

Методы

◆ GetPlayerRootForTeleporting()

static Object GetPlayerRootForTeleporting ( PlayerBase player)
inlinestaticprotected
86 {
88
89 HumanCommandVehicle hcv = player.GetCommand_Vehicle();
90 if (hcv)
91 {
92 playerRoot = hcv.GetTransport();
93 }
94
95 HumanCommandUnconscious hcu = player.GetCommand_Unconscious();
96 if (hcu)
97 {
98 Class.CastTo(playerRoot, player.GetParent());
99
100 if (playerRoot != player.GetTransportCache())
101 {
103 }
104 }
105
106 if (playerRoot == null)
107 {
109 }
110
111 return playerRoot;
112 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition human.c:620
Definition human.c:690
Definition ObjectTyped.c:2
Definition EntityAI.c:95
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

Перекрестные ссылки Class::CastTo().

Используется в SetPlayerDirection() и SetPlayerPosition().

◆ OnRPC()

static void OnRPC ( PlayerBase player,
int rpc_type,
ParamsReadContext ctx )
inlinestaticprotected
169 {
170 #ifdef DIAG_DEVELOPER
171 if ( rpc_type == ERPCs.DEV_RPC_TELEPORT )
172 {
174 }
175 else if ( rpc_type == ERPCs.DEV_RPC_SET_PLAYER_DIRECTION )
176 {
178 }
179 #endif
180 }
ERPCs
Definition ERPCs.c:2
void OnRPCSetPlayerDirection(PlayerBase player, ParamsReadContext ctx)
Definition DeveloperTeleport.c:195
void OnRPCSetPlayerPosition(PlayerBase player, ParamsReadContext ctx)
Definition DeveloperTeleport.c:182

Перекрестные ссылки OnRPCSetPlayerDirection() и OnRPCSetPlayerPosition().

Используется в PluginBase::OnRPC().

◆ OnRPCSetPlayerDirection()

void OnRPCSetPlayerDirection ( PlayerBase player,
ParamsReadContext ctx )
inlinestaticprotected
196 {
198 if (ctx.Read(p))
199 {
200 vector v = "0 0 0";
201 v[0] = p.param1;
202 v[1] = p.param2;
203 v[2] = p.param3;
205 }
206 }
static void SetPlayerDirection(PlayerBase player, vector direction)
Definition DeveloperTeleport.c:153
Definition EnConvert.c:106

Перекрестные ссылки SetPlayerDirection().

Используется в OnRPC().

◆ OnRPCSetPlayerPosition()

void OnRPCSetPlayerPosition ( PlayerBase player,
ParamsReadContext ctx )
inlinestaticprotected
183 {
185 if (ctx.Read(p))
186 {
187 vector v = "0 0 0";
188 v[0] = p.param1;
189 v[1] = p.param2;
190 v[2] = p.param3;
191 SetPlayerPosition(player, v, p.param4);
192 }
193 }
static void SetPlayerPosition(PlayerBase player, vector position, bool breakSync=false)
Definition DeveloperTeleport.c:115

Перекрестные ссылки SetPlayerPosition().

Используется в OnRPC().

◆ SetPlayerDirection()

static void SetPlayerDirection ( PlayerBase player,
vector direction )
inlinestaticprotected
154 {
156
157 if (GetGame().IsServer())
158 {
159 playerRoot.SetDirection(direction);
160 }
161 else
162 {
164 player.RPCSingleParam(ERPCs.DEV_RPC_SET_PLAYER_DIRECTION, params, true);
165 }
166 }
static Object GetPlayerRootForTeleporting(PlayerBase player)
Definition DeveloperTeleport.c:85
proto native CGame GetGame()

Перекрестные ссылки GetGame() и GetPlayerRootForTeleporting().

Используется в OnRPCSetPlayerDirection() и TeleportAtCursorEx().

◆ SetPlayerPosition()

static void SetPlayerPosition ( PlayerBase player,
vector position,
bool breakSync = false )
inlinestaticprotected
116 {
118
119#ifdef DIAG_DEVELOPER
120 if (GetGame().IsMultiplayer() && breakSync)
121 {
122 vector v;
123 v[0] = Math.RandomFloat(-Math.PI, Math.PI);
124 v[1] = Math.RandomFloat(-Math.PI, Math.PI);
125 v[2] = Math.RandomFloat(-Math.PI, Math.PI);
128
129 v[0] = Math.RandomFloat(-Math.PI, Math.PI);
130 v[1] = Math.RandomFloat(-Math.PI, Math.PI);
131 v[2] = Math.RandomFloat(-Math.PI, Math.PI);
132 playerRoot.SetOrientation(v * Math.RAD2DEG);
133 }
134#endif
135
136 if (position[1] < GetGame().SurfaceGetSeaLevel())
137 {
138 position[1] = GetGame().SurfaceGetSeaLevel();
139 }
140
141 if (GetGame().IsServer())
142 {
143 playerRoot.SetPosition(position);
144 }
145 else
146 {
148 player.RPCSingleParam(ERPCs.DEV_RPC_TELEPORT, params, true);
149 }
150 }
Definition EnMath.c:7
static const vector Zero
Definition EnConvert.c:110
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static const float PI
Definition EnMath.c:12
static const float RAD2DEG
Definition EnMath.c:16
proto native void SetVelocity(notnull IEntity ent, vector vel)
Sets linear velocity (for Rigid bodies)
proto void dBodySetAngularVelocity(notnull IEntity body, vector angvel)
Changed an angular velocity.

Перекрестные ссылки dBodySetAngularVelocity(), GetGame(), GetPlayerRootForTeleporting(), Math::PI, Math::RAD2DEG, Math::RandomFloat(), SetVelocity() и vector::Zero.

Используется в OnRPCSetPlayerPosition(), PluginBase::Teleport(), TeleportAtCursor() и TeleportAtCursorEx().

◆ TeleportAtCursor()

static void TeleportAtCursor ( )
inlinestaticprotected
6 {
8 {
10 vector pos_player = player.GetPosition();
11
12 Object ignore;
13 if (!Class.CastTo(ignore, player.GetParent()))
14 {
15 ignore = player;
16 }
17
18 vector rayStart = GetGame().GetCurrentCameraPosition();
19 vector rayEnd = rayStart + GetGame().GetCurrentCameraDirection() * 1000;
24
26
28 {
29 bool breakSync = false;
30
31 #ifdef DIAG_DEVELOPER
32 breakSync = DiagMenu.GetBool(DiagMenuIDs.MISC_TELEPORT_BREAKS_SYNC);
33 #endif
34
36 }
37 else
38 {
39 Debug.LogWarning("Distance for teleportation is too far!");
40 }
41 }
42 }
DiagMenuIDs
Definition EDiagMenuIDs.c:2
PlayerBase GetPlayer()
Definition ModifierBase.c:47
Definition DayZPhysics.c:124
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
Definition Debug.c:14
static void LogWarning(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as warning message.
Definition Debug.c:356
Definition DeveloperFreeCamera.c:2
static bool IsFreeCameraEnabled()
Definition DeveloperFreeCamera.c:23
static const float TELEPORT_DISTANCE_MAX
Definition DeveloperTeleport.c:3
Definition EnDebug.c:233
Definition PlayerBaseClient.c:2
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.

Перекрестные ссылки Class::CastTo(), vector::Distance(), DiagMenu::GetBool(), GetGame(), GetPlayer(), DeveloperFreeCamera::IsFreeCameraEnabled(), Debug::LogWarning(), DayZPhysics::RaycastRV(), SetPlayerPosition() и TELEPORT_DISTANCE_MAX.

◆ TeleportAtCursorEx()

static void TeleportAtCursorEx ( )
inlinestaticprotected
46 {
48 vector rayStart = GetGame().GetCurrentCameraPosition();
49 vector rayEnd = rayStart + GetGame().GetCurrentCameraDirection() * TELEPORT_DISTANCE_MAX_EX;
52 float hitFraction;
54
55 Object ignore;
56 if (!Class.CastTo(ignore, player.GetParent()))
57 {
58 ignore = player;
59 }
60
61 int layers = 0;
64 layers |= PhxInteractionLayers.ITEM_LARGE;
65 layers |= PhxInteractionLayers.BUILDING;
69 {
70 bool breakSync = false;
71
72 #ifdef DIAG_DEVELOPER
73 breakSync = DiagMenu.GetBool(DiagMenuIDs.MISC_TELEPORT_BREAKS_SYNC);
74 #endif
75
77
79 {
80 DeveloperTeleport.SetPlayerDirection( player, FreeDebugCamera.GetInstance().GetDirection() );
81 }
82 }
83 }
PhxInteractionLayers
Definition DayZPhysics.c:2
static proto bool SphereCastBullet(vector begPos, vector endPos, float radius, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
Definition DeveloperTeleport.c:2
static const float TELEPORT_DISTANCE_MAX_EX
Definition DeveloperTeleport.c:44

Перекрестные ссылки Class::CastTo(), DiagMenu::GetBool(), GetGame(), GetPlayer(), DeveloperFreeCamera::IsFreeCameraEnabled(), SetPlayerDirection(), SetPlayerPosition(), DayZPhysics::SphereCastBullet() и TELEPORT_DISTANCE_MAX_EX.

Используется в DeveloperFreeCamera::DisableFreeCamera() и PluginBase::TeleportAtCursor().

Поля

◆ TELEPORT_DISTANCE_MAX

const float TELEPORT_DISTANCE_MAX = 1000
staticprotected

Используется в TeleportAtCursor().

◆ TELEPORT_DISTANCE_MAX_EX

const float TELEPORT_DISTANCE_MAX_EX = 500
staticprotected

Используется в TeleportAtCursorEx().


Объявления и описания членов класса находятся в файле: