From 6e75816fae5d722c5e0cf0e7c3c47cd5a6739bf4 Mon Sep 17 00:00:00 2001 From: Kristian Date: Sat, 23 Nov 2019 11:40:32 +0100 Subject: [PATCH] Save/Load Update 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. --- addons/commands.gsc | 1 + codjumper/_cj_functions.gsc | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/commands.gsc b/addons/commands.gsc index 026af77..d52203a 100644 --- a/addons/commands.gsc +++ b/addons/commands.gsc @@ -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); } diff --git a/codjumper/_cj_functions.gsc b/codjumper/_cj_functions.gsc index 665a231..5adc28e 100644 --- a/codjumper/_cj_functions.gsc +++ b/codjumper/_cj_functions.gsc @@ -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; @@ -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); @@ -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