- Timestamp:
- 08/16/11 06:44:15 (13 years ago)
- Location:
- ps/trunk/binaries/data/mods/public/simulation/components
- Files:
-
- 2 edited
-
BuildLimits.js (modified) (3 diffs)
-
BuildRestrictions.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/simulation/components/BuildLimits.js
r9970 r10015 77 77 if (this.count[category] >= this.count["CivilCentre"] * this.limit[category].LimitPerCivCentre) 78 78 { 79 var cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager);80 79 var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player); 81 80 var notification = {"player": cmpPlayer.GetPlayerID(), "message": category+" build limit of "+this.limit[category].LimitPerCivCentre+" per civil centre reached"}; … … 88 87 else if (this.count[category] >= this.limit[category]) 89 88 { 90 var cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager); 91 var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player); 89 var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player); 92 90 var notification = {"player": cmpPlayer.GetPlayerID(), "message": category+" build limit of "+this.limit[category]+ " reached"}; 93 91 var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); … … 100 98 }; 101 99 100 BuildLimits.prototype.OnGlobalOwnershipChanged = function(msg) 101 { 102 // This automatically updates build counts 103 var cmpBuildRestrictions = Engine.QueryInterface(msg.entity, IID_BuildRestrictions); 104 if (cmpBuildRestrictions) 105 { 106 var playerID = (Engine.QueryInterface(this.entity, IID_Player)).GetPlayerID(); 107 if (msg.from == playerID) 108 { 109 this.DecrementCount(cmpBuildRestrictions.GetCategory()); 110 } 111 if (msg.to == playerID) 112 { 113 this.IncrementCount(cmpBuildRestrictions.GetCategory()); 114 } 115 } 116 }; 117 102 118 Engine.RegisterComponentType(IID_BuildLimits, "BuildLimits", BuildLimits); -
ps/trunk/binaries/data/mods/public/simulation/components/BuildRestrictions.js
r9991 r10015 72 72 }; 73 73 74 BuildRestrictions.prototype.OnOwnershipChanged = function(msg)75 {76 // This automatically updates building counts77 if (this.template.Category)78 {79 if (msg.from != -1)80 {81 var fromPlayerBuildLimits = QueryPlayerIDInterface(msg.from, IID_BuildLimits);82 fromPlayerBuildLimits.DecrementCount(this.template.Category);83 }84 if (msg.to != -1)85 {86 var toPlayerBuildLimits = QueryPlayerIDInterface(msg.to, IID_BuildLimits);87 toPlayerBuildLimits.IncrementCount(this.template.Category);88 }89 }90 };91 92 74 BuildRestrictions.prototype.CheckPlacement = function(player) 93 75 {
Note:
See TracChangeset
for help on using the changeset viewer.
