No known key found for this signature in database
GPG Key ID: FD81DE6D75E20917
3 changed files with
3 additions and
3 deletions
-
README.md
-
server/src/games/run.rs
-
server/src/games/run/functions.rs
|
|
@ -65,7 +65,7 @@ fn setup(data) { // Required |
|
|
return data; |
|
|
return data; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// turn_end(data, player) -> [data, next_player] |
|
|
// turn_end(data, player) -> [data, next_player, has_finished] |
|
|
fn turn_end(data, player) { // Required |
|
|
fn turn_end(data, player) { // Required |
|
|
print("Turn for " + player + " ending"); |
|
|
print("Turn for " + player + " ending"); |
|
|
if data.fw { |
|
|
if data.fw { |
|
|
@ -73,7 +73,7 @@ fn turn_end(data, player) { // Required |
|
|
}else{ |
|
|
}else{ |
|
|
player.sub(1); |
|
|
player.sub(1); |
|
|
} |
|
|
} |
|
|
return [data, player]; |
|
|
return [data, player, false]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// turn_start(data, player) -> data |
|
|
// turn_start(data, player) -> data |
|
|
|
|
|
@ -139,6 +139,7 @@ impl RunningGame { |
|
|
let mut arr = self.functions.turn_end(data, self.current_player).unwrap(); |
|
|
let mut arr = self.functions.turn_end(data, self.current_player).unwrap(); |
|
|
self.save_data(&arr[0]).unwrap(); |
|
|
self.save_data(&arr[0]).unwrap(); |
|
|
self.current_player = arr.remove(1).cast(); |
|
|
self.current_player = arr.remove(1).cast(); |
|
|
|
|
|
let has_finished: bool = arr.remove(1).cast(); |
|
|
self.turn_start(); |
|
|
self.turn_start(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -54,7 +54,6 @@ impl Functions { |
|
|
pub fn turn_end(&self, d: Dynamic, p: Player) -> RhaiResult<rhai::Array> { |
|
|
pub fn turn_end(&self, d: Dynamic, p: Player) -> RhaiResult<rhai::Array> { |
|
|
self.engine |
|
|
self.engine |
|
|
.call_fn(&mut Scope::new(), &self.ast, "turn_end", (d, p)) |
|
|
.call_fn(&mut Scope::new(), &self.ast, "turn_end", (d, p)) |
|
|
// TODO Check if the game has ended (With variable in the scope)
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
pub fn on_click( |
|
|
pub fn on_click( |
|
|
|