Skip to content

Commit

Permalink
Merge pull request #9 from Moondarker/testing
Browse files Browse the repository at this point in the history
Free camera added to stock functions
  • Loading branch information
Moondarker committed Dec 12, 2018
2 parents efdd6ea + 6007b92 commit e1c5973
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ZomBerry/Addons/scripts/5_Mission/ZomBerry.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static string g_zbryVer = "0.4.1";
static string g_zbryVer = "0.4.2";

class ZomberryBase {
protected bool isAdmin = false;
Expand Down
31 changes: 31 additions & 0 deletions ZomBerry/Addons/scripts/5_Mission/ZomBerryStockFnc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class ZomberryStockFunctions {
ref ZomberryCmdAPI m_ZomberryCmdAPI;
autoptr TIntArray m_spectatingList = new TIntArray;

void ZomberryStockFunctions() {
m_ZomberryCmdAPI = GetZomberryCmdAPI();
Expand Down Expand Up @@ -32,6 +33,7 @@ class ZomberryStockFunctions {
});

m_ZomberryCmdAPI.AddCategory("OnServer", 0xFF909090);
m_ZomberryCmdAPI.AddCommand("FreeCam", "FreeCamAdm", this, "OnServer", false);
m_ZomberryCmdAPI.AddCommand("Time - Day", "TimeDay", this, "OnServer", false);
m_ZomberryCmdAPI.AddCommand("Time - Night", "TimeNight", this, "OnServer", false);
m_ZomberryCmdAPI.AddCommand("Set time", "SetTime", this, "OnServer", false, {
Expand Down Expand Up @@ -227,6 +229,35 @@ class ZomberryStockFunctions {
MessagePlayer(ZBGetPlayerById(adminId), "Target blood level was set to " + fValues[0]);
}

void FreeCamAdm( string funcName, int adminId, int targetId, vector cursor ) {
int listId = m_spectatingList.Find(adminId);
PlayerBase adminPly = ZBGetPlayerById(adminId);
PlayerIdentity adminIdent = adminPly.GetIdentity();
HumanInputController adminInput = adminPly.GetInputController();

if (listId != -1) {
adminInput.OverrideMovementSpeed(false, 0);
adminInput.OverrideRaise(false, false);
adminInput.OverrideAimChangeX(false, 0);
adminInput.OverrideAimChangeY(false, 0);

m_spectatingList.Remove(listId);

GetGame().SelectPlayer(adminIdent, adminPly);
MessagePlayer(ZBGetPlayerById(adminId), "Returned to player body");
} else {
adminInput.OverrideMovementSpeed(true, 0);
adminInput.OverrideRaise(true, false);
adminInput.OverrideAimChangeX(true, 0);
adminInput.OverrideAimChangeY(true, 0);

m_spectatingList.Insert(adminId);

GetGame().SelectSpectator(adminIdent, "DayZSpectator", (adminPly.GetPosition() + Vector(0,1.75,0)));
MessagePlayer(ZBGetPlayerById(adminId), "Entered FreeCam, use Q/E to change camera speed");
}
}

void SetTime( string funcName, int adminId, int targetId, vector cursor, autoptr TIntArray fValues ) {
int year, month, day, hour, minute;
GetGame().GetWorld().GetDate(year, month, day, hour, minute);
Expand Down

0 comments on commit e1c5973

Please sign in to comment.