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

Commit 527b68b

Browse files
committed
Changes requested by Gacyr
1 parent 8502ab9 commit 527b68b

File tree

20 files changed

+178
-78
lines changed

20 files changed

+178
-78
lines changed

Base.rte/AI/HumanBehaviors.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ function HumanBehaviors.GetTeamShootingSkill(team)
1414
aimSkill = 0.04
1515
else
1616
-- the AI shoot sooner and with slightly better precision
17-
aimSpeed = 1/(0.65/(2.9-math.exp(skill*0.01))) -- [1.42 .. 0.38]
18-
aimSkill = 1/(0.75/(3.0-math.exp(skill*0.01))) -- [1.36 .. 0.48]
17+
aimSpeed = 1/(0.65/(2.9-math.exp(skill*0.01)))
18+
aimSkill = 1/(0.75/(3.0-math.exp(skill*0.01)))
1919
end
2020
return aimSpeed, aimSkill, skill
2121
end

Base.rte/AI/HumanFunctions.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function HumanFunctions.DoAlternativeGib(actor)
55
if actor.detachLimit then
66
if actor.WoundCount > actor.detachLimit then
77
actor.detachLimit = actor.WoundCount + 1;
8-
local parts = {actor.BGArm, actor.BGLeg, actor.FGArm, actor.FGLeg, actor.Head}; --Piority order
8+
local parts = {actor.BGArm, actor.BGLeg, actor.FGArm, actor.FGLeg, actor.Head}; --Priority order
99
local mostWounds = -1;
1010
local detachLimb;
1111
--Pick the limb with most wounds and detach it
@@ -41,8 +41,8 @@ function HumanFunctions.DoArmSway(actor, pushStrength)
4141
actor.lastHandPos = {actor.Pos, actor.Pos};
4242
end
4343
--Flail around if aiming around too fast
44-
local ang = actor.lastAngle - aimAngle;
45-
actor.AngularVel = actor.AngularVel - (2 * ang * actor.FlipFactor)/(math.abs(actor.AngularVel)/10 + 1);
44+
local angleMovement = actor.lastAngle - aimAngle;
45+
actor.AngularVel = actor.AngularVel - (2 * angleMovement * actor.FlipFactor)/(math.abs(actor.AngularVel)/10 + 1);
4646
actor.lastAngle = aimAngle;
4747
--Shove when unarmed
4848
if actor.controller:IsState(Controller.WEAPON_FIRE) and (actor.FGArm or actor.BGArm) and not (actor.EquippedItem or actor.EquippedBGItem) and actor.Status == Actor.STABLE then

Base.rte/AI/NativeHumanAI.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ function NativeHumanAI:Update(Owner)
279279
elseif FoundMO.ClassName == "ACDropShip" then
280280
FoundMO = ToACDropShip(FoundMO)
281281
elseif FoundMO.ClassName == "ADoor" and ToADoor(FoundMO).Door and ToADoor(FoundMO).Door:IsAttached()
282-
and (Owner:EquipNamedDevice("Heavy Digger", true) or (Owner.FirearmIsReady and HumanBehaviors.GetProjectileData(Owner).pen > ToADoor(FoundMO).Door.Material.StructuralIntegrity)) then
282+
and (Owner:EquipNamedDevice("Heavy Digger", true) or (Owner.FirearmIsReady and HumanBehaviors.GetProjectileData(Owner).pen * 0.9 > ToADoor(FoundMO).Door.Material.StructuralIntegrity)) then
283283
FoundMO = ToADoor(FoundMO)
284284
elseif FoundMO.ClassName == "Actor" then
285285
FoundMO = ToActor(FoundMO)
@@ -723,8 +723,8 @@ function NativeHumanAI:CreateAttackBehavior(Owner)
723723
self.NextBehavior = coroutine.create(HumanBehaviors.AttackTarget)
724724
self.NextBehaviorName = "AttackTarget"
725725
-- favor grenades as the initiator to a sneak attack
726-
elseif Owner.AIMode ~= Actor.AIMODE_SQUAD and Owner.AIMode ~= Actor.AIMODE_SENTRY and self.Target.HFlipped == Owner.HFlipped and Owner:EquipDeviceInGroup("Bombs - Grenades", true) and
727-
dist > 100 and dist < ToThrownDevice(Owner.EquippedItem).MaxThrowVel * 20 and (self.Target.Pos.Y + 20) > Owner.Pos.Y then
726+
elseif Owner.AIMode ~= Actor.AIMODE_SQUAD and Owner.AIMode ~= Actor.AIMODE_SENTRY and self.Target.HFlipped == Owner.HFlipped and Owner:EquipDeviceInGroup("Bombs - Grenades", true)
727+
and dist > 100 and dist < ToThrownDevice(Owner.EquippedItem).MaxThrowVel * 20 and (self.Target.Pos.Y + 20) > Owner.Pos.Y then
728728
self.NextBehavior = coroutine.create(HumanBehaviors.ThrowTarget)
729729
self.NextBehaviorName = "ThrowTarget"
730730
elseif Owner:EquipFirearm(true) then

