Skip to content

Commit

Permalink
Save/Load Update
Browse files Browse the repository at this point in the history
Updated the functionality of save and load functions, this precedes the following update which will finalize the save/load updates.
Matching the master for conflict resolving before the next merge.
  • Loading branch information
kristiandz committed Nov 23, 2019
1 parent 89ec621 commit 6e75816
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions addons/commands.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Callback_ScriptCommand(command, arguments)

load_position(entity, save_num)
{
entity.cj["custom_load"] = 1;
entity codjumper\_cj_functions::loadPos(save_num);
}

Expand Down
7 changes: 6 additions & 1 deletion codjumper/_cj_functions.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

savePos(i)
{
self.cj["saves"]++; //Ignore i so we don't need to modify too much and just use a local variable here.
i=self.cj["saves"];

if( !self isOnGround() || self isOnLadder() || self isMantling() || !isAlive( self ) )
return;

Expand All @@ -18,7 +21,6 @@ savePos(i)
wait 0.05;
self.cj["save"]["org"+i] = self getOrigin();
self.cj["save"]["ang"+i] = self getPlayerAngles();
self.cj["saves"]++;
temp = self GetStat(2992);
self SetStat(2992, temp + 1);
self iPrintLn(self.cj["local"]["SAVED"], i);
Expand All @@ -27,6 +29,9 @@ savePos(i)

loadPos(i)
{
if (i==1) //if a save location isn't specified just load the last save position
i=self.cj["saves"];

if(!isDefined(self.cj["save"]["org" + i]))
self iPrintLn(self.cj["local"]["NOPOS"], i);
else
Expand Down

0 comments on commit 6e75816

Please sign in to comment.