-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Sakhal to the DayZCommunityOffline Repository #394
Open
LoganHall195
wants to merge
7
commits into
Arkensor:production
Choose a base branch
from
LoganHall195:production
base: production
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a993d4e
Add files via upload
LoganHall195 ca64d1c
Add files via upload
LoganHall195 6b09aba
Add files via upload
LoganHall195 1021c44
Add files via upload
LoganHall195 9bf473b
sakhal
LoganHall195 d4d7e3f
Adding ChernarusPlus files
LoganHall195 09f757d
g_Game.GetMousePos() replaced with GetMousePos()
LoganHall195 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add files via upload
commit ca64d1c2cec485aef624590bfaa2856a969d01e1
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
Missions/DayZCommunityOfflineMode.sakhal/core/BaseModuleInclude.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "$CurrentDir:missions\\DayZCommunityOfflineMode.ChernarusPlus\\core\\ModuleManager.c" | ||
#include "$CurrentDir:missions\\DayZCommunityOfflineMode.ChernarusPlus\\core\\StaticFunctions.c" | ||
|
||
#include "$CurrentDir:missions\\DayZCommunityOfflineMode.ChernarusPlus\\core\\CommunityOfflineClient.c" | ||
#include "$CurrentDir:missions\\DayZCommunityOfflineMode.ChernarusPlus\\core\\CommunityOfflineServer.c" |
136 changes: 136 additions & 0 deletions
136
Missions/DayZCommunityOfflineMode.sakhal/core/CommunityOfflineClient.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
class CommunityOfflineClient extends MissionGameplay | ||
{ | ||
protected bool HIVE_ENABLED = true; //Local Hive / Economy / Infected spawn | ||
|
||
protected bool m_loaded; | ||
|
||
void CommunityOfflineClient() | ||
{ | ||
m_loaded = false; | ||
|
||
NewModuleManager(); | ||
} | ||
|
||
override void OnInit() | ||
{ | ||
super.OnInit(); | ||
|
||
InitHive(); | ||
|
||
SetupWeather(); | ||
|
||
SpawnPlayer(); | ||
|
||
GetDayZGame().SetMissionPath( "$saves:CommunityOfflineMode\\" ); // CameraToolsMenu | ||
} | ||
|
||
override void OnMissionStart() | ||
{ | ||
super.OnMissionStart(); | ||
|
||
COM_GetModuleManager().OnInit(); | ||
COM_GetModuleManager().OnMissionStart(); | ||
} | ||
|
||
override void OnMissionFinish() | ||
{ | ||
COM_GetModuleManager().OnMissionFinish(); | ||
|
||
CloseAllMenus(); | ||
|
||
DestroyAllMenus(); | ||
|
||
if( GetHive() ) | ||
{ | ||
DestroyHive(); | ||
} | ||
|
||
super.OnMissionFinish(); | ||
} | ||
|
||
void OnMissionLoaded() | ||
{ | ||
COM_GetModuleManager().OnMissionLoaded(); | ||
} | ||
|
||
override void OnUpdate( float timeslice ) | ||
{ | ||
super.OnUpdate( timeslice ); | ||
|
||
COM_GetModuleManager().OnUpdate( timeslice ); | ||
|
||
if( !m_loaded && !GetDayZGame().IsLoading() ) | ||
{ | ||
m_loaded = true; | ||
OnMissionLoaded(); | ||
} | ||
} | ||
|
||
void SpawnPlayer() | ||
{ | ||
// #ifndef MODULE_PERSISTENCY | ||
// GetGame().SelectPlayer( NULL, COM_CreateCustomDefaultCharacter() ); | ||
// #endif | ||
|
||
// #ifdef DISABLE_PERSISTENCY | ||
GetGame().SelectPlayer( NULL, COM_CreateCustomDefaultCharacter() ); | ||
// #endif | ||
} | ||
|
||
void InitHive() | ||
{ | ||
if ( GetGame().IsClient() && GetGame().IsMultiplayer() ) return; | ||
|
||
// RD /s /q "storage_-1" > nul 2>&1 | ||
if ( !HIVE_ENABLED ) return; | ||
|
||
Hive oHive = GetHive(); | ||
|
||
if( !oHive ) | ||
{ | ||
oHive = CreateHive(); | ||
} | ||
|
||
if( oHive ) | ||
{ | ||
oHive.InitOffline(); | ||
} | ||
|
||
oHive.SetShardID("100"); | ||
oHive.SetEnviroment("stable"); | ||
} | ||
|
||
static void SetupWeather() | ||
{ | ||
Weather weather = g_Game.GetWeather(); | ||
|
||
weather.GetOvercast().SetLimits( 0.0 , 2.0 ); | ||
weather.GetRain().SetLimits( 0.0 , 2.0 ); | ||
weather.GetFog().SetLimits( 0.0 , 2.0 ); | ||
|
||
weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.0 ); | ||
weather.GetRain().SetForecastChangeLimits( 0.0, 0.0 ); | ||
weather.GetFog().SetForecastChangeLimits( 0.0, 0.0 ); | ||
|
||
weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 ); | ||
weather.GetRain().SetForecastTimeLimits( 600 , 600 ); | ||
weather.GetFog().SetForecastTimeLimits( 600 , 600 ); | ||
|
||
weather.GetOvercast().Set( 0.0, 0, 0 ); | ||
weather.GetRain().Set( 0.0, 0, 0 ); | ||
weather.GetFog().Set( 0.0, 0, 0 ); | ||
|
||
weather.SetWindMaximumSpeed( 50 ); | ||
weather.SetWindFunctionParams( 0, 0, 1 ); | ||
} | ||
|
||
override UIScriptedMenu CreateScriptedMenu(int id) | ||
{ | ||
if(id == EditorMenu.MENU_ID) | ||
{ | ||
return new EditorMenu(); | ||
} | ||
|
||
return super.CreateScriptedMenu(id); | ||
} | ||
} |
122 changes: 122 additions & 0 deletions
122
Missions/DayZCommunityOfflineMode.sakhal/core/CommunityOfflineServer.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
class CommunityOfflineServer : MissionServer | ||
{ | ||
protected bool m_loaded; | ||
|
||
void CommunityOfflineServer() | ||
{ | ||
Print( "CommunityOfflineServer::CommunityOfflineServer()" ); | ||
m_loaded = false; | ||
|
||
COM_GetModuleManager(); | ||
} | ||
|
||
void ~CommunityOfflineServer() | ||
{ | ||
Print( "CommunityOfflineServer::~CommunityOfflineServer()" ); | ||
} | ||
|
||
override void OnInit() | ||
{ | ||
super.OnInit(); | ||
|
||
SetupWeather(); | ||
|
||
COM_GetModuleManager().OnInit(); | ||
} | ||
|
||
override void OnMissionStart() | ||
{ | ||
super.OnMissionStart(); | ||
|
||
COM_GetModuleManager().OnMissionStart(); | ||
} | ||
|
||
override void OnMissionFinish() | ||
{ | ||
COM_GetModuleManager().OnMissionFinish(); | ||
|
||
super.OnMissionFinish(); | ||
} | ||
|
||
void OnMissionLoaded() | ||
{ | ||
COM_GetModuleManager().OnMissionLoaded(); | ||
} | ||
|
||
|
||
override void OnUpdate( float timeslice ) | ||
{ | ||
super.OnUpdate( timeslice ); | ||
|
||
COM_GetModuleManager().OnUpdate( timeslice ); | ||
|
||
if( !m_loaded && !GetDayZGame().IsLoading() ) | ||
{ | ||
m_loaded = true; | ||
OnMissionLoaded(); | ||
} | ||
} | ||
|
||
override void OnMouseButtonRelease( int button ) | ||
{ | ||
super.OnMouseButtonRelease( button ); | ||
|
||
//COM_GetModuleManager().OnMouseButtonRelease( button ); | ||
} | ||
|
||
override void OnMouseButtonPress( int button ) | ||
{ | ||
super.OnMouseButtonPress( button ); | ||
|
||
//COM_GetModuleManager().OnMouseButtonPress( button ); | ||
} | ||
|
||
override void OnKeyPress( int key ) | ||
{ | ||
super.OnKeyPress(key); | ||
|
||
//COM_GetModuleManager().OnKeyPress( key ); | ||
} | ||
|
||
override void OnKeyRelease( int key ) | ||
{ | ||
super.OnKeyRelease( key ); | ||
|
||
//COM_GetModuleManager().OnKeyRelease( key ); | ||
} | ||
|
||
static void SetupWeather() | ||
{ | ||
//Offical DayZ SA weather code | ||
Weather weather = g_Game.GetWeather(); | ||
|
||
weather.GetOvercast().SetLimits( 0.0 , 2.0 ); | ||
weather.GetRain().SetLimits( 0.0 , 2.0 ); | ||
weather.GetFog().SetLimits( 0.0 , 2.0 ); | ||
|
||
weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.0 ); | ||
weather.GetRain().SetForecastChangeLimits( 0.0, 0.0 ); | ||
weather.GetFog().SetForecastChangeLimits( 0.0, 0.0 ); | ||
|
||
weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 ); | ||
weather.GetRain().SetForecastTimeLimits( 600 , 600 ); | ||
weather.GetFog().SetForecastTimeLimits( 600 , 600 ); | ||
|
||
weather.GetOvercast().Set( 0.0, 0, 0 ); | ||
weather.GetRain().Set( 0.0, 0, 0 ); | ||
weather.GetFog().Set( 0.0, 0, 0 ); | ||
|
||
weather.SetWindMaximumSpeed( 50 ); | ||
weather.SetWindFunctionParams( 0, 0, 1 ); | ||
} | ||
|
||
override UIScriptedMenu CreateScriptedMenu(int id) | ||
{ | ||
if(id == EditorMenu.MENU_ID) | ||
{ | ||
return new EditorMenu(); | ||
} | ||
|
||
return super.CreateScriptedMenu(id); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
Missions/DayZCommunityOfflineMode.sakhal/core/KeyMouseBinding.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
class KeyMouseBinding | ||
{ | ||
protected typename m_Object; | ||
protected ref array< string > m_KeyBinds; | ||
|
||
protected string m_CallbackFunction; | ||
protected string m_UAInputName; | ||
protected string m_Description; | ||
|
||
protected bool m_CanBeUsedInMenu; | ||
|
||
protected int m_ActionType; | ||
|
||
void KeyMouseBinding( typename object, string callback, string description, bool menu = false ) | ||
{ | ||
m_Object = object; | ||
m_KeyBinds = new array< string >; | ||
|
||
m_CallbackFunction = callback; | ||
m_UAInputName = "UA" + object.ToString() + callback; | ||
|
||
m_Description = description; | ||
|
||
m_CanBeUsedInMenu = menu; | ||
|
||
m_ActionType = KeyMouseActionType.PRESS; | ||
} | ||
|
||
bool CanBeUsedInMenu() | ||
{ | ||
return m_CanBeUsedInMenu; | ||
} | ||
|
||
void AddBinding( string key, int action = 1) | ||
{ | ||
m_KeyBinds.Insert( key ); | ||
m_ActionType = action; | ||
} | ||
|
||
array< string > GetBindings() | ||
{ | ||
return m_KeyBinds; | ||
} | ||
|
||
void SetActionType( int type ) | ||
{ | ||
m_ActionType = type; | ||
} | ||
|
||
int GetActionType() | ||
{ | ||
return m_ActionType; | ||
} | ||
|
||
typename GetObject() | ||
{ | ||
return m_Object; | ||
} | ||
|
||
string GetCallBackFunction() | ||
{ | ||
return m_CallbackFunction; | ||
} | ||
|
||
string GetUAInputName() | ||
{ | ||
return m_UAInputName; | ||
} | ||
|
||
string GetDescription() | ||
{ | ||
return m_Description; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include ChernarusPlus files