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

Commit 67032b4

Browse files
committed
Grapple Gun tweaks to: controls, sound, visual guide (ask for details)
Can now hang on its' own! To-do: clean the lua stuff because it is ugly?
1 parent 9a9dfaa commit 67032b4

File tree

7 files changed

+213
-211
lines changed

7 files changed

+213
-211
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

Base.rte/Devices/Tools/GrappleGun/Grapple.lua

Lines changed: 157 additions & 145 deletions
Large diffs are not rendered by default.

Base.rte/Devices/Tools/GrappleGun/GrappleGun.ini

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ AddAmmo = Magazine
118118
HitsMOs = 0
119119
GetsHitByMOs = 0
120120
SpriteFile = ContentFile
121-
FilePath = Base.rte/Devices/Tools/GrappleGun/Claw001.bmp
122-
FrameCount = 1
121+
FilePath = Base.rte/Devices/Tools/GrappleGun/Claw.bmp
122+
FrameCount = 2
123123
SpriteOffset = Vector
124124
X = -2
125125
Y = -7
@@ -207,7 +207,7 @@ AddDevice = HDFirearm
207207
SupportOffset = Vector
208208
X = 0
209209
Y = 5
210-
SharpLength = 250
210+
SharpLength = 200
211211
Magazine = Magazine
212212
CopyOf = Magazine Grapple Gun
213213
Flash = None
@@ -227,7 +227,7 @@ AddDevice = HDFirearm
227227
ReloadTime = 2000
228228
FullAuto = 0
229229
FireIgnoresThis = 1
230-
ShakeRange = 0
230+
ShakeRange = 1
231231
SharpShakeRange = 0
232232
NoSupportFactor = 0
233233
ParticleSpreadRange = 0
@@ -259,16 +259,6 @@ AddDevice = HDFirearm
259259
FilePath = Base.rte/Devices/Tools/GrappleGun/PieIcons/Extend.bmp
260260
ScriptPath = Base.rte/Devices/Tools/GrappleGun/Pie.lua
261261
FunctionName = GrapplePieExtend
262-
AddPieSlice = Slice
263-
Description = Stop
264-
Direction = 4
265-
Icon = Icon
266-
PresetName = Grapple Gun Stop
267-
FrameCount = 2
268-
BitmapFile = ContentFile
269-
FilePath = Base.rte/GUIs/PieIcons/Cancel.bmp
270-
ScriptPath = Base.rte/Devices/Tools/GrappleGun/Pie.lua
271-
FunctionName = GrapplePieStop
272262
AddGib = Gib
273263
GibParticle = MOPixel
274264
CopyOf = Spark Yellow 1

Base.rte/Devices/Tools/GrappleGun/GrappleGun.lua

Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,70 +8,77 @@ function Create(self)
88
self.tapTime = 200;
99
self.tapAmount = 2;
1010
self.guide = false;
11+
12+
self.arrow = CreateMOSRotating("Grapple Gun Guide Arrow");
1113
end
1214

