Network methods

Pazyryk

Deity
Joined
Jun 13, 2008
Messages
3,584
Can someone please explain Network methods to me?

The wiki list is empty and refers to them as "TCP/IP and HTTP methods", but that clearly only applies to a subset. I've been ignoring them mostly because I thought they were all ether multiplayer setup or human player UI-only stuff. But it seems like you do things with these not possible otherwise, like control city working plots and specialists (for human and AI, I think). However, they also are used in the UI to do things that I know I can do with player or game methods (e.g., found or enhance a religion).

To try to get a handle on these, I've copied all of them I can find in current Lua files (the args are just whatever happened to be there in the first instance I found):
Code:
BroadcastGameSettings();
BroadcastPlayerInfo();
GetDebugLogLevel()
GetLocalTurnSliceInfo();
GetMapRandSeed()
GetPingTime( playerID )
GetPlayerTurnSliceInfo(i - 1);
GetSynchRandSeed()
GetTurnSliceMaxMessageCount()
HasReconnectCache()
HasSentNetTurnAllComplete()
HasSentNetTurnComplete()
IsConnectedToSteam()
IsEveryoneConnected()
Reconnect()
SendBarbarianRansom(1, iUnitID); -- 1 is Button ID
SendChangeWar(eRivalTeam, true);
SendChat( text, g_iChatTeam, g_iChatPlayer );
SendCityBuyPlot(pHeadSelectedCity:GetID(), plotX, plotY);
SendDoTask(cityID, TaskTypes.TASK_ANNEX_PUPPET, -1, -1, false, false, false, false);
SendDiploVote(iVotePlayer);
SendEnhanceReligion(Game.GetActivePlayer(), g_CurrentReligionID, customName, g_Beliefs[4], g_Beliefs[5], g_iCityX, g_iCityY);
SendExtendedGame();
SendFaithGreatPersonChoice(playerID, unit.ID);
SendFaithPurchase(Game.GetActivePlayer(), v1, v2);
SendFoundPantheon(Game.GetActivePlayer(), g_BeliefID);
SendFoundReligion(Game.GetActivePlayer(), g_CurrentReligionID, customName, beliefsToSend[1], beliefsToSend[2], beliefsToSend[3], beliefsToSend[4], g_iCityX, g_iCityY);
SendGameOptions(options);
SendGiftUnit(iGiftedPlayer, iUnitIndex);
SendGreatPersonChoice(playerID, unit.ID);
SendLiberateMinor(iLiberatedPlayer, cityID);
SendMayaBonusChoice(playerID, unit.ID);
SendMinorCivEnterTerritory(eRivalTeam);
SendMinorNoUnitSpawning(g_iMinorCivID, not bSpawningDisabled);
SendMoveSpy(Game.GetActivePlayer(), g_SelectedAgentID, -1, -1);
SendPledgeMinorProtection(g_iMinorCivID, true);
SendRenameCity(pCity:GetID(), Controls.EditCityName:GetText());
SendRenameUnit(pUnit:GetID(), Controls.EditUnitName:GetText());
SendResearch(eTech, player:GetNumFreeTechs(), -1, UIManager:GetShift());
SendReturnCivilian(true, iGiftedPlayer, iUnitIndex);
SendSetCityAIFocus( pCity:GetID(), focus );
SendSetCityAvoidGrowth( pCity:GetID(), not pCity:IsForcedAvoidGrowth() );
SendSellBuilding(pCity:GetID(), g_iBuildingToSell);
SendStageCoup(Game.GetActivePlayer(), v.AgentID);
SendTurnUnready() 
SendUpdateCityCitizens(pCity:GetID());
SendUpdatePolicies(iNewPolicyBranch, bPolicy, true);
SetDebugLogLevel(2);

Commented out everywhere post-G&K, so probably depreciated:
--Network.SendCityEjectGarrisonChoice(city:GetID(), plotX, plotY);

Also, here are all the TaskTypes, which are used in Network.SendDoTask()
Code:
TASK_CLEAR_ORDERS
TASK_CLEAR_RALLY_PLOT
TASK_ADD_SPECIALIST
TASK_ANNEX_PUPPET
TASK_SET_AUTOMATED_PRODUCTION
TASK_REMOVE_SPECIALIST
TASK_CREATE_PUPPET
TASK_RANGED_ATTACK
TASK_RALLY_PLOT
TASK_SET_EMPHASIZE
TASK_CONSCRIPT
TASK_HURRY
TASK_CLEAR_WORKING_OVERRIDE
TASK_DISBAND
TASK_GIFT
TASK_CHANGE_WORKING_PLOT
TASK_RAZE
TASK_NO_AUTO_ASSIGN_SPECIALISTS
TASK_SET_AUTOMATED_CITIZENS
TASK_UNRAZE

Another thing I don't understand, this gets you all methods for Game or Map:
Code:
for k, v in pairs(Game) do print(k) end
but it doesn't work for Network.
 
Back
Top Bottom