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

Commit 578ef18

Browse files
committed
Preliminary tweaks to global scripts
1 parent f7a4932 commit 578ef18

File tree

5 files changed

+94
-121
lines changed

5 files changed

+94
-121
lines changed
Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
function BetterJetpacksScript:StartScript()
2-
self.Multiplier = 1.75
2+
self.multiplier = 1.5;
33
end
44

55
function BetterJetpacksScript:UpdateScript()
6-
--print ("BetterJetpacksScript:UpdateScript()")
7-
86
for actor in MovableMan.Actors do
97
if not actor:NumberValueExists("BetterJetpacksScript") then
10-
actor:SetNumberValue("BetterJetpacksScript", 1)
11-
8+
actor:SetNumberValue("BetterJetpacksScript", 1);
129
if IsAHuman(actor) then
13-
local human = ToAHuman(actor)
14-
if human then
15-
local jetpack = human.Jetpack
16-
if jetpack then
17-
for em in jetpack.Emissions do
18-
em.ParticlesPerMinute = em.ParticlesPerMinute * self.Multiplier
19-
end
10+
local human = ToAHuman(actor);
11+
human.JetTimeTotal = human.JetTimeTotal * self.multiplier;
12+
local jetpack = human.Jetpack;
13+
if jetpack then
14+
for em in jetpack.Emissions do
15+
em.ParticlesPerMinute = em.ParticlesPerMinute * self.multiplier;
16+
em.BurstSize = em.BurstSize * self.multiplier;
2017
end
2118
end
2219
end
@@ -25,13 +22,10 @@ function BetterJetpacksScript:UpdateScript()
2522
end
2623

2724
function BetterJetpacksScript:EndScript()
28-
--print ("BetterJetpacksScript:UpdateScript()")
2925
end
3026

3127
function BetterJetpacksScript:PauseScript()
32-
--print ("BetterJetpacksScript:UpdateScript()")
3328
end
3429

