Skip to content

Commit 8fbc359

Browse files
committed
Merge branch 'development' into rays-and-hotkeys
2 parents e0cca09 + b6e5c5d commit 8fbc359

File tree

21 files changed

+179
-86
lines changed

21 files changed

+179
-86
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
129129

130130
- `Scene` Lua functions `AddNavigatableArea(areaName)` and `ClearNavigatableAreas()` have been renamed/corrected to `AddNavigableArea(areaName)` and `ClearNavigableAreas()`, respectively.
131131

132+
- `MOSRotating` Lua function `AddWound` now additionally accepts the format `MOSRotating:AddWound(AEmitter* woundToAdd, const Vector& parentOffsetToSet, bool checkGibWoundLimit, bool isEntryWound, bool isExitWound)`, allowing modders to specify added wounds as entry- or exit wounds, for the purpose of not playing multiple burst sounds on the same frame. These new arguments are optional.
133+
132134
</details>
133135

134136
<details><summary><b>Fixed</b></summary>

Data/Base.rte/Devices/Shared/Scripts/MuzzleSmoke.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
function Create(self)
2-
32
if self.Magazine then
43
local particleCount = self.Magazine.NextRound.ParticleCount;
54
local particleMass = self.Magazine.NextRound.NextParticle.Mass;
@@ -30,16 +29,13 @@ function Create(self)
3029
self.fireSmokeEffect.GravMult = 1;
3130

3231
self.particleUtility = require("Scripts/Utility/ParticleUtility");
33-
3432
end
3533

3634
function OnFire(self)
37-
3835
local flip = self.HFlipped and math.pi or 0;
3936
local angle = self.RotAngle + flip;
4037
self.fireSmokeEffect.Position = self.MuzzlePos;
4138
self.fireSmokeEffect.RadAngle = angle;
4239

4340
self.particleUtility:CreateDirectionalSmokeEffect(self.fireSmokeEffect);
44-
4541
end

Data/Base.rte/Devices/Shared/Scripts/RevolverCylinderReload.lua

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,29 @@ function Create(self)
44
self.shellMOSRotating = self:StringValueExists("CylinderShellMOSRotating") and self:GetStringValue("CylinderShellMOSRotating") or nil;
55
end
66

7-
function Update(self)
7+
function ThreadedUpdate(self)
88
if self.Magazine then
99
self.shellsToEject = self.Magazine.Capacity - self.Magazine.RoundCount;
1010
elseif self.shellsToEject > 0 then
11+
self.ejectingShells = {};
1112
for i = 1, self.shellsToEject do
1213
local shell = self.shellMOSRotating and CreateMOSRotating(self.shellMOSRotating) or CreateMOSParticle(self.shellMOSParticle);
1314
shell.Pos = self.Pos;
1415
shell.Vel = self.Vel + Vector(RangeRand(-3, 0) * self.FlipFactor, 0):RadRotate(self.RotAngle + RangeRand(-0.3, 0.3));
1516
shell.AngularVel = RangeRand(-1, 1);
16-
MovableMan:AddParticle(shell);
17+
table.insert(self.ejectingShells, shell);
1718
end
1819

1920
self.shellsToEject = 0;
21+
self:RequestSyncedUpdate();
22+
end
23+
end
24+
25+
function SyncedUpdate(self)
26+
if self.ejectingShells then
27+
for i = 1, #self.ejectingShells do
28+
MovableMan:AddParticle(self.ejectingShells[i]);
29+
end
30+
self.ejectingShells = nil;
2031
end
2132
end

Data/Browncoats.rte/Devices/Weapons/Extinction/Extinction.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ function Create(self)
2222

2323
-- for some reason if this is added to sim while facing leftwards, StanceOffset will actually be flipped.
2424
-- but not sharpstanceoffset...............
25-
26-
2725
self.origStanceOffset = Vector(self.StanceOffset.X*self.FlipFactor, self.StanceOffset.Y);
2826
self.origSharpStanceOffset = Vector(self.SharpStanceOffset.X, self.SharpStanceOffset.Y);
2927