Base.rte/Activities/OneManArmyDiggers.lua

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -233,21 +233,10 @@ function OneManArmy:UpdateActivity()
233233

234234
--Spawn the AI.
235235
if self.CPUTeam ~= Activity.NOTEAM and self.ESpawnTimer:LeftTillSimMS(self.TimeLeft) <= 0 and MovableMan:GetTeamMOIDCount(self.CPUTeam) <= rte.AIMOIDMax * 3 / self:GetActiveCPUTeamCount() then
236-
local ship, actorsInCargo
237-
238-
if math.random() < 0.5 then
239-
-- Set up the ship to deliver this stuff
240-
ship = RandomACDropShip("Any", self.CPUTechName);
241-
-- If we can't afford this dropship, then try a rocket instead
242-
if ship:GetTotalValue(0,3) > self:GetTeamFunds(self.CPUTeam) then
243-
DeleteEntity(ship);
244-
ship = RandomACRocket("Any", self.CPUTechName);
245-
end
246-
actorsInCargo = ship.MaxPassengers
247-
else
248-
ship = RandomACRocket("Any", self.CPUTechName);
249-
actorsInCargo = math.min(ship.MaxPassengers, 2)
250-
end
236+
237+
-- Set up the ship to deliver this stuff
238+
local ship = RandomACRocket("Any", self.CPUTechName);
239+
local actorsInCargo = math.min(ship.MaxPassengers, 2)
251240

252241
ship.Team = self.CPUTeam;
253242

Base.rte/Actors/Infantry/GreenDummy/GreenDummy.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ AddActor = AHuman
727727
Description = TradeStar's factory worker unit. Agile, but not fit for warfare!
728728
AddToGroup = Actors
729729
AddToGroup = Actors - Light
730-
AddToGroup = Actors - Heavy
731730
Mass = 34
732731
GoldValue = 45
733732
HitsMOs = 1

Base.rte/Actors/Mecha/Medic/Medic.lua

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,40 @@
11
function Create(self)
22
self.healTimer = Timer();
3-
self.baseHealDelay = 100;
4-
self.healIncrementPerTarget = 50;
3+
self.baseHealDelay = 150;
4+
self.healIncrementPerTarget = 100;
5+
self.healIncrementPerWound = 50;
56
self.healTimer:SetSimTimeLimitMS(self.baseHealDelay);
67
self.crossTimer = Timer();
78
self.crossTimer:SetSimTimeLimitMS(800);
89

