Skip to content

Commit

Permalink
ALTV-626 make playerDimensionChange shared (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh authored and OlegT committed Jan 9, 2025
1 parent 86ade52 commit ff6682b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
13 changes: 0 additions & 13 deletions server/src/events/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "cpp-sdk/events/CPlayerWeaponChangeEvent.h"
#include "cpp-sdk/events/CLocalMetaDataChangeEvent.h"
#include "cpp-sdk/events/CPlayerRequestControlEvent.h"
#include "cpp-sdk/events/CPlayerDimensionChangeEvent.h"

using alt::CEvent;
using EventType = CEvent::Type;
Expand Down Expand Up @@ -185,18 +184,6 @@ V8_LOCAL_EVENT_HANDLER requestControl(EventType::PLAYER_REQUEST_CONTROL,
args.push_back(resource->GetBaseObjectOrNull(ev->GetTarget()));
});

V8_LOCAL_EVENT_HANDLER playerDimensionChange(EventType::PLAYER_DIMENSION_CHANGE,
"playerDimensionChange",
[](V8ResourceImpl* resource, const alt::CEvent* e, std::vector<v8::Local<v8::Value>>& args)
{
auto ev = static_cast<const alt::CPlayerDimensionChangeEvent*>(e);
v8::Isolate* isolate = resource->GetIsolate();

args.push_back(resource->GetBaseObjectOrNull(ev->GetTarget()));
args.push_back(V8Helpers::JSValue(ev->GetOldDimension()));
args.push_back(V8Helpers::JSValue(ev->GetNewDimension()));
});

V8_LOCAL_EVENT_HANDLER playerSpawn(EventType::PLAYER_SPAWN,
"playerSpawn",
[](V8ResourceImpl* resource, const alt::CEvent* e, std::vector<v8::Local<v8::Value>>& args)
Expand Down
14 changes: 13 additions & 1 deletion shared/events/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "cpp-sdk/events/CPlayerChangeAnimationEvent.h"
#include "cpp-sdk/events/CPlayerChangeInteriorEvent.h"
#include "cpp-sdk/events/CPlayerDimensionChangeEvent.h"

using EventType = alt::CEvent::Type;

Expand All @@ -20,7 +21,6 @@ V8_LOCAL_EVENT_HANDLER animationChange(EventType::PLAYER_CHANGE_ANIMATION_EVENT,
args.emplace_back(V8Helpers::JSValue(ev->GetNewAnimationName()));
});


V8_LOCAL_EVENT_HANDLER playerInteriorChange(EventType::PLAYER_CHANGE_INTERIOR_EVENT,
"playerInteriorChange",
[](V8ResourceImpl* resource, const alt::CEvent* e, std::vector<v8::Local<v8::Value>>& args)
Expand All @@ -32,3 +32,15 @@ V8_LOCAL_EVENT_HANDLER playerInteriorChange(EventType::PLAYER_CHANGE_INTERIOR_EV
args.emplace_back(V8Helpers::JSValue(ev->GetOldInteriorLocation()));
args.emplace_back(V8Helpers::JSValue(ev->GetNewInteriorLocation()));
});

V8_LOCAL_EVENT_HANDLER playerDimensionChange(EventType::PLAYER_DIMENSION_CHANGE,
"playerDimensionChange",
[](V8ResourceImpl* resource, const alt::CEvent* e, std::vector<v8::Local<v8::Value>>& args)
{
auto ev = static_cast<const alt::CPlayerDimensionChangeEvent*>(e);
v8::Isolate* isolate = resource->GetIsolate();

args.push_back(resource->GetBaseObjectOrNull(ev->GetTarget()));
args.push_back(V8Helpers::JSValue(ev->GetOldDimension()));
args.push_back(V8Helpers::JSValue(ev->GetNewDimension()));
});

0 comments on commit ff6682b

Please sign in to comment.