From 0a023120824e7f04b9811a0ec9a13593869500b1 Mon Sep 17 00:00:00 2001 From: Fabian Druschke Date: Thu, 12 Mar 2026 14:30:27 +0100 Subject: [PATCH 1/4] add more NPC event hooks --- include/Server/Components/NPCs/npcs.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/Server/Components/NPCs/npcs.hpp b/include/Server/Components/NPCs/npcs.hpp index ea6c61d..6bc9cac 100644 --- a/include/Server/Components/NPCs/npcs.hpp +++ b/include/Server/Components/NPCs/npcs.hpp @@ -399,10 +399,13 @@ struct NPCEventHandler virtual void onNPCDestroy(INPC& npc) {}; virtual void onNPCSpawn(INPC& npc) {}; virtual void onNPCRespawn(INPC& npc) {}; + virtual void onNPCUpdate(INPC& npc) {}; virtual void onNPCWeaponStateChange(INPC& npc, PlayerWeaponState newState, PlayerWeaponState oldState) {}; virtual bool onNPCTakeDamage(INPC& npc, IPlayer& damager, float damage, uint8_t weapon, BodyPart bodyPart) { return true; }; virtual bool onNPCGiveDamage(INPC& npc, IPlayer& damaged, float damage, uint8_t weapon, BodyPart bodyPart) { return true; }; virtual void onNPCDeath(INPC& npc, IPlayer* killer, int reason) {}; + virtual void onNPCVehicleEntryComplete(INPC& npc, IVehicle& vehicle, int seatId) {}; + virtual void onNPCVehicleExitComplete(INPC& npc, IVehicle& vehicle) {}; virtual bool onNPCShotMissed(INPC& npc, const PlayerBulletData& bulletData) { return true; } virtual bool onNPCShotPlayer(INPC& npc, IPlayer& target, const PlayerBulletData& bulletData) { return true; } virtual bool onNPCShotNPC(INPC& npc, INPC& target, const PlayerBulletData& bulletData) { return true; } @@ -411,6 +414,7 @@ struct NPCEventHandler virtual bool onNPCShotPlayerObject(INPC& npc, IPlayerObject& target, const PlayerBulletData& bulletData) { return true; } virtual void onNPCPlaybackStart(INPC& npc, int recordId) { } virtual void onNPCPlaybackEnd(INPC& npc, int recordId) { } + virtual void onNPCChangeHeightPos(INPC& npc, float newZ, float oldZ) { } virtual void onNPCFinishNodePoint(INPC& npc, int nodeId, uint16_t pointId) { } virtual void onNPCFinishNode(INPC& npc, int nodeId) { } virtual bool onNPCChangeNode(INPC& npc, int newNodeId, int oldNodeId) { return true; } From 70c51eef1952bdec389cf2b5a822ce670e60a078 Mon Sep 17 00:00:00 2001 From: Fabian Druschke Date: Thu, 12 Mar 2026 14:30:27 +0100 Subject: [PATCH 2/4] add stream in and out hooks --- include/Server/Components/NPCs/npcs.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/Server/Components/NPCs/npcs.hpp b/include/Server/Components/NPCs/npcs.hpp index 6bc9cac..6a7906a 100644 --- a/include/Server/Components/NPCs/npcs.hpp +++ b/include/Server/Components/NPCs/npcs.hpp @@ -400,6 +400,8 @@ struct NPCEventHandler virtual void onNPCSpawn(INPC& npc) {}; virtual void onNPCRespawn(INPC& npc) {}; virtual void onNPCUpdate(INPC& npc) {}; + virtual void onNPCStreamIn(INPC& npc, IPlayer& forPlayer) {}; + virtual void onNPCStreamOut(INPC& npc, IPlayer& forPlayer) {}; virtual void onNPCWeaponStateChange(INPC& npc, PlayerWeaponState newState, PlayerWeaponState oldState) {}; virtual bool onNPCTakeDamage(INPC& npc, IPlayer& damager, float damage, uint8_t weapon, BodyPart bodyPart) { return true; }; virtual bool onNPCGiveDamage(INPC& npc, IPlayer& damaged, float damage, uint8_t weapon, BodyPart bodyPart) { return true; }; From b9434af8f3bbe23ee30f36a6159a1b4406954d64 Mon Sep 17 00:00:00 2001 From: Fabian Druschke Date: Thu, 12 Mar 2026 14:30:27 +0100 Subject: [PATCH 3/4] more NPC SDK function exposure --- include/Server/Components/NPCs/npcs.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/Server/Components/NPCs/npcs.hpp b/include/Server/Components/NPCs/npcs.hpp index 6a7906a..8ecc492 100644 --- a/include/Server/Components/NPCs/npcs.hpp +++ b/include/Server/Components/NPCs/npcs.hpp @@ -385,6 +385,27 @@ struct INPC : public IExtensible, public IIDProvider /// Get player moving to virtual IPlayer* getPlayerMovingTo() = 0; + /// Find the closest entity intersecting a segment/ray between the NPC and a target point + virtual int getClosestEntityInBetween(const Vector3& point, float range, EntityCheckType betweenCheckFlags, const Vector3& offsetFrom, int& entityType, int& playerObjectOwnerId, Vector3& hitMap) = 0; + + /// Set/get playback path prefix for path-based playback resolution + virtual void setPlaybackPath(StringView path) = 0; + virtual StringView getPlaybackPath() const = 0; + + /// Set/get per-NPC weapon behaviour overrides + virtual void setWeaponInfo(uint8_t weapon, int reloadTime, int shootTime, int clipSize, float accuracy) = 0; + virtual bool getWeaponInfo(uint8_t weapon, int& reloadTime, int& shootTime, int& clipSize, float& accuracy) const = 0; + + /// Control per-player tablist visibility for the NPC + virtual bool showInTabListForPlayer(IPlayer& forPlayer) = 0; + virtual bool hideInTabListForPlayer(IPlayer& forPlayer) = 0; + + /// FCNPC-compatible move-mode and height callback tuning state + virtual bool setMoveMode(int mode) = 0; + virtual int getMoveMode() const = 0; + virtual void setMinHeightPosCall(float height) = 0; + virtual float getMinHeightPosCall() const = 0; + /// Set weapon state virtual void setWeaponState(PlayerWeaponState state) = 0; @@ -508,4 +529,8 @@ struct INPCComponent : public IPool, public INetworkComponent /// Get node information (vehicle nodes, pedestrian nodes, navigation nodes) virtual bool getNodeInfo(int nodeId, uint32_t& vehicleNodes, uint32_t& pedNodes, uint32_t& naviNodes) = 0; + + /// Set/get global default weapon behaviour overrides used for new NPC instances + virtual bool setWeaponDefaultInfo(int weapon, int reloadTime, int shootTime, int clipSize, float accuracy) = 0; + virtual bool getWeaponDefaultInfo(int weapon, int& reloadTime, int& shootTime, int& clipSize, float& accuracy) = 0; }; From 8e06ac05053ba8bc278669ddc9d2a62218ebd2fd Mon Sep 17 00:00:00 2001 From: Fabian Druschke Date: Thu, 12 Mar 2026 14:30:27 +0100 Subject: [PATCH 4/4] add vehicle damage hook --- include/Server/Components/NPCs/npcs.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/Server/Components/NPCs/npcs.hpp b/include/Server/Components/NPCs/npcs.hpp index 8ecc492..990615f 100644 --- a/include/Server/Components/NPCs/npcs.hpp +++ b/include/Server/Components/NPCs/npcs.hpp @@ -429,6 +429,7 @@ struct NPCEventHandler virtual void onNPCDeath(INPC& npc, IPlayer* killer, int reason) {}; virtual void onNPCVehicleEntryComplete(INPC& npc, IVehicle& vehicle, int seatId) {}; virtual void onNPCVehicleExitComplete(INPC& npc, IVehicle& vehicle) {}; + virtual bool onNPCVehicleTakeDamage(INPC& npc, IPlayer& issuer, IVehicle& vehicle, float damage, uint8_t weapon, const Vector3& hitPos) { return true; }; virtual bool onNPCShotMissed(INPC& npc, const PlayerBulletData& bulletData) { return true; } virtual bool onNPCShotPlayer(INPC& npc, IPlayer& target, const PlayerBulletData& bulletData) { return true; } virtual bool onNPCShotNPC(INPC& npc, INPC& target, const PlayerBulletData& bulletData) { return true; }