Skip to content

Commit

Permalink
renamed option names
Browse files Browse the repository at this point in the history
  • Loading branch information
VietnamNeko committed May 13, 2021
1 parent a5831d7 commit 70ac5ca
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 24 deletions.
6 changes: 3 additions & 3 deletions engine/core/IgeEntity.js
Original file line number Diff line number Diff line change
Expand Up @@ -3931,7 +3931,7 @@ var IgeEntity = IgeObject.extend({
unit._stats.itemIds.forEach(function (itemId) {
if (itemId) {
var item = ige.$(itemId);
if(item._stats.slotIndex < unit._stats.inventorySize || item._stats.disabledInBackpack != true){
if(item._stats.slotIndex < unit._stats.inventorySize || item._stats.isDisabledInBackpack != true){
unit.updateStats(itemId, true);
}

Expand All @@ -3949,7 +3949,7 @@ var IgeEntity = IgeObject.extend({
unit._stats.itemIds.forEach(function (itemId) {
if (itemId) {
var item = ige.$(itemId);
if(item._stats.slotIndex < unit._stats.inventorySize || item._stats.disabledInBackpack != true){
if(item._stats.slotIndex < unit._stats.inventorySize || item._stats.isDisabledInBackpack != true){
unit.updateStats(itemId);
}

Expand Down Expand Up @@ -5230,7 +5230,7 @@ var IgeEntity = IgeObject.extend({
}
}

if(this._stats.stunned == undefined || this._stats.stunned != true){
if(this._stats.isStunned == undefined || this._stats.isStunned != true){
this.rotateTo(0, 0, rotate);
}
this.translateTo(x, y, 0);
Expand Down
12 changes: 6 additions & 6 deletions server/ServerNetworkEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,15 +497,15 @@ var ServerNetworkEvents = {
) {
fromItem.streamUpdateData([{ slotIndex: parseInt(data.to) }]);
toItem.streamUpdateData([{ slotIndex: parseInt(data.from) }]);
if(fromItem.disabledInBackpack == true && data.from + 1 <= unit._stats.inventorySize && data.to + 1 > unit._stats.inventorySize){
if(fromItem.isDisabledInBackpack == true && data.from + 1 <= unit._stats.inventorySize && data.to + 1 > unit._stats.inventorySize){
unit.updateStats(fromItem.id(), true)
}else if(fromItem.disabledInBackpack == true && data.to + 1 <= unit._stats.inventorySize && data.from + 1 > unit._stats.inventorySize){
}else if(fromItem.isDisabledInBackpack == true && data.to + 1 <= unit._stats.inventorySize && data.from + 1 > unit._stats.inventorySize){
unit.updateStats(fromItem.id())
}

if(toItem.disabledInBackpack == true && data.to + 1 <= unit._stats.inventorySize && data.from + 1 > unit._stats.inventorySize){
if(toItem.isDisabledInBackpack == true && data.to + 1 <= unit._stats.inventorySize && data.from + 1 > unit._stats.inventorySize){
unit.updateStats(toItem.id(), true)
}else if(toItem.disabledInBackpack == true && data.from + 1 <= unit._stats.inventorySize && data.to + 1 > unit._stats.inventorySize){
}else if(toItem.isDisabledInBackpack == true && data.from + 1 <= unit._stats.inventorySize && data.to + 1 > unit._stats.inventorySize){
unit.updateStats(toItem.id())
}
var temp = itemIds[data.from];
Expand All @@ -528,9 +528,9 @@ var ServerNetworkEvents = {
)
) {
fromItem.streamUpdateData([{ slotIndex: parseInt(data.to) }]);
if(fromItem.disabledInBackpack == true && data.from + 1 <= unit._stats.inventorySize && data.to + 1 > unit._stats.inventorySize){
if(fromItem.isDisabledInBackpack == true && data.from + 1 <= unit._stats.inventorySize && data.to + 1 > unit._stats.inventorySize){
unit.updateStats(fromItem.id(), true)
}else if(fromItem.disabledInBackpack == true && data.to + 1 <= unit._stats.inventorySize && data.from + 1 > unit._stats.inventorySize){
}else if(fromItem.isDisabledInBackpack == true && data.to + 1 <= unit._stats.inventorySize && data.from + 1 > unit._stats.inventorySize){
unit.updateStats(fromItem.id())
}
itemIds[data.to] = itemIds[data.from];
Expand Down
2 changes: 1 addition & 1 deletion src/gameClasses/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ var Item = IgeEntityBox2d.extend({
var ownerUnit = ige.$(this._stats.ownerUnitId)
if (ownerUnit) {
// remove its passive attributes from its ownerUnit unit.
if(this._stats.slotIndex < ownerUnit._stats.inventorySize || this._stats.disabledInBackpack != true){
if(this._stats.slotIndex < ownerUnit._stats.inventorySize || this._stats.isDisabledInBackpack != true){
ownerUnit.updateStats(this.id(), true);
}

Expand Down
18 changes: 9 additions & 9 deletions src/gameClasses/Unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ var Unit = IgeEntityBox2d.extend({
self.playEffect('create');
self.addBehaviour('unitBehaviour', self._behaviour);
self.scaleDimensions(self._stats.width, self._stats.height);
self._stats.stunned = false;
self._stats.isStunned = false;
},

shouldRenderAttribute: function (attribute) {
Expand Down Expand Up @@ -778,7 +778,7 @@ var Unit = IgeEntityBox2d.extend({
var item = ige.$(itemId);
if (item) {
// removing passive attributes
if(item._stats.slotIndex < this._stats.inventorySize || item._stats.disabledInBackpack != true){
if(item._stats.slotIndex < this._stats.inventorySize || item._stats.isDisabledInBackpack != true){
self.updateStats(itemId, true);
}

Expand All @@ -801,7 +801,7 @@ var Unit = IgeEntityBox2d.extend({
}

// adding back passive attributes
if(item._stats.slotIndex < this._stats.inventorySize || item._stats.disabledInBackpack != true){
if(item._stats.slotIndex < this._stats.inventorySize || item._stats.isDisabledInBackpack != true){
self.updateStats(itemId);
}
}
Expand Down Expand Up @@ -1041,7 +1041,7 @@ var Unit = IgeEntityBox2d.extend({
{quantity: itemData.quantity},
{slotIndex: slotIndex }
])
if(item._stats.slotIndex < self._stats.inventorySize || item._stats.disabledInBackpack != true){
if(item._stats.slotIndex < self._stats.inventorySize || item._stats.isDisabledInBackpack != true){
self.updateStats(item.id())
}

Expand Down Expand Up @@ -1241,7 +1241,7 @@ var Unit = IgeEntityBox2d.extend({
}

self.inventory.removeItem(itemIndex, item.id());
if(item._stats.slotIndex < this._stats.inventorySize || item._stats.disabledInBackpack != true){
if(item._stats.slotIndex < this._stats.inventorySize || item._stats.isDisabledInBackpack != true){
self.updateStats(item.id(), true)
}
self.detachEntity(item.id());
Expand Down Expand Up @@ -1526,8 +1526,8 @@ var Unit = IgeEntityBox2d.extend({
self._stats.ownerId = newValue;
}
break;
case 'stun':
self._stats.stunned = true;
case 'isStunned':
self._stats.isStunned = newValue;
break;
}
}
Expand Down Expand Up @@ -1730,7 +1730,7 @@ var Unit = IgeEntityBox2d.extend({
if (self.angleToTarget != undefined && !isNaN(self.angleToTarget) &&
this._stats.controls && this._stats.controls.mouseBehaviour.rotateToFaceMouseCursor &&
this._stats.currentBody && !this._stats.currentBody.fixedRotation &&
(this._stats.stunned == undefined || this._stats.stunned != true)
(this._stats.isStunned == undefined || this._stats.isStunned != true)
) {
if(this._stats.controls.absoluteRotation){
self.rotateTo(0, 0, ownerPlayer.absoluteAngle);
Expand All @@ -1740,7 +1740,7 @@ var Unit = IgeEntityBox2d.extend({
}
}

if(self._stats.stunned == undefined || self._stats.stunned != true){
if(self._stats.isStunned == undefined || self._stats.isStunned != true){
// translate unit
var speed = this._stats.attributes['speed'] && this._stats.attributes['speed'].value || 0;
var vector = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/gameClasses/components/ControlComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var ControlComponent = IgeEntity.extend({
if (unit && unit._category == 'unit') {
if (ige.isServer || (ige.isClient && !this.isChatOpen)) {
var unitAbility = null;
if(unit._stats.stunned == undefined || unit._stats.stunned != true){
if(unit._stats.isStunned == undefined || unit._stats.isStunned != true){
if (unit._stats.controls) {
if (unit._stats.controls.movementControlScheme == 'ad') {
switch (key) {
Expand Down
5 changes: 3 additions & 2 deletions src/gameClasses/components/script/ActionComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,14 +1050,15 @@ var ActionComponent = IgeEntity.extend({
case 'stunUnit':
var unit = ige.variable.getValue(action.unit, vars);
if (unit && unit._stats) {
unit.streamUpdateData([{stunned:true}])
unit.ability.stopUsingItem()
unit.streamUpdateData([{isStunned:true}])
}
break;

case 'removeStunFromUnit':
var unit = ige.variable.getValue(action.unit, vars);
if (unit && unit._stats) {
unit.streamUpdateData([{stunned:false}])
unit.streamUpdateData([{isStunned:false}])
}
break;

Expand Down
4 changes: 2 additions & 2 deletions src/gameClasses/components/unit/AIComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var AIComponent = IgeEntity.extend({
});

var ownerPlayerOfTargetUnit = ige.$(unit._stats.ownerId);
if (ownerPlayer && ownerPlayer.isHostileTo(ownerPlayerOfTargetUnit) && unit._stats.unTargetable != true) {
if (ownerPlayer && ownerPlayer.isHostileTo(ownerPlayerOfTargetUnit) && unit._stats.isUnTargetable != true) {
// if I already have a target, re-target if new target unit is closer
var targetUnit = this.getTargetUnit();
if (targetUnit == undefined || (self.maxAttackRange < this.getDistanceToTarget())) {
Expand Down Expand Up @@ -283,7 +283,7 @@ var AIComponent = IgeEntity.extend({
self.goIdle();
}else{
// stop moving, start attacking if my attack can reach the target
if (self.maxAttackRange > this.getDistanceToTarget()) {
if (self.maxAttackRange > this.getDistanceToTarget() && unit._stats.isStunned != true) {
unit.isMoving = false;
unit.ability.startUsingItem()

Expand Down

0 comments on commit 70ac5ca

Please sign in to comment.