9-
self.healRange = 100 + self.Radius;
10+
self.colors = {135, 133, 149, 148, 145};
11+
self.maxHealRange = 100 + self.Radius;
1012
self.healStrength = 1;
1113
self.healTargets = {};
1214
end
13-
1415
function Update(self)
15-
if self.healTimer:IsPastSimTimeLimit() then
16-
self.healTimer:Reset();
17-
local parent = self:GetParent();
18-
if parent and IsActor(parent) then
19-
parent = ToActor(parent);
16+
local parent = self:GetParent();
17+
if parent and IsActor(parent) then
18+
parent = ToActor(parent);
19+
local healRange = self.maxHealRange * (1 - (self.WoundCount/self.GibWoundLimit));
20+
if (parent:IsPlayerControlled() and parent:GetController():IsState(Controller.WEAPON_FIRE)) or #self.healTargets > 0 then
21+
local screen = ActivityMan:GetActivity():ScreenOfPlayer(parent:GetController().Player);
22+
if screen ~= -1 then
23+
PrimitiveMan:DrawCirclePrimitive(screen, self.Pos, healRange, self.colors[math.random(#self.colors)]);
24+
for i = 1, math.random(10, 20) do
25+
local vector = Vector(healRange, 0):RadRotate(6.28 * math.random());
26+
PrimitiveMan:DrawLinePrimitive(screen, self.Pos + vector * RangeRand(0.66, 0.99), self.Pos + vector, self.colors[math.random(#self.colors)]);
27+
end
28+
end
29+
end
30+
if self.healTimer:IsPastSimTimeLimit() then
31+
self.healTimer:Reset();
2032
for i = 1, #self.healTargets do
2133
local targetFound = false;
2234
local healTarget = self.healTargets[i];
2335
if healTarget and IsActor(healTarget) and (healTarget.Health < healTarget.MaxHealth or healTarget.TotalWoundCount > 0) and healTarget.Vel.Largest < 10 then
2436
local trace = SceneMan:ShortestDistance(self.Pos, healTarget.Pos, false);
25-
if (trace.Magnitude - healTarget.Radius) < self.healRange then
37+
if (trace.Magnitude - healTarget.Radius) < healRange then
2638
if SceneMan:CastObstacleRay(self.Pos, trace, Vector(), Vector(), parent.ID, parent.IgnoresWhichTeam, rte.grassID, 5) < 0 then
2739
targetFound = true;
2840
end
@@ -49,14 +61,14 @@ function Update(self)
4961
for act in MovableMan.Actors do
5062
if act.Team == parent.Team and act.ID ~= parent.ID and (act.Health < act.MaxHealth or act.TotalWoundCount > 0) and act.Vel.Largest < 5 then
5163
local trace = SceneMan:ShortestDistance(self.Pos, act.Pos, false);
52-
if (trace.Magnitude - act.Radius) < (self.healRange * 0.9) then
53-
if SceneMan:CastObstacleRay(self.Pos, trace, Vector(), Vector(), parent.ID, parent.IgnoresWhichTeam, 0, 3) < 0 then
64+
if (trace.Magnitude - act.Radius) < (healRange * 0.9) then
65+
if SceneMan:CastObstacleRay(self.Pos, trace, Vector(), Vector(), parent.ID, parent.IgnoresWhichTeam, rte.airID, 3) < 0 then
5466
table.insert(self.healTargets, act);
5567
end
5668
end
5769
end
5870
end
59-
self.healTimer:SetSimTimeLimitMS(self.baseHealDelay + (#self.healTargets * self.healIncrementPerTarget));
71+
self.healTimer:SetSimTimeLimitMS(self.baseHealDelay + (self.healIncrementPerWound * self.WoundCount) + (#self.healTargets * self.healIncrementPerTarget));
6072
end
6173
end
6274
end

Base.rte/Craft/Shared/ScuttleExplosions.lua

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ function Create(self)
44
self.height = ToMOSprite(self):GetSpriteHeight();
55
self.width = ToMOSprite(self):GetSpriteWidth();
66

7-
self.explosiondelay = 5000/math.sqrt(self.width + self.height);
7+
if self:NumberValueExists("ScuttleExplosionDelay") then
8+
self.explosionDelay = self:GetNumberValue("ScuttleExplosionDelay");
9+
else
10+
self.explosionDelay = 5000/math.sqrt(self.width + self.height);
11+
end
812
end
913
function Update(self)
1014
if self.Status > Actor.INACTIVE or self.AIMode == Actor.AIMODE_SCUTTLE then
11-
if self.explosionTimer:IsPastSimMS(self.explosiondelay) then
15+
if self.explosionTimer:IsPastSimMS(self.explosionDelay) then
1216
self.explosionTimer:Reset();
13-
local expl = CreateAEmitter("Scuttle Explosion");
14-
expl.Pos = self.Pos + Vector(self.width/2 * RangeRand(-0.9, 0.9), self.height/2 * RangeRand(-0.9, 0.9)):RadRotate(self.RotAngle);
15-
expl.Vel = self.Vel;
16-
MovableMan:AddParticle(expl);
17+
local explosion = CreateAEmitter("Scuttle Explosion");
18+
explosion.Pos = self.Pos + Vector(self.width/2 * RangeRand(-0.9, 0.9), self.height/2 * RangeRand(-0.9, 0.9)):RadRotate(self.RotAngle);
19+
explosion.Vel = self.Vel;
20+
MovableMan:AddParticle(explosion);
1721
end
1822
end
1923
end

Base.rte/Craft/StorageCrate/DropCrate.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function Create(self)
44
-- Choose a random horizontal direction
55
local randomDirection = math.random() > 0.5 and 1 or -1;
66
-- Randomize velocities
7-
self.RotAngle = math.random() * (math.pi * 2);
7+
self.RotAngle = RangeRand(0, math.pi * 2);
88
self.AngularVel = -randomDirection * math.random(1, 10);
99
self.Pos = Vector(self.Pos.X - randomDirection * math.random(99), self.Pos.Y);
1010
-- Try not to fly off the edge in non-wrapping scenes

Base.rte/Devices/Explosives/RemoteExplosive/RemoteExplosive.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ AddDevice = HDFirearm
6464
CopyOf = Dent Metal
6565
ExitWound = AEmitter
6666
CopyOf = Dent Metal
67-
GoldValue = 25
67+
GoldValue = 10
6868
AtomGroup = AtomGroup
6969
AutoGenerate = 1
7070
Material = Material

Base.rte/Devices/Tools/Constructor/ConstructorCollect.lua

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ function Create(self)
33
self.speed = 8;
44

55
self.ToSettle = false;
6-
if self.Sharpness > -1 then
7-
for i = 1, MovableMan:GetMOIDCount()-1 do
8-
local mo = MovableMan:GetMOFromID(i);
9-
if mo.UniqueID == self.Sharpness then
10-
self.target = mo;
11-
self.Sharpness = 0;
12-
self.PinStrength = 0;
13-
break;
14-
end
6+
if self.Sharpness ~= rte.NoMOID then
7+
local mo = MovableMan:GetMOFromID(i);
8+
if mo then
9+
self.target = mo;
10+
self.Sharpness = 0;
11+
self.PinStrength = 0;
1512
end
1613
else
1714
self.ToDelete = true;

0 commit comments

Comments
 (0)