3530
function BetterJetpacksScript:CraftEnteredOrbit()
36-
--print ("BetterJetpacksScript:UpdateScript()")
3731
end
Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
function FriendlyFireScript:StartScript()
2-
--print ("FriendlyFireScript Create")
2+
-- Amount of frames the particles still ignore teammates for
3+
self.frames = 6;
4+
self.minAge = 17 * self.frames;
5+
-- Default settings are approximately according to squad sizes
6+
self.updateTimer = Timer();
37
end
4-
58
function FriendlyFireScript:UpdateScript()
6-
for actor in MovableMan.Actors do
7-
if not actor:NumberValueExists("FriendlyFireScript") then
8-
actor:SetNumberValue("FriendlyFireScript", 1)
9-
actor.IgnoresTeamHits = false
9+
if self.updateTimer:IsPastSimMS(50) then
10+
self.updateTimer:Reset();
11+
for part in MovableMan.Particles do
12+
if part.HitsMOs == true and part.Team ~= -1 then
13+
if part.Age > self.minAge / (1 + part.Vel.Magnitude / 100) then
14+
part.Team = -1; -- Hit everyone
15+
part.IgnoresTeamHits = false;
16+
end
17+
end
1018
end
1119
end
12-
end
13-
14-
function FriendlyFireScript:EndScript()
15-
--print ("FriendlyFireScript Destroy")
16-
end
17-
18-
function FriendlyFireScript:PauseScript()
19-
--print ("FriendlyFireScript Pause")
20-
end
21-
22-
function FriendlyFireScript:CraftEnteredOrbit()
23-
--print ("FriendlyFireScript Orbited")
24-
end
20+
end
Lines changed: 17 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,33 @@
11
function FragileUnitsScript:StartScript()
2-
--print ("FragileUnitsScript:StartScript()")
32
end
4-
53
function FragileUnitsScript:UpdateScript()
6-
--print ("FragileUnitsScript:UpdateScript()")
7-
84
for actor in MovableMan.Actors do
95
if not actor:NumberValueExists("FragileUnitsScript") then
10-
actor:SetNumberValue("FragileUnitsScript", 1)
11-
6+
actor:SetNumberValue("FragileUnitsScript", 1);
127
if IsAHuman(actor) then
13-
actor.GibWoundLimit = 1
14-
local human = ToAHuman(actor)
15-
if human then
16-
if human.Head then
17-
human.Head.GibWoundLimit = 1
18-
end
19-
if human.FGArm then
20-
human.FGArm.GibWoundLimit = 1
21-
end
22-
if human.BGArm then
23-
human.BGArm.GibWoundLimit = 1
24-
end
25-
if human.FGLeg then
26-
human.FGLeg.GibWoundLimit = 1
27-
end
28-
if human.BGLeg then
29-
human.BGLeg.GibWoundLimit = 1
8+
actor.GibWoundLimit = 1;
9+
local human = ToAHuman(actor);
10+
local parts = {human.Head, human.FGArm, human.BGArm, human.FGLeg, human.BGLeg};
11+
for i = 1, #parts do
12+
local part = parts[i];
13+
if part then
14+
part.GibWoundLimit = 1;
15+
part.JointStrength = 1;
3016
end
3117
end
3218
end
33-
3419
if IsACrab(actor) then
35-
actor.GibWoundLimit = 1
20+
actor.GibWoundLimit = 1;
3621
local crab = ToACrab(actor)
37-
if crab then
38-
if crab.Turret then
39-
crab.Turret.GibWoundLimit = 1
40-
end
41-
if crab.LFGLeg then
42-
crab.LFGLeg.GibWoundLimit = 1
43-
end
44-
if crab.RFGLeg then
45-
crab.RFGLeg.GibWoundLimit = 1
46-
end
47-
if crab.LBGLeg then
48-
crab.LBGLeg.GibWoundLimit = 1
49-
end
50-
if crab.RBGLeg then
51-
crab.RBGLeg.GibWoundLimit = 1
22+
local parts = {crab.Turret, crab.RFGLeg, crab.RBGLeg, crab.LFGLeg, crab.LBGLeg};
23+
for i = 1, #parts do
24+
local part = parts[i];
25+
if part then
26+
part.GibWoundLimit = 1;
27+
part.JointStrength = 1;
5228
end
5329
end
5430
end
5531
end
5632
end
57-
end
58-
59-
function FragileUnitsScript:EndScript()
60-
--print ("FragileUnitsScript:UpdateScript()")
61-
end
62-
63-
function FragileUnitsScript:PauseScript()
64-
--print ("FragileUnitsScript:UpdateScript()")
65-
end
66-
67-
function FragileUnitsScript:CraftEnteredOrbit()
68-
--print ("FragileUnitsScript:UpdateScript()")
69-
end
33+
end
Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,59 @@
11
function InfiniteAmmo:StartScript()
2-
self.Exclude = {}
3-
self.Exclude["Dihelical Cannon"] = true -- Endless shooting causes endless lag
4-
self.Exclude["Nucleo"] = true -- Can't shoot for whatever reasons
52
end
6-
73
function InfiniteAmmo:UpdateScript()
4+
local items = {};
85
for actor in MovableMan.Actors do
9-
if actor.ClassName == "AHuman" then
10-
local human = ToAHuman(actor)
11-
if human then
12-
if human.EquippedItem and human.EquippedItem.ClassName == "HDFirearm" and self.Exclude[human.EquippedItem.PresetName] == nil then
13-
local item = ToHDFirearm(human.EquippedItem)
14-
if item then
15-
local mag = item.Magazine
16-
if mag and mag.Capacity > 0 then
17-
mag.RoundCount = mag.Capacity
6+
local weapon;
7+
local item;
8+
if IsAHuman(actor) then
9+
item = ToAHuman(actor).EquippedItem;
10+
if item then
11+
if IsHDFirearm(item) then
12+
table.insert(items, ToHDFirearm(item));
13+
elseif IsTDExplosive(item) then
14+
local grenade = ToTDExplosive(item);
15+
if grenade:IsActivated() then
16+
local count = 0;
17+
for i = 1, actor.InventorySize do
18+
local potentialWep = actor:Inventory();
19+
if potentialWep.PresetName == grenade.PresetName then
20+
count = count + 1;
21+
end
22+
actor:SwapNextInventory(potentialWep, true);
23+
end
24+
if count == 0 then
25+
actor:AddInventoryItem(CreateTDExplosive(grenade:GetModuleAndPresetName()));
1826
end
1927
end
2028
end
2129
end
30+
local itemBG = ToAHuman(actor).EquippedBGItem;
31+
if itemBG and IsHDFirearm(itemBG)then
32+
table.insert(items, ToHDFirearm(itemBG));
33+
end
34+
elseif IsACrab(actor) then
35+
item = ToACrab(actor).EquippedItem;
36+
if item and IsHDFirearm(item) then
37+
table.insert(items, ToHDFirearm(item));
38+
end
2239
end
2340
end
24-
end
25-
26-
function InfiniteAmmo:EndScript()
27-
end
28-
29-
function InfiniteAmmo:PauseScript()
30-
end
31-
32-
function InfiniteAmmo:CraftEnteredOrbit()
33-
end
41+
-- Run this script for rogue weapons as well
42+
for item in MovableMan.Items do
43+
if IsHDFirearm(item) then
44+
table.insert(items, ToHDFirearm(item));
45+
end
46+
end
47+
for i = 1, #items do
48+
local weapon = items[i];
49+
if weapon and weapon.Magazine then
50+
-- Stop weapons like Dihelical Cannon from misbehaving
51+
if weapon.ActivationDelay > 0 and weapon:IsActivated() and weapon.Magazine.Capacity == 1 and weapon.Magazine.RoundCount == 0 then
52+
weapon:Deactivate();
53+
end
54+
if weapon.Magazine.RoundCount == 0 or not weapon:IsActivated() then
55+
weapon.Magazine.RoundCount = weapon.Magazine.Capacity;
56+
end
57+
end
58+
end
59+
end

