Init_SCFramework.SQF 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. Init_SCFramework.SQF
  3. SCFramework initialization script that handles which instances load what processes
  4. */
  5. diag_log format["(SCFramework) Loading Configuration options and functions."];
  6. #include "Config_SCFramework.SQF"; // Configuration file loaded for everyone
  7. Functions_SCFramework = call compile preProcessFileLineNumbers "SCFramework\Functions_SCFramework.SQF";
  8. if (!hasInterface && !isServer) then { // Dedicated headless client
  9. #include "HeadlessClient_SCFramework.SQF";
  10. };
  11. if (isServer) then { // Server only
  12. #include "Server_SCFramework.SQF";
  13. };
  14. if (hasInterface) then { // Player client only
  15. #include "Player_SCFramework.SQF";
  16. [] spawn {
  17. // Wait until player object is created
  18. waitUntil {!isNull player};
  19. // GetOutMan event handler - Used for retaining vehicle ownership when player is last to exit a now otherwise empty vehicle
  20. player addEventHandler ["GetOutMan", {
  21. _player = _this select 0;
  22. _vehicle = _this select 2;
  23. _isEmpty = false;
  24. if (count crew _Vehicle == 0 && alive _Vehicle) then {
  25. _isEmpty = true;
  26. };
  27. diag_log format["(SCFramework) GetOutMan EH Tripped. Vehicle %1 %2, isEmpty %3",_Vehicle,typeOf _Vehicle,_isEmpty];
  28. if (alive _vehicle && _isEmpty) then {
  29. SCFramework_RequestRetainVehOwnership = [SCFramework_ClientID,_Vehicle];
  30. publicVariableServer "SCFramework_RequestRetainVehOwnership";
  31. };
  32. }];
  33. // Send ping to server requesting our Client ID
  34. SCFramework_PlayerPingResponseServer = getPlayerUID player; // InitServer
  35. publicVariableServer "SCFramework_PlayerPingResponseServer";
  36. diag_log format["(SCFramework) Sending server request (UID %1) for my client ID.",(getPlayerUID player)];
  37. };
  38. };
  39. diag_log format["(SCFramework) Initialization script complete."];