-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#79 untested: implement the addon manager
- Loading branch information
Showing
6 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
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,23 @@ | ||
|
||
statemachine class RER_AddonManager { | ||
var master: CRandomEncounters; | ||
|
||
/** | ||
* the queue of states to process, once a state is processed it | ||
* is removed from the queue. It goes from last item in the queue | ||
* to the first. | ||
*/ | ||
var states_to_process: array<name>; | ||
|
||
/** | ||
* the queue of states that were already processed. The first states | ||
* to be processed are first in the queue. | ||
*/ | ||
var processed_states: array<name>; | ||
|
||
public function init(master: CRandomEncounters) { | ||
this.master = master; | ||
this.GotoState('Loading'); | ||
} | ||
} | ||
|
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,15 @@ | ||
|
||
state Addon in RER_AddonManager { | ||
event OnEnterState(previous_state_name: name) { | ||
super.OnEnterState(previous_state_name); | ||
NLOG("RER_AddonManager - state " + parent.GetCurrentStateName()); | ||
} | ||
|
||
public function getMaster(): CRandomEncounters { | ||
return parent.master; | ||
} | ||
|
||
public function finish() { | ||
parent.GotoState('Waiting'); | ||
} | ||
} |
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,16 @@ | ||
|
||
state Loading in RER_AddonManager { | ||
event OnEnterState(previous_state_name: name) { | ||
super.OnEnterState(previous_state_name); | ||
NLOG("RER_AddonManager - state Loading"); | ||
|
||
this.Loading_main(); | ||
} | ||
|
||
entry function Loading_main() { | ||
parent.states_to_process = theGame.GetDefinitionsManager() | ||
.GetItemsWithTag('RER_Addon'); | ||
|
||
parent.GotoState('Waiting'); | ||
} | ||
} |
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,28 @@ | ||
|
||
state Waiting in RER_AddonManager { | ||
event OnEnterState(previous_state_name: name) { | ||
super.OnEnterState(previous_state_name); | ||
NLOG("RER_AddonManager - state WAITING"); | ||
|
||
this.Waiting_main(previous_state_name); | ||
} | ||
|
||
entry function Waiting_main(previous_state_name: name) { | ||
if (previous_state_name != 'Loading') { | ||
parent.processed_states.PushBack(previous_state_name); | ||
} | ||
|
||
this.startProcessingLastState(); | ||
} | ||
|
||
function startProcessingLastState() { | ||
var last_state: name; | ||
|
||
if (parent.states_to_process.Size() <= 0) { | ||
return; | ||
} | ||
|
||
last_state = parent.states_to_process.PopBack(); | ||
parent.GotoState(last_state); | ||
} | ||
} |
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
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