1315
function Update(self)
14-
local actor = MovableMan:GetMOFromID(self.RootID);
15-
if actor and IsActor(actor) then
16-
self.parent = ToActor(actor);
17-
local ctrl = self.parent:GetController();
18-
if self.parent:IsPlayerControlled() and self.parent.Status < 2 then
19-
local mouse = ctrl:IsMouseControlled();
16+
local parent = self:GetRootParent();
17+
if parent and IsActor(parent) then
18+
if IsAHuman(parent) then
19+
parent = ToAHuman(parent)
20+
elseif IsACrab(parent) then
21+
parent = ToACrab(parent);
22+
else
23+
parent = ToActor(parent);
24+
end
25+
if parent:IsPlayerControlled() and parent.Status < Actor.DYING then
26+
local controller = parent:GetController();
27+
local mouse = controller:IsMouseControlled();
2028
-- Deactivate when equipped in BG arm to allow FG arm shooting
21-
if IsAHuman(self.parent) and ToAHuman(self.parent).EquippedBGItem then
22-
local itemBG = ToAHuman(self.parent).EquippedBGItem;
29+
if parent.EquippedBGItem and parent.EquippedItem then
30+
local itemBG = parent.EquippedBGItem;
2331
if itemBG.ID == self.ID then
2432
self:Deactivate();
2533
end
2634
end
27-
-- Alternatively you can tap Jump twice to grapple
28-
if ctrl:IsState(Controller.BODY_JUMPSTART) then
29-
if self.tapTimerJump:IsPastSimMS(self.tapTime) then
30-
self.tapTimerJump:Reset();
31-
else
32-
self:Activate();
35+
if self.Magazine then
36+
-- Double tapping crouch retrieves the hook
37+
if self.Magazine.Scale == 1 then
38+
if controller and controller:IsState(Controller.BODY_CROUCH) then
39+
if self.canTap then
40+
controller:SetState(Controller.BODY_CROUCH, false);
41+
self.tapTimerJump:Reset();
42+
self.didTap = true;
43+
self.canTap = false;
44+
self.tapCounter = self.tapCounter + 1;
45+
end
46+
else
47+
self.canTap = true;
48+
end
49+
if self.tapTimerJump:IsPastSimMS(self.tapTime) then
50+
self.tapCounter = 0;
51+
else
52+
if self.tapCounter >= self.tapAmount then
53+
self:Activate();
54+
self.tapCounter = 0;
55+
end
56+
end
3357
end
34-
end
35-
-- Tap sharp aim twice to toggle aim guide
36-
if ctrl:IsState(Controller.AIM_SHARP) then
37-
if mouse then
58+
-- A guide arrow appears at higher speeds
59+
if (self.Magazine.Scale == 0 and not controller:IsState(Controller.AIM_SHARP)) or parent.Vel.Magnitude > 6 then
3860
self.guide = true;
39-
elseif self.canTap == true then
40-
self.tapTimerAim:Reset();
41-
self.didTap = true;
42-
self.canTap = false;
43-
self.tapCounter = self.tapCounter + 1;
44-
end
45-
else
46-
self.canTap = true;
47-
if mouse then
61+
else
4862
self.guide = false;
4963
end
5064
end
51-
if self.tapTimerAim:IsPastSimMS(self.tapTime) then
52-
self.tapCounter = 0;
53-
else
54-
if self.tapCounter >= self.tapAmount then
55-
if self.guide == false then
56-
self.guide = true;
57-
else
58-
self.guide = false;
59-
end
60-
end
61-
end
62-
if self.guide == true then
65+
if self.guide then
6366
local frame = 0;
64-
if self.parent.Vel.Magnitude > 10 then
67+
if parent.Vel.Magnitude > 12 then
6568
frame = 1;
6669
end
67-
local startPos = (self.parent.Pos + self.parent.EyePos + self.Pos) / 3;
68-
local arrow = CreateMOSRotating("Grapple Gun Guide Arrow");
69-
local guidePos = startPos + Vector(self.parent.AimDistance + (self.parent.Vel.Magnitude), 0):RadRotate(self.parent:GetAimAngle(true));
70-
FrameMan:DrawBitmapPrimitive(self.parent.Team, guidePos, arrow, self.parent:GetAimAngle(true), frame);
70+
local startPos = (parent.Pos + parent.EyePos + self.Pos) / 3;
71+
local guidePos = startPos + Vector(parent.AimDistance + (parent.Vel.Magnitude), 0):RadRotate(parent:GetAimAngle(true));
72+
FrameMan:DrawBitmapPrimitive(ActivityMan:GetActivity():ScreenOfPlayer(controller.Player), guidePos, self.arrow, parent:GetAimAngle(true), frame);
7173
end
7274
else
7375
self:Deactivate();
74-
ctrl:SetState(Controller.AIM_SHARP, false);
76+
end
77+
self.StanceOffset = Vector(ToMOSprite(self:GetParent()):GetSpriteWidth(), 1);
78+
self.SharpStanceOffset = Vector(ToMOSprite(self:GetParent()):GetSpriteWidth(), 1);
79+
if self.Magazine then
80+
self.Magazine.Scale = 1;
81+
self.Magazine.Frame = 1;
7582
end
7683
end
7784
end

Base.rte/Devices/Tools/GrappleGun/Pie.lua

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,4 @@ function GrapplePieExtend(actor)
1010
if gun ~= nil then
1111
gun.Sharpness = 2;
1212
end
13-
end
14-
15-
function GrapplePieStop(actor)
16-
local gun = ToAHuman(actor).EquippedItem;
17-
if gun ~= nil then
18-
gun.Sharpness = 0;
19-
end
2013
end
Binary file not shown.

0 commit comments

Comments
 (0)