Data/Browncoats.rte/Devices/Weapons/Flash/Flash.lua

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ function Create(self)
1111

1212
self.targetLockSound = CreateSoundContainer("Mine Activate", "Base.rte");
1313
end
14-
function Update(self)
14+
15+
function ThreadedUpdate(self)
1516
local parent = self:GetRootParent();
1617
if IsActor(parent) then
1718
parent = ToActor(parent);
@@ -91,10 +92,11 @@ function Update(self)
9192
parent = nil;
9293
self.targets = {};
9394
end
95+
9496
if self.FiredFrame then
9597
local rocketNumber = self.RoundInMagCount + 1;
9698

97-
local rocket = CreateAEmitter("Particle Browncoat Rocket", "Browncoats.rte");
99+
self.rocket = CreateAEmitter("Particle Browncoat Rocket", "Browncoats.rte");
98100
if #self.targets > 0 then
99101
if self.targets[rocketNumber] and self.targets[rocketNumber].actor.ID ~= rte.NoMOID then
100102
rocket:SetNumberValue("TargetID", self.targets[rocketNumber].actor.ID);
@@ -104,12 +106,18 @@ function Update(self)
104106
rocket:SetNumberValue("TargetID", self.targets[math.random(#self.targets)].actor.ID);
105107
end
106108
end
107-
rocket.Pos = self.MuzzlePos + Vector(0, (rocketNumber - self.RoundInMagCapacity * 0.5)):RadRotate(self.RotAngle);
108-
rocket.Vel = self.Vel + Vector(self.fireVel * RangeRand(0.9, 1.1) * self.FlipFactor, 0):RadRotate(self.RotAngle - ((self.spread * 0.5) - (rocketNumber/self.RoundInMagCapacity) * self.spread) * self.FlipFactor);
109-
rocket.RotAngle = rocket.Vel.AbsRadAngle;
110-
rocket.AngularVel = math.cos(rocket.Vel.AbsRadAngle) * 5;
111-
rocket.Team = self.Team;
112-
rocket.IgnoresTeamHits = true;
113-
MovableMan:AddParticle(rocket);
109+
self.rocket.Pos = self.MuzzlePos + Vector(0, (rocketNumber - self.RoundInMagCapacity * 0.5)):RadRotate(self.RotAngle);
110+
self.rocket.Vel = self.Vel + Vector(self.fireVel * RangeRand(0.9, 1.1) * self.FlipFactor, 0):RadRotate(self.RotAngle - ((self.spread * 0.5) - (rocketNumber/self.RoundInMagCapacity) * self.spread) * self.FlipFactor);
111+
self.rocket.RotAngle = rocket.Vel.AbsRadAngle;
112+
self.rocket.AngularVel = math.cos(rocket.Vel.AbsRadAngle) * 5;
113+
self.rocket.Team = self.Team;
114+
self.rocket.IgnoresTeamHits = true;
115+
end
116+
end
117+
118+
function SyncedUpdate(self)
119+
if self.rocket then
120+
MovableMan:AddParticle(self.rocket);
121+
self.rocket = nil;
114122
end
115123
end

Data/Dummy.rte/Devices/Weapons/Destroyer/DestroyerCannon.lua

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function Create(self)
1515
self.activeSound = CreateSoundContainer("Destroyer Emission Sound", "Dummy.rte");
1616
end
1717

18-
function Update(self)
18+
function ThreadedUpdate(self)
1919
if self.Magazine then
2020
if self.inventorySwapTimer:IsPastSimTimeLimit() then
2121
self.activeSound:Stop();
@@ -28,18 +28,18 @@ function Update(self)
2828
self.animTimer:Reset();
2929
self.Frame = self.Frame < (self.FrameCount - 1) and self.Frame + 1 or 0;
3030
if self.Frame == 1 then
31-
local effect = CreateMOPixel("Destroyer Muzzle Glow");
32-
effect.Pos = self.MuzzlePos;
33-
effect.Vel = self.Vel * 0.5;
34-
MovableMan:AddParticle(effect);
35-
36-
local damagePar = CreateMOPixel("Dummy.rte/Destroyer Emission Particle 2");
37-
damagePar.Pos = self.MuzzlePos;
38-
damagePar.Vel = self.Vel * 0.5 + Vector(math.random(5) * (1 + self.charge), 0):RadRotate(6.28 * math.random());
39-
damagePar.Team = self.Team;
40-
damagePar.IgnoresTeamHits = true;
41-
damagePar.Lifetime = 100 * (1 + self.charge);
42-
MovableMan:AddParticle(damagePar);
31+
self.effect = CreateMOPixel("Destroyer Muzzle Glow");
32+
self.effect.Pos = self.MuzzlePos;
33+
self.effect.Vel = self.Vel * 0.5;
34+
35+
self.damagePar = CreateMOPixel("Dummy.rte/Destroyer Emission Particle 2");
36+
self.damagePar.Pos = self.MuzzlePos;
37+
self.damagePar.Vel = self.Vel * 0.5 + Vector(math.random(5) * (1 + self.charge), 0):RadRotate(6.28 * math.random());
38+
self.damagePar.Team = self.Team;
39+
self.damagePar.IgnoresTeamHits = true;
40+
self.damagePar.Lifetime = 100 * (1 + self.charge);
41+
42+
self:RequestSyncedUpdate();
4343
end
4444
end
4545

@@ -83,13 +83,14 @@ function Update(self)
8383
else
8484
self.Frame = 0;
8585
end
86+
8687
if self.FiredFrame then
87-
local par = CreateAEmitter("Destroyer Cannon Shot");
88-
par.Team = self.Team;
89-
par.IgnoresTeamHits = true;
90-
par.Pos = self.MuzzlePos;
91-
par.Vel = Vector((self.minFireVel + (self.maxFireVel - self.minFireVel) * self.charge) * self.FlipFactor, 0):RadRotate(self.RotAngle);
92-
MovableMan:AddParticle(par);
88+
self.par = CreateAEmitter("Destroyer Cannon Shot");
89+
self.par.Team = self.Team;
90+
self.par.IgnoresTeamHits = true;
91+
self.par.Pos = self.MuzzlePos;
92+
self.par.Vel = Vector((self.minFireVel + (self.maxFireVel - self.minFireVel) * self.charge) * self.FlipFactor, 0):RadRotate(self.RotAngle);
93+
self:RequestSyncedUpdate();
9394

9495
self.charge = 0;
9596
self.activeSound:Stop();
@@ -98,6 +99,23 @@ function Update(self)
9899
end
99100
end
100101

102+
function SyncedUpdate(self)
103+
if self.effect then
104+
MovableMan:AddParticle(self.effect);
105+
self.effect = nil;
106+
end
107+
108+
if self.damagePar then
109+
MovableMan:AddParticle(self.par);
110+
self.damagePar = nil;
111+
end
112+
113+
if self.par then
114+
MovableMan:AddParticle(self.par);
115+
self.par = nil;
116+
end
117+
end
118+
101119
function Destroy(self)
102120
self.activeSound:Stop();
103121
end

Data/Dummy.rte/Devices/Weapons/Repeater/RepeaterShot.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ function Create(self)
2020
self.endPar = CreateMOSParticle("Tiny Smoke Ball 1 Glow Yellow");
2121
end
2222

23-
function Update(self)
23+
function ThreadedUpdate(self)
2424
if not self.ToDelete then
25+
-- Touching other things in non-synced update is bad, but because we know that nothing else is gonna be running scripts on it, we can get away with this
2526
for i = 1, self.trailParCount do
2627
if self.trailPar[i] and MovableMan:IsParticle(self.trailPar[i]) then
2728
self.trailPar[i].Pos = self.Pos + Vector(RangeRand(-0.5, 0.5), RangeRand(-0.5, 0.5)) - Vector(self.PrevVel.X, self.PrevVel.Y):SetMagnitude(math.min(self.PrevVel.Magnitude, self.trailLength + 1) * i/self.trailParCount);

Data/Imperatus.rte/Devices/Weapons/Marauder/Marauder.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function Create(self)
33
self.fireTimer = Timer();
44
end
55

6-
function Update(self)
6+
function ThreadedUpdate(self)
77
if self.FiredFrame or self:IsReloading() then
88
self.fireTimer:Reset();
99
end

Data/Ronin.rte/Devices/Weapons/357Magnum/357Magnum.lua

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function Create(self)
77
self.drawGun = false;
88
end
99

10-
function Update(self)
10+
function ThreadedUpdate(self)
1111
--Read RateOfFire on Update() to take Global Scripts to account
1212
if self.rof == nil then
1313
self.rof = self.RateOfFire;
@@ -17,12 +17,9 @@ function Update(self)
1717
self:SetOneHanded(false);
1818
self:SetDualWieldable(false);
1919
if MovableMan:IsOfActor(self.ID) then
20-
actor = ToActor(MovableMan:GetMOFromID(self.RootID));
20+
local actor = ToActor(MovableMan:GetMOFromID(self.RootID));
2121

22-
ToActor(actor):GetController():SetState(Controller.AIM_SHARP, false);
23-
ToActor(actor):GetController():SetState(Controller.BODY_PRONE, false);
2422
if ToActor(actor):GetController():IsState(Controller.WEAPON_FIRE) then
25-
2623
if self:GetNumberValue("CowboyMode") < 3 then
2724
self:Deactivate();
2825
self.triggerPulled = true;
@@ -94,4 +91,14 @@ function Update(self)
9491
self.StanceOffset = Vector(12, 0);
9592
self.drawGunAngle = 0;
9693
end
94+
end
95+
96+
function SyncedUpdate(self)
97+
if self:NumberValueExists("CowboyMode") then
98+
if MovableMan:IsOfActor(self.ID) then
99+
local actor = ToActor(MovableMan:GetMOFromID(self.RootID));
100+
ToActor(actor):GetController():SetState(Controller.AIM_SHARP, false);
101+
ToActor(actor):GetController():SetState(Controller.BODY_PRONE, false);
102+
end
103+
end
97104
end

Data/Ronin.rte/Devices/Weapons/K98K/K98K.lua

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Create(self)
55
self.boltPullSound = CreateSoundContainer("Ronin Kar98 Bolt Pull Sound", "Ronin.rte");
66
end
77

8-
function Update(self)
8+
function ThreadedUpdate(self)
99
local parent;
1010
local actor = self:GetRootParent();
1111
if actor and IsAHuman(actor) then
@@ -30,8 +30,7 @@ function Update(self)
3030
self.shell.Pos = self.Pos;
3131
self.shell.Vel = self.Vel + Vector(-6 * self.FlipFactor, -4):RadRotate(self.RotAngle);
3232
self.shell.Team = self.Team;
33-
MovableMan:AddParticle(self.shell);
34-
self.shell = nil;
33+
self.RequestSyncedUpdate();
3534
end
3635

3736
--Animate the gun to signify the bolt being pulled
@@ -55,4 +54,11 @@ function Update(self)
5554
else
5655
self.pullTimer:Reset();
5756
end
57+
end
58+
59+
function SyncedUpdate(self)
60+
if self.shell then
61+
MovableMan:AddParticle(self.shell);
62+
self.shell = nil;
63+
end;
5864
end

0 commit comments

Comments
 (0)