From dbdadc5492bdae0107dd033184544e70435da2f7 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Fri, 24 Nov 2017 17:38:49 +0100 Subject: Working on disabling chars that shouldn't be used. --- www/handler/battlemap/load_state.yaws | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/www/handler/battlemap/load_state.yaws b/www/handler/battlemap/load_state.yaws index 5c37764..998e22c 100644 --- a/www/handler/battlemap/load_state.yaws +++ b/www/handler/battlemap/load_state.yaws @@ -25,7 +25,7 @@ generate_set_map (Battlemap) -> } ). -generate_add_char (Char, CharInstance) -> +generate_add_char (Char, CharInstance, BattlemapInstance, PlayerID) -> jiffy:encode ( { @@ -38,12 +38,21 @@ generate_add_char (Char, CharInstance) -> {<<"loc_y">>, CharInstance#character_instance.y}, {<<"team">>, CharInstance#character_instance.team}, {<<"mov_pts">>, Char#character.mov_pts}, - {<<"atk_rg">>, Char#character.atk_rg} + {<<"atk_rg">>, Char#character.atk_rg}, + { + <<"enabled">>, + battlemap_instance:can_play_char_instance + ( + BattlemapInstance, + Char#character.id, + PlayerID + ) + } ] } ). -generate_reply (Battlemap, _BattlemapInstance, Characters) -> +generate_reply (Battlemap, BattlemapInstance, Characters, PlayerID) -> jiffy:encode ( [ @@ -57,7 +66,13 @@ generate_reply (Battlemap, _BattlemapInstance, Characters) -> fun ({CharID, CharInstance}) -> [ <<"add_char">>, - generate_add_char(CharID, CharInstance) + generate_add_char + ( + CharID, + CharInstance, + BattlemapInstance, + PlayerID + ) ] end, Characters @@ -91,7 +106,13 @@ handle (Req) -> %%%% Calc %%%% Commit %%%% Reply - generate_reply(Battlemap, BattlemapInstance, Characters). + generate_reply + ( + Battlemap, + BattlemapInstance, + Characters, + Input#input.player_id + ). out(A) -> { -- cgit v1.2.3-70-g09d2