Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Add 2 new actions about item && Fix bullet start position rotation issue #325

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions src/gameClasses/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ var Item = IgeEntityPhysics.extend({
if (owner && self._stats.currentBody && self._stats.currentBody.jointType == 'weldJoint') {
rotate = owner._rotate.z;
}
rotate += self._stats.bulletStartPosition.rotation * Math.PI / 180;

if (self.anchoredOffset == undefined) {
self.anchoredOffset = { x: 0, y: 0, rotate: 0 };
Expand Down
20 changes: 20 additions & 0 deletions src/gameClasses/components/script/ActionComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,27 @@ var ActionComponent = IgeEntity.extend({
item.streamUpdateData([{ fireRate: value }]);
}
break;

case 'setItemBulletForce':
var item = ige.variable.getValue(action.item, vars);
var value = ige.variable.getValue(action.number, vars);

if (item && item._category == 'item') {
item.streamUpdateData([{ bulletForce: value }]);
}
break;

case 'setItemBulletStartPosition':
var item = ige.variable.getValue(action.item, vars);
var rotation = ige.variable.getValue(action.number1, vars);
var x = ige.variable.getValue(action.number2, vars);
var y = ige.variable.getValue(action.number3, vars);

if (item && item._category == 'item') {
item.streamUpdateData([{ bulletStartPosition: { rotation: rotation, x: x, y: y } }]);
}
break;

case 'changeInventorySlotColor':
var item = ige.variable.getValue(action.item, vars);
var color = ige.variable.getValue(action.string, vars);
Expand Down