Development Notes: Extensions - CitiesSkylinesMultiplayer/CSM GitHub Wiki
ICities.dll
Extensions
Here is a list of extensions that can be used in the ICities.dll (not much documentation elsewhere).
AreasExtensionBase
We can use these extension methods to sync which areas have been bought.
Method | Return |
---|---|
OnCanUnlockArea(int x, int z, bool originalResult) |
originalResult |
OnGetAreaPrice(uint ore, uint oil, uint forest, uint fertility, uint water, bool road, bool train, bool ship, bool plane, float landFlatness, int originalPrice) |
originalPrice |
OnUnlockArea(int x, int z) |
VOID |
BuildingExtensionBase
We can use this to find out where builds are. Looks like it may be quite complicated. Guess we will see.
Method | Return |
---|---|
SpawnData OnCalculateSpawn(Vector3 location, SpawnData spawn) |
spawn |
OnBuildingCreated(ushort id) |
VOID |
OnBuildingRelocated(ushort id) |
VOID |
OnBuildingReleased(ushort id) |
VOID |
ChirperExtensionBase
This really is not that important, (I personally don't really like the "Twitter" like feature), but it can still be implemented. On Server we send the new chirper message to the clients on OnNewMessage
event. Client side we ignore these chirpers.
Method | Return |
---|---|
OnNewMessage(IChirperMessage message) |
VOID |
DemandExtensionBase
This extension will allow us to synchronize demand across all connected clients. More research is required, but from what I understand, we need to override the OnCalculate*Demmand
methods to grab the calculated demand from the server. On the server we will access the demand manager to get the current demand. The OnUpdateDemand
method will also be used for server-client syncing.
Method | Return |
---|---|
OnCalculateResidentialDemand(int originalDemand) |
originalDemand |
OnCalculateCommercialDemand(int originalDemand) |
originalDemand |
OnCalculateWorkplaceDemand(int originalDemand) |
originalDemand |
OnUpdateDemand(int lastDemand, int nextDemand, int targetDemand) |
nextDemand |
EconomyExtensionBase
Currently looking at implementing OnUpdateMoneyAmount
to sync money between clients. Some basic testing showed that this was only updating the UI? Need to look further into it.
Method | Return |
---|---|
OnAddResource(EconomyResource resource, int amount, Service service, SubService subService, Level level) |
amount |
OnFetchResource(EconomyResource resource, int amount, Service service, SubService subService, Level level) |
amount |
OnPeekResource(EconomyResource resource, int amount) |
amount |
OnGetConstructionCost(int originalConstructionCost, Service service, SubService subService, Level level) |
amount |
OnGetMaintenanceCost(int originalMaintenanceCost, Service service, SubService subService, Level level) |
amount |
OnGetRelocationCost(int constructionCost, int relocationCost, Service service, SubService subService, Level level) |
amount |
OnGetRefundAmount(int constructionCost, int refundAmount, Service service, SubService subService, Level level) |
amount |
OnUpdateMoneyAmount(long internalMoneyAmount) |
internalMoneyAmount |
IDisasterBase
This has a different naming scheme for some reason? This would be used for syncing disasters (going to be interesting to setup)
Method | Return |
---|---|
OnDisasterCreated(ushort disasterID) |
VOID |
OnDisasterStarted(ushort disasterID) |
VOID |
OnDisasterDetected(ushort disasterID) |
VOID |
OnDisasterActivated(ushort disasterID) |
VOID |
OnDisasterDeactivated(ushort disasterID) |
VOID |
OnDisasterFinished(ushort disasterID) |
VOID |
LevelUpExtensionBase
todo
LoadingExtensionBase
todo
MilestonesExtensionBase
todo
ResourceExtensionBase
todo
SerializableDataExtensionBase
todo
TerrainExtensionBase
todo
ThreadingExtensionBase
todo