-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPythonModule.h
More file actions
1198 lines (1132 loc) · 49.8 KB
/
PythonModule.h
File metadata and controls
1198 lines (1132 loc) · 49.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#pragma once
const char *callbackNames[] = {
"on_server_initialise",
"on_server_shutdown",
"on_server_frame",
"on_plugin_command",
"on_incoming_connection",
"on_client_script_data",
"on_player_connect",
"on_player_disconnect",
"on_player_request_class",
"on_player_request_spawn",
"on_player_spawn",
"on_player_death",
"on_player_update",
"on_player_request_enter_vehicle",
"on_player_enter_vehicle",
"on_player_exit_vehicle",
"on_player_name_change",
"on_player_state_change",
"on_player_action_change",
"on_player_on_fire_change",
"on_player_crouch_change",
"on_player_game_keys_change",
"on_player_begin_typing",
"on_player_end_typing",
"on_player_away_change",
"on_player_message",
"on_player_command",
"on_player_private_message",
"on_player_key_bind_down",
"on_player_key_bind_up",
"on_player_spectate",
"on_player_crash_report",
"on_vehicle_update",
"on_vehicle_explode",
"on_vehicle_respawn",
"on_object_shot",
"on_object_touched",
"on_pickup_pick_attempt",
"on_pickup_picked",
"on_pickup_respawn",
"on_checkpoint_entered",
"on_checkpoint_exited",
"on_entity_pool_change",
"on_server_performance_report",
};
void RegisterFunctions(py::module functions)
{
/**
* Plugin system
*/
functions.def("get_server_version", []() {
return vcmpFunctions->GetServerVersion();
});
functions.def("get_server_settings", []() -> py::object {
ServerSettings settings;
if (vcmpFunctions->GetServerSettings(&settings) == vcmpErrorNone)
return py::make_tuple(settings.serverName, settings.maxPlayers, settings.port, settings.flags);
return py::none();
});
/*functions.def("export_functions", [](int32_t pluginId, const void** functionList, size_t size) {
return vcmpFunctions->ExportFunctions(pluginId, functionList, size);
});*/
functions.def("get_number_of_plugins", []() {
return vcmpFunctions->GetNumberOfPlugins();
});
functions.def("get_plugin_info", [](int32_t pluginId) -> py::object {
PluginInfo pluginInfo;
if (vcmpFunctions->GetPluginInfo(pluginId, &pluginInfo) == vcmpErrorNone)
return py::make_tuple(pluginInfo.name, pluginInfo.pluginVersion, pluginInfo.apiMajorVersion, pluginInfo.apiMinorVersion);
return py::none();
});
functions.def("find_plugin", [](const char* pluginName) {
return vcmpFunctions->FindPlugin(pluginName);
});
functions.def("send_plugin_command", [](uint32_t commandIdentifier, const char* command) {
return static_cast<int32_t>(vcmpFunctions->SendPluginCommand(commandIdentifier, "%s", command));
});
functions.def("get_time", []() {
return vcmpFunctions->GetTime();
});
functions.def("log_message", [](const char* message) {
return static_cast<int32_t>(vcmpFunctions->LogMessage("%s", message));
});
functions.def("get_last_error", []() {
return static_cast<int32_t>(vcmpFunctions->GetLastError());
});
/**
* Client messages
*/
functions.def("send_client_script_data", [](int32_t playerId, py::bytes bytes) {
std::string data = bytes;
return static_cast<int32_t>(vcmpFunctions->SendClientScriptData(playerId, data.c_str(), data.size()));
});
functions.def("send_client_message", [](int32_t playerId, uint32_t colour, const char* message) {
return static_cast<int32_t>(vcmpFunctions->SendClientMessage(playerId, colour, "%s", message));
});
functions.def("send_game_message", [](int32_t playerId, int32_t type, const char* message) {
return static_cast<int32_t>(vcmpFunctions->SendGameMessage(playerId, type, "%s", message));
});
/*
* Server settings
*/
functions.def("set_server_name", [](const char* text) {
return static_cast<int32_t>(vcmpFunctions->SetServerName(text));
});
functions.def("get_server_name", []() -> py::object {
char buffer[128];
if (vcmpFunctions->GetServerName(buffer, sizeof(buffer)) == vcmpErrorNone)
return py::str(buffer);
return py::none();
});
functions.def("set_max_players", [](uint32_t maxPlayers) {
return static_cast<int32_t>(vcmpFunctions->SetMaxPlayers(maxPlayers));
});
functions.def("get_max_players", []() {
return vcmpFunctions->GetMaxPlayers();
});
functions.def("set_server_password", [](const char* password) {
return static_cast<int32_t>(vcmpFunctions->SetServerPassword(password));
});
functions.def("get_server_password", []() -> py::object {
char buffer[128];
if (vcmpFunctions->GetServerPassword(buffer, sizeof(buffer)) == vcmpErrorNone)
return py::str(buffer);
return py::none();
});
functions.def("set_game_mode_text", [](const char* gameMode) {
return static_cast<int32_t>(vcmpFunctions->SetGameModeText(gameMode));
});
functions.def("get_game_mode_text", []() -> py::object {
char buffer[128];
if (vcmpFunctions->GetGameModeText(buffer, sizeof(buffer)) == vcmpErrorNone)
return py::str(buffer);
return py::none();
});
functions.def("shutdown_server", []() {
vcmpFunctions->ShutdownServer();
});
/*
* Game environment settings
*/
functions.def("set_server_option", [](int32_t option, bool toggle) {
return static_cast<int32_t>(vcmpFunctions->SetServerOption(static_cast<vcmpServerOption>(option), toggle));
});
functions.def("get_server_option", [](int32_t option) {
return py::bool_(vcmpFunctions->GetServerOption(static_cast<vcmpServerOption>(option)) != 0);
});
functions.def("set_world_bounds", [](float maxX, float minX, float maxY, float minY) {
vcmpFunctions->SetWorldBounds(maxX, minX, maxY, minY);
});
functions.def("get_world_bounds", []() {
float maxXOut, minXOut, maxYOut, minYOut;
vcmpFunctions->GetWorldBounds(&maxXOut, &minXOut, &maxYOut, &minYOut);
return py::make_tuple(maxXOut, minXOut, maxYOut, minYOut);
});
functions.def("set_wasted_settings", [](uint32_t deathTimer, uint32_t fadeTimer, float fadeInSpeed, float fadeOutSpeed, uint32_t fadeColour, uint32_t corpseFadeStart, uint32_t corpseFadeTime) {
vcmpFunctions->SetWastedSettings(deathTimer, fadeTimer, fadeInSpeed, fadeOutSpeed, fadeColour, corpseFadeStart, corpseFadeTime);
});
functions.def("get_wasted_settings", []() {
uint32_t deathTimerOut, fadeTimerOut, fadeColourOut, corpseFadeStartOut, corpseFadeTimeOut;
float fadeInSpeedOut, fadeOutSpeedOut;
vcmpFunctions->GetWastedSettings(&deathTimerOut, &fadeTimerOut, &fadeInSpeedOut, &fadeOutSpeedOut, &fadeColourOut, &corpseFadeStartOut, &corpseFadeTimeOut);
return py::make_tuple(deathTimerOut, fadeTimerOut, fadeInSpeedOut, fadeOutSpeedOut, fadeColourOut, corpseFadeStartOut, corpseFadeTimeOut);
});
functions.def("set_time_rate", [](int32_t timeRate) {
vcmpFunctions->SetTimeRate(timeRate);
});
functions.def("get_time_rate", []() {
return vcmpFunctions->GetTimeRate();
});
functions.def("set_hour", [](int32_t hour) {
vcmpFunctions->SetHour(hour);
});
functions.def("get_hour", []() {
return vcmpFunctions->GetHour();
});
functions.def("set_minute", [](int32_t minute) {
vcmpFunctions->SetMinute(minute);
});
functions.def("get_minute", []() {
return vcmpFunctions->GetMinute();
});
functions.def("set_weather", [](int32_t weather) {
vcmpFunctions->SetWeather(weather);
});
functions.def("get_weather", []() {
return vcmpFunctions->GetWeather();
});
functions.def("set_gravity", [](float gravity) {
vcmpFunctions->SetGravity(gravity);
});
functions.def("get_gravity", []() {
return vcmpFunctions->GetGravity();
});
functions.def("set_game_speed", [](float gameSpeed) {
vcmpFunctions->SetGameSpeed(gameSpeed);
});
functions.def("get_game_speed", []() {
return vcmpFunctions->GetGameSpeed();
});
functions.def("set_water_level", [](float waterLevel) {
vcmpFunctions->SetWaterLevel(waterLevel);
});
functions.def("get_water_level", []() {
return vcmpFunctions->GetWaterLevel();
});
functions.def("set_maximum_flight_altitude", [](float height) {
vcmpFunctions->SetMaximumFlightAltitude(height);
});
functions.def("get_maximum_flight_altitude", []() {
return vcmpFunctions->GetMaximumFlightAltitude();
});
functions.def("set_kill_command_delay", [](int32_t delay) {
vcmpFunctions->SetKillCommandDelay(delay);
});
functions.def("get_kill_command_delay", []() {
return vcmpFunctions->GetKillCommandDelay();
});
functions.def("set_vehicles_forced_respawn_height", [](float height) {
vcmpFunctions->SetVehiclesForcedRespawnHeight(height);
});
functions.def("get_vehicles_forced_respawn_height", []() {
return vcmpFunctions->GetVehiclesForcedRespawnHeight();
});
/*
* Miscellaneous things
*/
functions.def("create_explosion", [](int32_t worldId, int32_t type, float x, float y, float z, int32_t responsiblePlayerId, bool atGroundLevel) {
return static_cast<int32_t>(vcmpFunctions->CreateExplosion(worldId, type, x, y, z, responsiblePlayerId, atGroundLevel));
});
functions.def("play_sound", [](int32_t worldId, int32_t soundId, float x, float y, float z) {
return static_cast<int32_t>(vcmpFunctions->PlaySound(worldId, soundId, x, y, z));
});
functions.def("hide_map_object", [](int32_t modelId, int16_t tenthX, int16_t tenthY, int16_t tenthZ) {
vcmpFunctions->HideMapObject(modelId, tenthX, tenthY, tenthZ);
});
functions.def("show_map_object", [](int32_t modelId, int16_t tenthX, int16_t tenthY, int16_t tenthZ) {
vcmpFunctions->ShowMapObject(modelId, tenthX, tenthY, tenthZ);
});
functions.def("show_all_map_objects", []() {
vcmpFunctions->ShowAllMapObjects();
});
/*
* Weapon settings
*/
functions.def("set_weapon_data_value", [](int32_t weaponId, int32_t fieldId, double value) {
return static_cast<int32_t>(vcmpFunctions->SetWeaponDataValue(weaponId, fieldId, value));
});
functions.def("get_weapon_data_value", [](int32_t weaponId, int32_t fieldId) {
return vcmpFunctions->GetWeaponDataValue(weaponId, fieldId);
});
functions.def("reset_weapon_data_value", [](int32_t weaponId, int32_t fieldId) {
return static_cast<int32_t>(vcmpFunctions->ResetWeaponDataValue(weaponId, fieldId));
});
functions.def("is_weapon_data_value_modified", [](int32_t weaponId, int32_t fieldId) {
return py::bool_(vcmpFunctions->IsWeaponDataValueModified(weaponId, fieldId) != 0);
});
functions.def("reset_weapon_data", [](int32_t weaponId) {
return static_cast<int32_t>(vcmpFunctions->ResetWeaponData(weaponId));
});
functions.def("reset_all_weapon_data", []() {
vcmpFunctions->ResetAllWeaponData();
});
/*
* Key binds
*/
functions.def("get_key_bind_unused_slot", []() {
return vcmpFunctions->GetKeyBindUnusedSlot();
});
functions.def("get_key_bind_data", [](int32_t bindId) -> py::object {
uint8_t isCalledOnReleaseOut;
int32_t keyOneOut, keyTwoOut, keyThreeOut;
if (vcmpFunctions->GetKeyBindData(bindId, &isCalledOnReleaseOut, &keyOneOut, &keyTwoOut, &keyThreeOut) == vcmpErrorNone)
return py::make_tuple(py::bool_(isCalledOnReleaseOut != 0), keyOneOut, keyTwoOut, keyThreeOut);
return py::none();
});
functions.def("register_key_bind", [](int32_t bindId, bool isCalledOnRelease, int32_t keyOne, int32_t keyTwo, int32_t keyThree) {
return static_cast<int32_t>(vcmpFunctions->RegisterKeyBind(bindId, isCalledOnRelease, keyOne, keyTwo, keyThree));
});
functions.def("remove_key_bind", [](int32_t bindId) {
return static_cast<int32_t>(vcmpFunctions->RemoveKeyBind(bindId));
});
functions.def("remove_all_key_binds", []() {
vcmpFunctions->RemoveAllKeyBinds();
});
/*
* Coordinate blips
*/
functions.def("create_coord_blip", [](int32_t index, int32_t world, float x, float y, float z, int32_t scale, uint32_t colour, int32_t sprite) {
return vcmpFunctions->CreateCoordBlip(index, world, x, y, z, scale, colour, sprite);
});
functions.def("destroy_coord_blip", [](int32_t index) {
return static_cast<int32_t>(vcmpFunctions->DestroyCoordBlip(index));
});
functions.def("get_coord_blip_info", [](int32_t index) -> py::object {
int32_t worldOut, scaleOut, spriteOut;
float xOut, yOut, zOut;
uint32_t colourOut;
if (vcmpFunctions->GetCoordBlipInfo(index, &worldOut, &xOut, &yOut, &zOut, &scaleOut, &colourOut, &spriteOut) == vcmpErrorNone)
return py::make_tuple(worldOut, xOut, yOut, zOut, scaleOut, colourOut, spriteOut);
return py::none();
});
/*
* Radios
*/
functions.def("add_radio_stream", [](int32_t radioId, const char* radioName, const char* radioUrl, bool isListed) {
return static_cast<int32_t>(vcmpFunctions->AddRadioStream(radioId, radioName, radioUrl, isListed));
});
functions.def("remove_radio_stream", [](int32_t radioId) {
return static_cast<int32_t>(vcmpFunctions->RemoveRadioStream(radioId));
});
/*
* Spawning and classes
*/
functions.def("add_player_class", [](int32_t teamId, uint32_t colour, int32_t modelIndex, float x, float y, float z, float angle, int32_t weaponOne, int32_t weaponOneAmmo, int32_t weaponTwo, int32_t weaponTwoAmmo, int32_t weaponThree, int32_t weaponThreeAmmo) {
return vcmpFunctions->AddPlayerClass(teamId, colour, modelIndex, x, y, z, angle, weaponOne, weaponOneAmmo, weaponTwo, weaponTwoAmmo, weaponThree, weaponThreeAmmo);
});
functions.def("set_spawn_player_position", [](float x, float y, float z) {
vcmpFunctions->SetSpawnPlayerPosition(x, y, z);
});
functions.def("set_spawn_camera_position", [](float x, float y, float z) {
vcmpFunctions->SetSpawnCameraPosition(x, y, z);
});
functions.def("set_spawn_camera_look_at", [](float x, float y, float z) {
vcmpFunctions->SetSpawnCameraLookAt(x, y, z);
});
/*
* Administration
*/
functions.def("is_player_admin", [](int32_t playerId) {
return py::bool_(vcmpFunctions->IsPlayerAdmin(playerId) != 0);
});
functions.def("set_player_admin", [](int32_t playerId, bool toggle) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerAdmin(playerId, toggle));
});
functions.def("get_player_ip", [](int32_t playerId) -> py::object {
char buffer[64];
if (vcmpFunctions->GetPlayerIP(playerId, buffer, sizeof(buffer)) == vcmpErrorNone)
return py::str(buffer);
return py::none();
});
functions.def("get_player_uid", [](int32_t playerId) -> py::object {
char buffer[64];
if (vcmpFunctions->GetPlayerUID(playerId, buffer, sizeof(buffer)) == vcmpErrorNone)
return py::str(buffer);
return py::none();
});
functions.def("get_player_uid2", [](int32_t playerId) -> py::object {
char buffer[64];
if (vcmpFunctions->GetPlayerUID2(playerId, buffer, sizeof(buffer)) == vcmpErrorNone)
return py::str(buffer);
return py::none();
});
functions.def("kick_player", [](int32_t playerId) {
return static_cast<int32_t>(vcmpFunctions->KickPlayer(playerId));
});
functions.def("ban_player", [](int32_t playerId) {
return static_cast<int32_t>(vcmpFunctions->BanPlayer(playerId));
});
functions.def("ban_ip", [](char* ipAddress) {
vcmpFunctions->BanIP(ipAddress);
});
functions.def("unban_ip", [](char* ipAddress) {
return py::bool_(vcmpFunctions->UnbanIP(ipAddress) != 0);
});
functions.def("is_ip_banned", [](char* ipAddress) {
return py::bool_(vcmpFunctions->IsIPBanned(ipAddress) != 0);
});
/*
* Player access and basic info
*/
functions.def("get_player_id_from_name", [](const char* name) {
return vcmpFunctions->GetPlayerIdFromName(name);
});
functions.def("is_player_connected", [](int32_t playerId) {
return py::bool_(vcmpFunctions->IsPlayerConnected(playerId) != 0);
});
functions.def("is_player_streamed_for_player", [](int32_t checkedPlayerId, int32_t playerId) {
return py::bool_(vcmpFunctions->IsPlayerStreamedForPlayer(checkedPlayerId, playerId) != 0);
});
functions.def("get_player_key", [](int32_t playerId) {
return vcmpFunctions->GetPlayerKey(playerId);
});
functions.def("get_player_name", [](int32_t playerId) -> py::object {
char buffer[64];
if (vcmpFunctions->GetPlayerName(playerId, buffer, sizeof(buffer)) == vcmpErrorNone)
return py::str(buffer);
return py::none();
});
functions.def("set_player_name", [](int32_t playerId, const char* name) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerName(playerId, name));
});
functions.def("get_player_state", [](int32_t playerId) {
return static_cast<int32_t>(vcmpFunctions->GetPlayerState(playerId));
});
functions.def("set_player_option", [](int32_t playerId, int32_t option, bool toggle) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerOption(playerId, static_cast<vcmpPlayerOption>(option), toggle));
});
functions.def("get_player_option", [](int32_t playerId, int32_t option) {
return py::bool_(vcmpFunctions->GetPlayerOption(playerId, static_cast<vcmpPlayerOption>(option)) != 0);
});
/*
* Player world
*/
functions.def("set_player_world", [](int32_t playerId, int32_t world) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerWorld(playerId, world));
});
functions.def("get_player_world", [](int32_t playerId) {
return vcmpFunctions->GetPlayerWorld(playerId);
});
functions.def("set_player_secondary_world", [](int32_t playerId, int32_t secondaryWorld) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerSecondaryWorld(playerId, secondaryWorld));
});
functions.def("get_player_secondary_world", [](int32_t playerId) {
return vcmpFunctions->GetPlayerSecondaryWorld(playerId);
});
functions.def("get_player_unique_world", [](int32_t playerId) {
return vcmpFunctions->GetPlayerUniqueWorld(playerId);
});
functions.def("is_player_world_compatible", [](int32_t playerId, int32_t world) {
return py::bool_(vcmpFunctions->IsPlayerWorldCompatible(playerId, world) != 0);
});
/*
* Player class, team, skin, colour
*/
functions.def("get_player_class", [](int32_t playerId) {
return vcmpFunctions->GetPlayerClass(playerId);
});
functions.def("set_player_team", [](int32_t playerId, int32_t teamId) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerTeam(playerId, teamId));
});
functions.def("get_player_team", [](int32_t playerId) {
return vcmpFunctions->GetPlayerTeam(playerId);
});
functions.def("set_player_skin", [](int32_t playerId, int32_t skinId) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerSkin(playerId, skinId));
});
functions.def("get_player_skin", [](int32_t playerId) {
return vcmpFunctions->GetPlayerSkin(playerId);
});
functions.def("set_player_colour", [](int32_t playerId, uint32_t colour) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerColour(playerId, colour));
});
functions.def("get_player_colour", [](int32_t playerId) {
return vcmpFunctions->GetPlayerColour(playerId);
});
/*
* Player spawn cycle
*/
functions.def("is_player_spawned", [](int32_t playerId) {
return py::bool_(vcmpFunctions->IsPlayerSpawned(playerId) != 0);
});
functions.def("force_player_spawn", [](int32_t playerId) {
return static_cast<int32_t>(vcmpFunctions->ForcePlayerSpawn(playerId));
});
functions.def("force_player_select", [](int32_t playerId) {
return static_cast<int32_t>(vcmpFunctions->ForcePlayerSelect(playerId));
});
functions.def("force_all_select", []() {
vcmpFunctions->ForceAllSelect();
});
functions.def("is_player_typing", [](int32_t playerId) {
return py::bool_(vcmpFunctions->IsPlayerTyping(playerId) != 0);
});
/*
* Player money, score, wanted level
*/
functions.def("give_player_money", [](int32_t playerId, int32_t amount) {
return static_cast<int32_t>(vcmpFunctions->GivePlayerMoney(playerId, amount));
});
functions.def("set_player_money", [](int32_t playerId, int32_t amount) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerMoney(playerId, amount));
});
functions.def("get_player_money", [](int32_t playerId) {
return vcmpFunctions->GetPlayerMoney(playerId);
});
functions.def("set_player_score", [](int32_t playerId, int32_t score) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerScore(playerId, score));
});
functions.def("get_player_score", [](int32_t playerId) {
return vcmpFunctions->GetPlayerScore(playerId);
});
functions.def("set_player_wanted_level", [](int32_t playerId, int32_t level) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerWantedLevel(playerId, level));
});
functions.def("get_player_wanted_level", [](int32_t playerId) {
return vcmpFunctions->GetPlayerWantedLevel(playerId);
});
functions.def("get_player_ping", [](int32_t playerId) {
return vcmpFunctions->GetPlayerPing(playerId);
});
functions.def("get_player_fps", [](int32_t playerId) {
return vcmpFunctions->GetPlayerFPS(playerId);
});
/*
* Player health and immunity
*/
functions.def("set_player_health", [](int32_t playerId, float health) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerHealth(playerId, health));
});
functions.def("get_player_health", [](int32_t playerId) {
return vcmpFunctions->GetPlayerHealth(playerId);
});
functions.def("set_player_armour", [](int32_t playerId, float armour) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerArmour(playerId, armour));
});
functions.def("get_player_armour", [](int32_t playerId) {
return vcmpFunctions->GetPlayerArmour(playerId);
});
functions.def("set_player_immunity_flags", [](int32_t playerId, uint32_t flags) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerImmunityFlags(playerId, flags));
});
functions.def("get_player_immunity_flags", [](int32_t playerId) {
return vcmpFunctions->GetPlayerImmunityFlags(playerId);
});
/*
* Player position and rotation
*/
functions.def("set_player_position", [](int32_t playerId, float x, float y, float z) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerPosition(playerId, x, y, z));
});
functions.def("get_player_position", [](int32_t playerId) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetPlayerPosition(playerId, &xOut, &yOut, &zOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
functions.def("set_player_speed", [](int32_t playerId, float x, float y, float z) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerSpeed(playerId, x, y, z));
});
functions.def("get_player_speed", [](int32_t playerId) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetPlayerSpeed(playerId, &xOut, &yOut, &zOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
functions.def("add_player_speed", [](int32_t playerId, float x, float y, float z) {
return static_cast<int32_t>(vcmpFunctions->AddPlayerSpeed(playerId, x, y, z));
});
functions.def("set_player_heading", [](int32_t playerId, float angle) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerHeading(playerId, angle));
});
functions.def("get_player_heading", [](int32_t playerId) {
return vcmpFunctions->GetPlayerHeading(playerId);
});
functions.def("set_player_alpha", [](int32_t playerId, int32_t alpha, uint32_t fadeTime) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerAlpha(playerId, alpha, fadeTime));
});
functions.def("get_player_alpha", [](int32_t playerId) {
return vcmpFunctions->GetPlayerAlpha(playerId);
});
functions.def("get_player_aim_position", [](int32_t playerId) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetPlayerAimPosition(playerId, &xOut, &yOut, &zOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
functions.def("get_player_aim_direction", [](int32_t playerId) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetPlayerAimDirection(playerId, &xOut, &yOut, &zOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
/*
* Player actions and keys
*/
functions.def("is_player_on_fire", [](int32_t playerId) {
return py::bool_(vcmpFunctions->IsPlayerOnFire(playerId) != 0);
});
functions.def("is_player_crouching", [](int32_t playerId) {
return py::bool_(vcmpFunctions->IsPlayerCrouching(playerId) != 0);
});
functions.def("get_player_action", [](int32_t playerId) {
return vcmpFunctions->GetPlayerAction(playerId);
});
functions.def("get_player_game_keys", [](int32_t playerId) {
return vcmpFunctions->GetPlayerGameKeys(playerId);
});
/*
* Player vehicle
*/
functions.def("put_player_in_vehicle", [](int32_t playerId, int32_t vehicleId, int32_t slotIndex, bool makeRoom, bool warp) {
return static_cast<int32_t>(vcmpFunctions->PutPlayerInVehicle(playerId, vehicleId, slotIndex, makeRoom, warp));
});
functions.def("remove_player_from_vehicle", [](int32_t playerId) {
return static_cast<int32_t>(vcmpFunctions->RemovePlayerFromVehicle(playerId));
});
functions.def("get_player_in_vehicle_status", [](int32_t playerId) {
return static_cast<int32_t>(vcmpFunctions->GetPlayerInVehicleStatus(playerId));
});
functions.def("get_player_in_vehicle_slot", [](int32_t playerId) {
return vcmpFunctions->GetPlayerInVehicleSlot(playerId);
});
functions.def("get_player_vehicle_id", [](int32_t playerId) {
return vcmpFunctions->GetPlayerVehicleId(playerId);
});
/*
* Player weapons
*/
functions.def("give_player_weapon", [](int32_t playerId, int32_t weaponId, int32_t ammo) {
return static_cast<int32_t>(vcmpFunctions->GivePlayerWeapon(playerId, weaponId, ammo));
});
functions.def("set_player_weapon", [](int32_t playerId, int32_t weaponId, int32_t ammo) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerWeapon(playerId, weaponId, ammo));
});
functions.def("get_player_weapon", [](int32_t playerId) {
return vcmpFunctions->GetPlayerWeapon(playerId);
});
functions.def("get_player_weapon_ammo", [](int32_t playerId) {
return vcmpFunctions->GetPlayerWeaponAmmo(playerId);
});
functions.def("set_player_weapon_slot", [](int32_t playerId, int32_t slot) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerWeaponSlot(playerId, slot));
});
functions.def("get_player_weapon_slot", [](int32_t playerId) {
return vcmpFunctions->GetPlayerWeaponSlot(playerId);
});
functions.def("get_player_weapon_at_slot", [](int32_t playerId, int32_t slot) {
return vcmpFunctions->GetPlayerWeaponAtSlot(playerId, slot);
});
functions.def("get_player_ammo_at_slot", [](int32_t playerId, int32_t slot) {
return vcmpFunctions->GetPlayerAmmoAtSlot(playerId, slot);
});
functions.def("remove_player_weapon", [](int32_t playerId, int32_t weaponId) {
return static_cast<int32_t>(vcmpFunctions->RemovePlayerWeapon(playerId, weaponId));
});
functions.def("remove_all_weapons", [](int32_t playerId) {
return static_cast<int32_t>(vcmpFunctions->RemoveAllWeapons(playerId));
});
/*
* Player camera
*/
functions.def("set_camera_position", [](int32_t playerId, float posX, float posY, float posZ, float lookX, float lookY, float lookZ) {
return static_cast<int32_t>(vcmpFunctions->SetCameraPosition(playerId, posX, posY, posZ, lookX, lookY, lookZ));
});
functions.def("restore_camera", [](int32_t playerId) {
return static_cast<int32_t>(vcmpFunctions->RestoreCamera(playerId));
});
functions.def("is_camera_locked", [](int32_t playerId) {
return py::bool_(vcmpFunctions->IsCameraLocked(playerId) != 0);
});
/*
* Player miscellaneous stuff
*/
functions.def("set_player_animation", [](int32_t playerId, int32_t groupId, int32_t animationId) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerAnimation(playerId, groupId, animationId));
});
functions.def("get_player_standing_on_vehicle", [](int32_t playerId) {
return vcmpFunctions->GetPlayerStandingOnVehicle(playerId);
});
functions.def("get_player_standing_on_object", [](int32_t playerId) {
return vcmpFunctions->GetPlayerStandingOnObject(playerId);
});
functions.def("is_player_away", [](int32_t playerId) {
return py::bool_(vcmpFunctions->IsPlayerAway(playerId) != 0);
});
functions.def("get_player_spectate_target", [](int32_t playerId) {
return vcmpFunctions->GetPlayerSpectateTarget(playerId);
});
functions.def("set_player_spectate_target", [](int32_t playerId, int32_t targetId) {
return static_cast<int32_t>(vcmpFunctions->SetPlayerSpectateTarget(playerId, targetId));
});
functions.def("redirect_player_to_server", [](int32_t playerId, const char* ip, uint32_t port, const char* nick, const char* serverPassword, const char* userPassword) {
return static_cast<int32_t>(vcmpFunctions->RedirectPlayerToServer(playerId, ip, port, nick, serverPassword, userPassword));
});
/*
* All entities
*/
functions.def("check_entity_exists", [](int32_t entityPool, int32_t index) {
return py::bool_(vcmpFunctions->CheckEntityExists(static_cast<vcmpEntityPool>(entityPool), index) != 0);
});
/*
* Vehicles
*/
functions.def("create_vehicle", [](int32_t modelIndex, int32_t world, float x, float y, float z, float angle, int32_t primaryColour, int32_t secondaryColour) {
return vcmpFunctions->CreateVehicle(modelIndex, world, x, y, z, angle, primaryColour, secondaryColour);
});
functions.def("delete_vehicle", [](int32_t vehicleId) {
return static_cast<int32_t>(vcmpFunctions->DeleteVehicle(vehicleId));
});
functions.def("set_vehicle_option", [](int32_t vehicleId, int32_t option, bool toggle) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleOption(vehicleId, static_cast<vcmpVehicleOption>(option), toggle));
});
functions.def("get_vehicle_option", [](int32_t vehicleId, int32_t option) {
return py::bool_(vcmpFunctions->GetVehicleOption(vehicleId, static_cast<vcmpVehicleOption>(option)) != 0);
});
functions.def("get_vehicle_sync_source", [](int32_t vehicleId) {
return vcmpFunctions->GetVehicleSyncSource(vehicleId);
});
functions.def("get_vehicle_sync_type", [](int32_t vehicleId) {
return static_cast<int32_t>(vcmpFunctions->GetVehicleSyncType(vehicleId));
});
functions.def("is_vehicle_streamed_for_player", [](int32_t vehicleId, int32_t playerId) {
return py::bool_(vcmpFunctions->IsVehicleStreamedForPlayer(vehicleId, playerId) != 0);
});
functions.def("set_vehicle_world", [](int32_t vehicleId, int32_t world) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleWorld(vehicleId, world));
});
functions.def("get_vehicle_world", [](int32_t vehicleId) {
return vcmpFunctions->GetVehicleWorld(vehicleId);
});
functions.def("get_vehicle_model", [](int32_t vehicleId) {
return vcmpFunctions->GetVehicleModel(vehicleId);
});
functions.def("get_vehicle_occupant", [](int32_t vehicleId, int32_t slotIndex) {
return vcmpFunctions->GetVehicleOccupant(vehicleId, slotIndex);
});
functions.def("respawn_vehicle", [](int32_t vehicleId) {
return static_cast<int32_t>(vcmpFunctions->RespawnVehicle(vehicleId));
});
functions.def("set_vehicle_immunity_flags", [](int32_t vehicleId, uint32_t immunityFlags) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleImmunityFlags(vehicleId, immunityFlags));
});
functions.def("get_vehicle_immunity_flags", [](int32_t vehicleId) {
return vcmpFunctions->GetVehicleImmunityFlags(vehicleId);
});
functions.def("explode_vehicle", [](int32_t vehicleId) {
return static_cast<int32_t>(vcmpFunctions->ExplodeVehicle(vehicleId));
});
functions.def("is_vehicle_wrecked", [](int32_t vehicleId) {
return py::bool_(vcmpFunctions->IsVehicleWrecked(vehicleId) != 0);
});
functions.def("set_vehicle_position", [](int32_t vehicleId, float x, float y, float z, bool removeOccupants) {
return static_cast<int32_t>(vcmpFunctions->SetVehiclePosition(vehicleId, x, y, z, removeOccupants));
});
functions.def("get_vehicle_position", [](int32_t vehicleId) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetVehiclePosition(vehicleId, &xOut, &yOut, &zOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
functions.def("set_vehicle_rotation", [](int32_t vehicleId, float x, float y, float z, float w) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleRotation(vehicleId, x, y, z, w));
});
functions.def("set_vehicle_rotation_euler", [](int32_t vehicleId, float x, float y, float z) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleRotationEuler(vehicleId, x, y, z));
});
functions.def("get_vehicle_rotation", [](int32_t vehicleId) -> py::object {
float xOut, yOut, zOut, wOut;
if (vcmpFunctions->GetVehicleRotation(vehicleId, &xOut, &yOut, &zOut, &wOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut, wOut);
return py::none();
});
functions.def("get_vehicle_rotation_euler", [](int32_t vehicleId) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetVehicleRotationEuler(vehicleId, &xOut, &yOut, &zOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
functions.def("set_vehicle_speed", [](int32_t vehicleId, float x, float y, float z, bool add, bool relative) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleSpeed(vehicleId, x, y, z, add, relative));
});
functions.def("get_vehicle_speed", [](int32_t vehicleId, bool relative) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetVehicleSpeed(vehicleId, &xOut, &yOut, &zOut, relative) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
functions.def("set_vehicle_turn_speed", [](int32_t vehicleId, float x, float y, float z, bool add, bool relative) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleTurnSpeed(vehicleId, x, y, z, add, relative));
});
functions.def("get_vehicle_turn_speed", [](int32_t vehicleId, bool relative) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetVehicleTurnSpeed(vehicleId, &xOut, &yOut, &zOut, relative) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
functions.def("set_vehicle_spawn_position", [](int32_t vehicleId, float x, float y, float z) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleSpawnPosition(vehicleId, x, y, z));
});
functions.def("get_vehicle_spawn_position", [](int32_t vehicleId) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetVehicleSpawnPosition(vehicleId, &xOut, &yOut, &zOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
functions.def("set_vehicle_spawn_rotation", [](int32_t vehicleId, float x, float y, float z, float w) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleSpawnRotation(vehicleId, x, y, z, w));
});
functions.def("set_vehicle_spawn_rotation_euler", [](int32_t vehicleId, float x, float y, float z) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleSpawnRotationEuler(vehicleId, x, y, z));
});
functions.def("get_vehicle_spawn_rotation", [](int32_t vehicleId) -> py::object {
float xOut, yOut, zOut, wOut;
if (vcmpFunctions->GetVehicleSpawnRotation(vehicleId, &xOut, &yOut, &zOut, &wOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut, wOut);
return py::none();
});
functions.def("get_vehicle_spawn_rotation_euler", [](int32_t vehicleId) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetVehicleSpawnRotationEuler(vehicleId, &xOut, &yOut, &zOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
functions.def("set_vehicle_idle_respawn_timer", [](int32_t vehicleId, uint32_t millis) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleIdleRespawnTimer(vehicleId, millis));
});
functions.def("get_vehicle_idle_respawn_timer", [](int32_t vehicleId) {
return vcmpFunctions->GetVehicleIdleRespawnTimer(vehicleId);
});
functions.def("set_vehicle_health", [](int32_t vehicleId, float health) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleHealth(vehicleId, health));
});
functions.def("get_vehicle_health", [](int32_t vehicleId) {
return vcmpFunctions->GetVehicleHealth(vehicleId);
});
functions.def("set_vehicle_colour", [](int32_t vehicleId, int32_t primaryColour, int32_t secondaryColour) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleColour(vehicleId, primaryColour, secondaryColour));
});
functions.def("get_vehicle_colour", [](int32_t vehicleId) -> py::object {
int32_t primaryColourOut, secondaryColourOut;
if (vcmpFunctions->GetVehicleColour(vehicleId, &primaryColourOut, &secondaryColourOut) == vcmpErrorNone)
return py::make_tuple(primaryColourOut, secondaryColourOut);
return py::none();
});
functions.def("set_vehicle_part_status", [](int32_t vehicleId, int32_t partId, int32_t status) {
return static_cast<int32_t>(vcmpFunctions->SetVehiclePartStatus(vehicleId, partId, status));
});
functions.def("get_vehicle_part_status", [](int32_t vehicleId, int32_t partId) {
return vcmpFunctions->GetVehiclePartStatus(vehicleId, partId);
});
functions.def("set_vehicle_tyre_status", [](int32_t vehicleId, int32_t tyreId, int32_t status) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleTyreStatus(vehicleId, tyreId, status));
});
functions.def("get_vehicle_tyre_status", [](int32_t vehicleId, int32_t tyreId) {
return vcmpFunctions->GetVehicleTyreStatus(vehicleId, tyreId);
});
functions.def("set_vehicle_damage_data", [](int32_t vehicleId, uint32_t damageData) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleDamageData(vehicleId, damageData));
});
functions.def("get_vehicle_damage_data", [](int32_t vehicleId) {
return vcmpFunctions->GetVehicleDamageData(vehicleId);
});
functions.def("set_vehicle_radio", [](int32_t vehicleId, int32_t radioId) {
return static_cast<int32_t>(vcmpFunctions->SetVehicleRadio(vehicleId, radioId));
});
functions.def("get_vehicle_radio", [](int32_t vehicleId) {
return vcmpFunctions->GetVehicleRadio(vehicleId);
});
functions.def("get_vehicle_turret_rotation", [](int32_t vehicleId) -> py::object {
float horizontalOut, verticalOut;
if (vcmpFunctions->GetVehicleTurretRotation(vehicleId, &horizontalOut, &verticalOut) == vcmpErrorNone)
return py::make_tuple(horizontalOut, verticalOut);
return py::none();
});
/*
* Vehicle handling
*/
functions.def("reset_all_vehicle_handlings", []() {
vcmpFunctions->ResetAllVehicleHandlings();
});
functions.def("exists_handling_rule", [](int32_t modelIndex, int32_t ruleIndex) {
return py::bool_(vcmpFunctions->ExistsHandlingRule(modelIndex, ruleIndex) != 0);
});
functions.def("set_handling_rule", [](int32_t modelIndex, int32_t ruleIndex, double value) {
return static_cast<int32_t>(vcmpFunctions->SetHandlingRule(modelIndex, ruleIndex, value));
});
functions.def("get_handling_rule", [](int32_t modelIndex, int32_t ruleIndex) {
return vcmpFunctions->GetHandlingRule(modelIndex, ruleIndex);
});
functions.def("reset_handling_rule", [](int32_t modelIndex, int32_t ruleIndex) {
return static_cast<int32_t>(vcmpFunctions->ResetHandlingRule(modelIndex, ruleIndex));
});
functions.def("reset_handling", [](int32_t modelIndex) {
return static_cast<int32_t>(vcmpFunctions->ResetHandling(modelIndex));
});
functions.def("exists_inst_handling_rule", [](int32_t vehicleId, int32_t ruleIndex) {
return py::bool_(vcmpFunctions->ExistsInstHandlingRule(vehicleId, ruleIndex) != 0);
});
functions.def("set_inst_handling_rule", [](int32_t vehicleId, int32_t ruleIndex, double value) {
return static_cast<int32_t>(vcmpFunctions->SetInstHandlingRule(vehicleId, ruleIndex, value));
});
functions.def("get_inst_handling_rule", [](int32_t vehicleId, int32_t ruleIndex) {
return vcmpFunctions->GetInstHandlingRule(vehicleId, ruleIndex);
});
functions.def("reset_inst_handling_rule", [](int32_t vehicleId, int32_t ruleIndex) {
return static_cast<int32_t>(vcmpFunctions->ResetInstHandlingRule(vehicleId, ruleIndex));
});
functions.def("reset_inst_handling", [](int32_t vehicleId) {
return static_cast<int32_t>(vcmpFunctions->ResetInstHandling(vehicleId));
});
/*
* Pickups
*/
functions.def("create_pickup", [](int32_t modelIndex, int32_t world, int32_t quantity, float x, float y, float z, int32_t alpha, bool isAutomatic) {
return vcmpFunctions->CreatePickup(modelIndex, world, quantity, x, y, z, alpha, isAutomatic);
});
functions.def("delete_pickup", [](int32_t pickupId) {
return static_cast<int32_t>(vcmpFunctions->DeletePickup(pickupId));
});
functions.def("is_pickup_streamed_for_player", [](int32_t pickupId, int32_t playerId) {
return py::bool_(vcmpFunctions->IsPickupStreamedForPlayer(pickupId, playerId) != 0);
});
functions.def("set_pickup_world", [](int32_t pickupId, int32_t world) {
return static_cast<int32_t>(vcmpFunctions->SetPickupWorld(pickupId, world));
});
functions.def("get_pickup_world", [](int32_t pickupId) {
return vcmpFunctions->GetPickupWorld(pickupId);
});
functions.def("set_pickup_alpha", [](int32_t pickupId, int32_t alpha) {
return static_cast<int32_t>(vcmpFunctions->SetPickupAlpha(pickupId, alpha));
});
functions.def("get_pickup_alpha", [](int32_t pickupId) {
return vcmpFunctions->GetPickupAlpha(pickupId);
});
functions.def("set_pickup_is_automatic", [](int32_t pickupId, bool toggle) {
return static_cast<int32_t>(vcmpFunctions->SetPickupIsAutomatic(pickupId, toggle));
});
functions.def("is_pickup_automatic", [](int32_t pickupId) {
return py::bool_(vcmpFunctions->IsPickupAutomatic(pickupId) != 0);
});
functions.def("set_pickup_auto_timer", [](int32_t pickupId, uint32_t durationMillis) {
return static_cast<int32_t>(vcmpFunctions->SetPickupAutoTimer(pickupId, durationMillis));
});
functions.def("get_pickup_auto_timer", [](int32_t pickupId) {
return vcmpFunctions->GetPickupAutoTimer(pickupId);
});
functions.def("refresh_pickup", [](int32_t pickupId) {
return static_cast<int32_t>(vcmpFunctions->RefreshPickup(pickupId));
});
functions.def("set_pickup_position", [](int32_t pickupId, float x, float y, float z) {
return static_cast<int32_t>(vcmpFunctions->SetPickupPosition(pickupId, x, y, z));
});
functions.def("get_pickup_position", [](int32_t pickupId) -> py::object {
float xOut, yOut, zOut;
if (vcmpFunctions->GetPickupPosition(pickupId, &xOut, &yOut, &zOut) == vcmpErrorNone)
return py::make_tuple(xOut, yOut, zOut);
return py::none();
});
functions.def("get_pickup_model", [](int32_t pickupId) {
return vcmpFunctions->GetPickupModel(pickupId);
});
functions.def("get_pickup_quantity", [](int32_t pickupId) {
return vcmpFunctions->GetPickupQuantity(pickupId);
});
/*
* Checkpoints
*/
functions.def("create_check_point", [](int32_t playerId, int32_t world, bool isSphere, float x, float y, float z, int32_t red, int32_t green, int32_t blue, int32_t alpha, float radius) {
return vcmpFunctions->CreateCheckPoint(playerId, world, isSphere, x, y, z, red, green, blue, alpha, radius);
});