-- this code will initalize the state machine for Ultimate IGF
-- 


function createNetworks()
	-- create the main network for the game
	sm_createNetwork("game");
	-- create nodes for this network
	sm_createNode("game", "gamescreen");
	sm_createNode("game", "main");
	sm_createNode("game", "store");
	sm_createNode("game", "save");
	sm_createNode("game", "load");
	sm_createNode("game", "dungeon");
	sm_createNode("game", "schedule");
	sm_createNode("game", "options");
	sm_createNode("game.options", "volume");
	sm_createNode("game", "story");

	sm_createNode("game.dungeon", "talk");
	sm_createNode("game.save", "choice");
	

	-- create the network for the player
	sm_createNetwork("player");
	-- create nodes
	
	sm_createNode("player", "week");
	sm_createNode("player", "money");
	sm_createNode("player", "game");
	sm_createNode("player.game", "complete");
	sm_createNode("player.game", "points");
	-- create security
	sm_createNode("player", "security");
	sm_createNode("player.security", "armor");
	sm_createNode("player.security.armor", "mod");
	sm_createNode("player.security", "weapon");
	sm_createNode("player.security.weapon", "mod");
	sm_createNode("player.security", "skill");
	sm_createNode("player.security", "morale");
	sm_createNode("player.security", "manage");
	sm_createNode("player.security", "hp");
	sm_createNode("player.security", "combat");
	sm_createNode("player.security", "hospital");

	-- create dev
	sm_createNode("player", "dev");
	sm_createNode("player.dev", "armor");
	sm_createNode("player.dev.armor", "mod");
	sm_createNode("player.dev", "weapon");
	sm_createNode("player.dev.weapon", "mod");
	sm_createNode("player.dev", "skill");
	sm_createNode("player.dev", "morale");
	sm_createNode("player.dev", "manage");
	sm_createNode("player.dev", "hp");
	sm_createNode("player.dev", "combat");
	sm_createNode("player.dev", "hospital");

	-- create management
	sm_createNode("player", "management");
	sm_createNode("player.management", "armor");
	sm_createNode("player.management.armor", "mod");
	sm_createNode("player.management", "weapon");
	sm_createNode("player.management.weapon", "mod");
	sm_createNode("player.management", "skill");
	sm_createNode("player.management", "morale");
	sm_createNode("player.management", "manage");
	sm_createNode("player.management", "hp");
	sm_createNode("player.management", "combat");
	sm_createNode("player.management", "hospital");	
end

function putDefaultValues()
    -- put in default values for the game network
	sm_putNode("game.gamescreen",0);
	sm_putNode("game.main",0);
	sm_putNode("game.store",0);
	sm_putNode("game.save",0);
	sm_putNode("game.load",0);
	sm_putNode("game.dungeon",0);
	sm_putNode("game.schedule",0);
	sm_putNode("game.options",0);
	sm_putNode("game.options.volume", 5);
	sm_putNode("game.story",0);
	sm_putNode("game.dungeon.talk", -1);
	sm_putNode("game.save.choice", 0);	

	sm_putNode("player.week", 0);
	sm_putNode("player.money", 100);
	sm_createNode("player.game", 0);
	sm_createNode("player.game.complete", 0);
	sm_createNode("player.game.points", 0);
	-- create security
	sm_putNode("player.security", 0);
	sm_putNode("player.security.armor", "none");
	sm_putNode("player.security.armor.mod", 0);
	sm_putNode("player.security.weapon", "none");
	sm_putNode("player.security.weapon.mod", 0);
	sm_putNode("player.security.skill", 10);
	sm_putNode("player.security.morale", 100);
	sm_putNode("player.security.manage", 100);
	sm_putNode("player.security.hp", 10);
	sm_putNode("player.security.combat", 10);
	sm_putNode("player.security.hospital", 0);

	-- create dev
	sm_putNode("player.dev", 0);
	sm_putNode("player.dev.armor", "none");
	sm_putNode("player.dev.armor.mod", 0);
	sm_putNode("player.dev.weapon", "none");
	sm_putNode("player.dev.weapon.mod", 0);
	sm_putNode("player.dev.skill", 10);
	sm_putNode("player.dev.morale", 100);
	sm_putNode("player.dev.manage", 100);
	sm_putNode("player.dev.hp", 10);
	sm_putNode("player.dev.combat", 10);
	sm_putNode("player.dev.hospital", 0);

	-- create management
	sm_putNode("player.management", 0);
	sm_putNode("player.management.armor", "none");
	sm_putNode("player.management.armor.mod", 0);
	sm_putNode("player.management.weapon", "none");
	sm_putNode("player.management.weapon.mod", 0);
	sm_putNode("player.management.skill", 10);
	sm_putNode("player.management.morale", 100);
	sm_putNode("player.management.manage", 100);
	sm_putNode("player.management.hp", 10);
	sm_putNode("player.management.combat", 10);
	sm_putNode("player.management.hospital", 0);
end


createNetworks();
putDefaultValues();
sm_traceOut("game");
sm_traceOut("player");