Base.rte/Scripts/GlobalScripts.ini

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
AddGlobalScript = GlobalScript
66
PresetName = Fragile Units
7-
Description = All humans and crabs has minimum durability
7+
Description = All humans and crabs have minimum durability.
88
ScriptPath = Base.rte/Scripts/Global/FragileUnits.lua
99
LuaClassName = FragileUnitsScript
1010

@@ -32,7 +32,7 @@ AddGlobalScript = GlobalScript
3232

3333
AddGlobalScript = GlobalScript
3434
PresetName = Tough Craft
35-
Description = Crafts are nearly impossible to take down
35+
Description = Craft are nearly impossible to take down
3636
ScriptPath = Base.rte/Scripts/Global/ToughCraft.lua
3737
LuaClassName = ToughCraftsScript
3838

@@ -46,21 +46,14 @@ AddGlobalScript = GlobalScript
4646

4747
AddGlobalScript = GlobalScript
4848
PresetName = Enable Friendly Fire
49-
Description = Enable friendly fire (WARNING, this can make the game unplayable)
49+
Description = Enable friendly fire.
5050
ScriptPath = Base.rte/Scripts/Global/EnableFriendlyFire.lua
5151
LuaClassName = FriendlyFireScript
5252

5353

54-
AddGlobalScript = GlobalScript
55-
PresetName = Huge Jetpacks
56-
Description = Doubles jetpack fuel capacity
57-
ScriptPath = Base.rte/Scripts/Global/HugeJetpacks.lua
58-
LuaClassName = HugeJetpacksScript
59-
60-
6154
AddGlobalScript = GlobalScript
6255
PresetName = Better Jetpacks
63-
Description = Jetpack thrust is 75% greater.
56+
Description = Jetpack thrust and fuel capacity are 50% greater.
6457
ScriptPath = Base.rte/Scripts/Global/BetterJetpacks.lua
6558
LuaClassName = BetterJetpacksScript
6659

0 commit comments

Comments
 (0)