/* Function: CreateMatSys Creates a material system for the given player or for every player if iPlr == NO_OWNER. Parameters: iPlr - The player for whom the material system should be created or NO_OWNER. */ global func CreateMatSys(int iPlr) { if(iPlr == NO_OWNER) for(var i = 0; i < GetPlayerCount(); i++) CreateMatSys(GetPlayerByIndex(i)); else CreateObject(MSYS, 0, 0, iPlr); }
/* Function: GetMatSys Returns the material system for the given player, creating one if there is none. Parameters: iPlr - The player whose material system should be returned. bDoNotCreateMatSys - When true, the function won't create a material system for that player. Returns: The material system for the given player or 0 if there is none. */ global func GetMatSys(int iPlr, bool bDoNotCreateMatSys) { if(GetType(aMaterialSystem) != C4V_Array || !aMaterialSystem[iPlr]) { if(!bDoNotCreateMatSys) CreateMatSys(iPlr); else return; } return aMaterialSystem[iPlr]; }
func InitializePlayer(int plr) { CreateMatSys(plr); // fill with material var msys = GetMatSys(plr); msys->DoFill(4, WOOD); msys->DoFill(10, METL); msys->DoFill(7, ROCK); //Flints CreateContents(FLNT, GetHiRank(plr), 2); var team = GetPlayerTeam(plr); var pos = GetStartPosition(team); if(GetLength(GetPlayersByTeam(team)) == 1) { CreateStartMaterial(pos[0], pos[1], plr); } var tank = FindObject2(Find_ID(STMT), Find_Allied(plr)); tank->DoFill(100); var i = 0, clonk; while(clonk = GetCrew(plr, i++)) clonk->Enter(tank); }
func InitializePlayer(int iPlr) { CreateMatSys(iPlr); }