Skip to content

Commit

Permalink
game_dir: added trigger_teleport_point entity to FGD
Browse files Browse the repository at this point in the history
  • Loading branch information
SNMetamorph committed Nov 22, 2024
1 parent 08bb151 commit 99ddc30
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 14 additions & 1 deletion game_dir/primext.fgd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// PrimeXT FGD (last updated 18 February 2024)
// PrimeXT FGD (last updated 23 November 2024)
// Please report any found errors at: https://github.com/SNMetamorph/PrimeXT/issues (Subject: "FGD error")

//
Expand Down Expand Up @@ -4475,6 +4475,19 @@
m_iszPath(target_destination) : "Patrol Path Start"
]

@PointClass base(Targetname) color(180 255 10) = trigger_teleport_point : "Teleport any entity regardless of its current location. This entity acts as a target. To teleport the player, leave Entity field empty or write: player."
[
target(target_destination) : "Activate after tele"
master(target_destination) : "Master"
entityname(target_destination) : "Entity name"
spawnflags(flags) =
[
1: "Keep entity's velocity" : 0
2: "Keep entity's angles" : 0
4: "Remove after teleport" : 0
]
]

@SolidClass base(Trigger) = trigger_teleport : "Trigger Teleport" []

@SolidClass base(Targetname) = trigger_transition : "Trigger: Select Transition Area" []
Expand Down
6 changes: 3 additions & 3 deletions server/entities/trigger_teleport_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ void CTriggerTeleportPoint::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, U
entityVelocity = pEntity->GetAbsVelocity();
}

Vector EntityAngles = targetAng;
Vector entityAngles = targetAng;
if (FBitSet(pev->spawnflags, PT_KEEP_ANGLES)) {
EntityAngles = pEntity->GetAbsAngles();
entityAngles = pEntity->GetAbsAngles();
}

// offset to correctly teleport the player...
if (pEntity->IsPlayer()) {
targetOrg.z += 36;
}

pEntity->Teleport(&targetOrg, &EntityAngles, &entityVelocity);
pEntity->Teleport(&targetOrg, &entityAngles, &entityVelocity);

UTIL_FireTargets(pev->target, pActivator, pCaller, USE_TOGGLE, 0);

Expand Down

0 comments on commit 99ddc30

Please sign in to comment.