Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 6991788

Browse files
committed
Laser rifle balancing
1 parent 75d5dfc commit 6991788

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

Techion.rte/Devices/Weapons/LaserRifle/LaserRifle.ini

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
AddEffect = MOPixel
6-
PresetName = Laser Rifle Glow
6+
PresetName = Laser Rifle Glow 0
77
Mass = 1
88
GlobalAccScalar = 0
99
LifeTime = 25
@@ -18,31 +18,31 @@ AddEffect = MOPixel
1818

1919

2020
AddEffect = MOPixel
21-
CopyOf = Laser Rifle Glow
22-
PresetName = Laser Rifle Glow End 1
21+
CopyOf = Laser Rifle Glow 0
22+
PresetName = Laser Rifle Glow 1
2323
ScreenEffect = ContentFile
24-
FilePath = Base.rte/Effects/Glows/LightBlueSmall.png
24+
FilePath = Base.rte/Effects/Glows/LightBlueSmaller3.png
2525

2626

2727
AddEffect = MOPixel
28-
CopyOf = Laser Rifle Glow End 1
29-
PresetName = Laser Rifle Glow End 2
28+
CopyOf = Laser Rifle Glow 0
29+
PresetName = Laser Rifle Glow 2
3030
ScreenEffect = ContentFile
31-
FilePath = Base.rte/Effects/Glows/LightBlueSmaller1.png
31+
FilePath = Base.rte/Effects/Glows/LightBlueSmaller2.png
3232

3333

3434
AddEffect = MOPixel
35-
CopyOf = Laser Rifle Glow End 1
36-
PresetName = Laser Rifle Glow End 3
35+
CopyOf = Laser Rifle Glow 0
36+
PresetName = Laser Rifle Glow 3
3737
ScreenEffect = ContentFile
38-
FilePath = Base.rte/Effects/Glows/LightBlueSmaller2.png
38+
FilePath = Base.rte/Effects/Glows/LightBlueSmaller1.png
3939

4040

4141
AddEffect = MOPixel
42-
CopyOf = Laser Rifle Glow End 1
43-
PresetName = Laser Rifle Glow End 4
42+
CopyOf = Laser Rifle Glow 0
43+
PresetName = Laser Rifle Glow 4
4444
ScreenEffect = ContentFile
45-
FilePath = Base.rte/Effects/Glows/LightBlueSmaller3.png
45+
FilePath = Base.rte/Effects/Glows/LightBlueSmall.png
4646

4747

4848
AddEffect = AEmitter
@@ -127,7 +127,7 @@ AddAmmo = Magazine
127127
CopyOf = Null Round
128128
PresetName = Round Laser Rifle
129129
Shell = MOPixel
130-
CopyOf = Laser Rifle Glow End 3
130+
CopyOf = Laser Rifle Glow 2
131131
FireVelocity = 300
132132
AILifeTime = 300
133133
TracerRound = Round

Techion.rte/Devices/Weapons/LaserRifle/LaserRifle.lua

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
function Create(self)
22
self.range = math.sqrt(FrameMan.PlayerScreenWidth^2 + FrameMan.PlayerScreenHeight^2)/2;
3-
self.penetrationStrength = 125;
3+
self.penetrationStrength = 170;
4+
self.strengthVariation = 5;
45
--This value tracks the shots and varies the penetration strength to create a "resistance" effect on tougher materials
56
self.shotCounter = 0; --TODO: Rename/describe this variable better
67
self.activity = ActivityMan:GetActivity();
@@ -42,12 +43,12 @@ function Update(self)
4243
skipPx = 1;
4344
local shortRay = SceneMan:CastObstacleRay(gapPos, Vector(trace.X, trace.Y):SetMagnitude(range - rayLength + skipPx), hitPos, gapPos, actor.ID, self.Team, rte.airID, skipPx);
4445
gapPos = gapPos - Vector(trace.X, trace.Y):SetMagnitude(skipPx);
45-
local strengthFactor = 1 + (self.shotCounter + math.min(rayLength/self.range, 1)) * RangeRand(0.7, 1.0);
46+
local strengthFactor = math.max(1 - rayLength/self.range, math.random()) * (self.shotCounter + 1)/self.strengthVariation;
4647

4748
local moID = SceneMan:GetMOIDPixel(hitPos.X, hitPos.Y);
4849
if moID ~= rte.NoMOID and moID ~= self.ID then
4950
local mo = ToMOSRotating(MovableMan:GetMOFromID(moID));
50-
if self.penetrationStrength/strengthFactor >= mo.Material.StructuralIntegrity or math.random(self.penetrationStrength) > mo.Material.StructuralIntegrity then
51+
if self.penetrationStrength * strengthFactor >= mo.Material.StructuralIntegrity then
5152
local moAngle = -mo.RotAngle * mo.FlipFactor;
5253

5354
local woundName = mo:GetEntryWoundPresetName();
@@ -66,10 +67,10 @@ function Update(self)
6667
local smoke = CreateMOSParticle("Tiny Smoke Ball 1" .. (math.random() < 0.5 and " Glow Blue" or ""), "Base.rte");
6768
smoke.Pos = gapPos;
6869
smoke.Vel = Vector(-trace.X, -trace.Y):SetMagnitude(math.random(3, 6)):RadRotate(RangeRand(-1.5, 1.5));
69-
smoke.Lifetime = smoke.Lifetime/strengthFactor;
70+
smoke.Lifetime = smoke.Lifetime * strengthFactor;
7071
MovableMan:AddParticle(smoke);
7172

72-
local pix = CreateMOPixel("Laser Rifle Glow End " .. math.floor(strengthFactor), "Techion.rte");
73+
local pix = CreateMOPixel("Laser Rifle Glow " .. math.floor(strengthFactor * 4 + 0.5), "Techion.rte");
7374
pix.Pos = gapPos;
7475
pix.Sharpness = self.penetrationStrength/6;
7576
pix.Vel = Vector(trace.X, trace.Y):SetMagnitude(6);
@@ -86,13 +87,13 @@ function Update(self)
8687
end
8788
local particleCount = trace.Magnitude * RangeRand(0.4, 0.8);
8889
for i = 0, particleCount do
89-
local pix = CreateMOPixel("Laser Rifle Glow", "Techion.rte");
90+
local pix = CreateMOPixel("Laser Rifle Glow 0", "Techion.rte");
9091
pix.Pos = startPos + trace * i/particleCount;
9192
pix.Vel = self.Vel;
9293
MovableMan:AddParticle(pix);
9394
end
9495
end
95-
self.shotCounter = (self.shotCounter + 1) % 3;
96+
self.shotCounter = (self.shotCounter + 1) % self.strengthVariation;
9697
self.cooldown:Reset();
9798
end
9899
if self.Magazine and self.Magazine.RoundCount > 0 then

0 commit comments

Comments
 (0)