Skip to content

Commit

Permalink
Merge branch 'master' into hook-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
thecraftianman committed Dec 27, 2023
2 parents 4f928af + 29d2d5b commit 498d1da
Show file tree
Hide file tree
Showing 61 changed files with 695 additions and 159 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/GLuaFixer.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/GLuaLint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: GLuaLint

on:
push:
paths:
- 'lua/**'
pull_request:
paths:
- 'lua/**'

jobs:
Lint:
uses: FPtje/GLuaFixer/.github/workflows/glualint.yml@master
with:
config: "./.glualint.json"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Armored Combat Framework 3: Missiles

[![Linter Status](https://img.shields.io/github/actions/workflow/status/TwistedTail/ACF-3-Missiles/GLuaFixer.yml?label=Linter%20Status&style=flat-square)](https://github.com/TwistedTail/ACF-3-Missiles/actions?query=workflow%3AGLuaFixer)
[![Linter Status](https://img.shields.io/github/actions/workflow/status/TwistedTail/ACF-3-Missiles/GLuaLint.yml?label=Linter%20Status&style=flat-square)](https://github.com/TwistedTail/ACF-3-Missiles/actions?query=workflow%3AGLuaLint)
[![Repository Size](https://img.shields.io/github/repo-size/TwistedTail/ACF-3-Missiles?label=Repository%20Size&style=flat-square)](https://github.com/TwistedTail/ACF-3-Missiles)
[![Commit Activity](https://img.shields.io/github/commit-activity/m/TwistedTail/ACF-3-Missiles?label=Commit%20Activity&style=flat-square)](https://github.com/TwistedTail/ACF-3-Missiles/commits/master)

Expand Down
4 changes: 0 additions & 4 deletions lua/acf/core/acfm_globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ game.AddParticles("particles/flares_fx.pcf")

PrecacheParticleSystem("ACFM_Flare")

if SERVER then
resource.AddWorkshop("403587498")
end

do -- Update checker
hook.Add("ACF_OnLoadAddon", "ACF Missiles Update Checker", function()
ACF.AddRepository("TwistedTail", "ACF-3-Missiles", "lua/acf/core/acfm_globals.lua")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local NextUpdate = 0
local Entities = {}
local Ancestors = {}

local Whitelist = {
local Whitelist = {
-- Garry's Mod entities
gmod_wheel = true,
gmod_hoverball = true,
Expand Down Expand Up @@ -50,6 +50,8 @@ local function GetAncestor(Entity)
end

local function UpdateValues(Entity)
if not IsValid(Entity) then return end

local PhysObj = Entity:GetPhysicsObject()
local Velocity = Entity:GetVelocity()
local PrevPos = Entity.Position
Expand Down
File renamed without changes.
File renamed without changes.
48 changes: 32 additions & 16 deletions lua/acf/entities/components/computers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,16 @@ do -- Joystick
Entity.Spread = 1 - math.Round(Entity.ACF.Health / Entity.ACF.MaxHealth, 2)
end,
OnEnabled = function(Entity)
if Entity.Inputs.InputPitch.Path then
Entity:TriggerInput("Pitch", Entity.Inputs.InputPitch.Value)
local Inputs = Entity.Inputs
local Pitch = Inputs.InputPitch
local Yaw = Inputs.InputYaw

if Pitch and Pitch.Path then
Entity:TriggerInput("Pitch", Pitch.Value)
end

if Entity.Inputs.InputYaw.Path then
Entity:TriggerInput("Yaw", Entity.Inputs.InputYaw.Value)
if Yaw and Yaw.Path then
Entity:TriggerInput("Yaw", Yaw.Value)
end
end,
OnDisabled = function(Entity)
Expand Down Expand Up @@ -381,12 +385,16 @@ do -- Optical guidance computer
Entity.Spread = 1 - math.Round(Entity.ACF.Health / Entity.ACF.MaxHealth, 2)
end,
OnEnabled = function(Entity)
if Entity.Inputs.InputPitch.Path then
Entity:TriggerInput("Pitch", Entity.Inputs.InputPitch.Value)
local Inputs = Entity.Inputs
local Pitch = Inputs.InputPitch
local Yaw = Inputs.InputYaw

if Pitch and Pitch.Path then
Entity:TriggerInput("Pitch", Pitch.Value)
end

if Entity.Inputs.InputYaw.Path then
Entity:TriggerInput("Yaw", Entity.Inputs.InputYaw.Value)
if Yaw and Yaw.Path then
Entity:TriggerInput("Yaw", Yaw.Value)
end
end,
OnDisabled = function(Entity)
Expand Down Expand Up @@ -502,6 +510,7 @@ do -- Laser guidance computer
OnUpdate = function(Entity, _, _, Computer)
Entity.IsComputer = true
Entity.Lasing = false
Entity.Offset = Computer.Offset
Entity.OnCooldown = false
Entity.HitPos = Vector()
Entity.Distance = 0
Expand Down Expand Up @@ -591,16 +600,21 @@ do -- Laser guidance computer
Entity.Spread = 1 - math.Round(Entity.ACF.Health / Entity.ACF.MaxHealth, 2)
end,
OnEnabled = function(Entity)
if Entity.Inputs.Lase.Path then
Entity:TriggerInput("Lase", Entity.Inputs.Lase.Value)
local Inputs = Entity.Inputs
local Lase = Inputs.Lase
local Pitch = Inputs.InputPitch
local Yaw = Inputs.InputYaw

if Lase and Lase.Path then
Entity:TriggerInput("Lase", Lase.Value)
end

if Entity.Inputs.InputPitch.Path then
Entity:TriggerInput("Pitch", Entity.Inputs.InputPitch.Value)
if Pitch and Pitch.Path then
Entity:TriggerInput("Pitch", Pitch.Value)
end

if Entity.Inputs.InputYaw.Path then
Entity:TriggerInput("Yaw", Entity.Inputs.InputYaw.Value)
if Yaw and Yaw.Path then
Entity:TriggerInput("Yaw", Yaw.Value)
end
end,
OnDisabled = function(Entity)
Expand Down Expand Up @@ -771,8 +785,10 @@ do -- GPS transmitter
Entity.Spread = ACF.MaxDamageInaccuracy * (1 - math.Round(Entity.ACF.Health / Entity.ACF.MaxHealth, 2))
end,
OnEnabled = function(Entity)
if Entity.Inputs.Coordinates.Path then
Entity:TriggerInput("Coordinates", Entity.Inputs.Coordinates.Value)
local Coordinates = Entity.Inputs.Coordinates

if Coordinates and Coordinates.Path then
Entity:TriggerInput("Coordinates", Coordinates.Value)
end
end,
OnDisabled = function(Entity)
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/entities/missiles/asm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Missiles.RegisterItem("AGM-114 ASM", "ATGM", {
Year = 1984,
ReloadTime = 30,
ExhaustPos = Vector(-29),
Racks = { ["1xRK"] = true, ["2x AGM-114"] = true, ["4x AGM-114"] = true },
Racks = { ["1xRK"] = true, ["1xRK_small"] = true, ["2x AGM-114"] = true, ["4x AGM-114"] = true },
Guidance = { Dumb = true, Laser = true },
Navigation = "PN",
Fuzes = { Contact = true },
Expand Down Expand Up @@ -276,7 +276,7 @@ Missiles.RegisterItem("AT-2 ASM", "ATGM", {
Navigation = "Chase",
Fuzes = { Contact = true },
ViewCone = 90,
Agility = 0.00008,
Agility = 0.00035,
ArmDelay = 0.1,
Round = {
Model = "models/missiles/at2.mdl",
Expand Down
50 changes: 25 additions & 25 deletions lua/acf/entities/missiles/ffar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ Missiles.RegisterItem("40mmFFAR", "FFAR", {
FuelConsumption = 0.015, -- in g/s/f
StarterPercent = 0.1,
MaxAgilitySpeed = 1, -- in m/s
DragCoef = 0.0005,
FinMul = 0.01,
DragCoef = 0.004,
FinMul = 0,
GLimit = 1,
TailFinMul = 0.004,
TailFinMul = 0.05,
PenMul = 0.91,
ActualLength = 60,
ActualWidth = 4
Expand Down Expand Up @@ -73,14 +73,14 @@ Missiles.RegisterItem("57mmFFAR", "FFAR", {
Armor = 2,
ProjLength = 35,
PropLength = 50,
Thrust = 210000, -- in kg*in/s^2
FuelConsumption = 0.015,
Thrust = 113000, -- in kg*in/s^2
FuelConsumption = 0.0095, -- S5 rocket motors burn for 1.1 seconds not 0.333
StarterPercent = 0.2,
MaxAgilitySpeed = 1,
DragCoef = 0.0007,
FinMul = 0.01,
DragCoef = 0.007,
FinMul = 0.003,
GLimit = 1,
TailFinMul = 0.003,
TailFinMul = 0.005,
PenMul = 1.3,
ActualLength = 85,
ActualWidth = 5.7,
Expand Down Expand Up @@ -114,14 +114,14 @@ Missiles.RegisterItem("70mmFFAR", "FFAR", {
Armor = 2,
ProjLength = 66,
PropLength = 40,
Thrust = 850000, -- in kg*in/s^2
Thrust = 128500, -- in kg*in/s^2 -- Why was old thrust 1565m/s
FuelConsumption = 0.005, -- in g/s/f
StarterPercent = 0.1,
MaxAgilitySpeed = 1, -- in m/s
DragCoef = 0.002,
FinMul = 0.01,
DragCoef = 0.004,
FinMul = 0,
GLimit = 1,
TailFinMul = 0.005,
TailFinMul = 0.04,
PenMul = 0.85,
ActualLength = 106,
ActualWidth = 7
Expand Down Expand Up @@ -155,14 +155,14 @@ Missiles.RegisterItem("80mmFFAR", "FFAR", {
Armor = 2,
ProjLength = 76,
PropLength = 51,
Thrust = 700000, -- in kg*in/s^2
FuelConsumption = 0.006, -- in g/s/f
StarterPercent = 0.1,
Thrust = 290000, -- in kg*in/s^2
FuelConsumption = 0.0044, -- in g/s/f -- 1.55 not 0.53
StarterPercent = 0.191,
MaxAgilitySpeed = 1, -- in m/s
DragCoef = 0.0023,
FinMul = 0.01,
DragCoef = 0.023,
FinMul = 0.003,
GLimit = 1,
TailFinMul = 0.005,
TailFinMul = 0.08,
PenMul = 0.85,
ActualLength = 127,
ActualWidth = 8
Expand All @@ -181,7 +181,7 @@ Missiles.RegisterItem("Zuni ASR", "FFAR", {
Mass = 45,
Length = 200,
Year = 1957,
ReloadTime = 10,
ReloadTime = 5,
ExhaustPos = Vector(-45),
Racks = { ["127mm4xPOD"] = true },
Guidance = { Dumb = true },
Expand All @@ -196,14 +196,14 @@ Missiles.RegisterItem("Zuni ASR", "FFAR", {
Armor = 2,
ProjLength = 90,
PropLength = 110,
Thrust = 1900000, -- in kg*in/s^2
FuelConsumption = 0.010, -- in g/s/f
StarterPercent = 0.1,
Thrust = 663000, -- in kg*in/s^2
FuelConsumption = 0.0098, -- in g/s/f
StarterPercent = 0.235,
MaxAgilitySpeed = 1, -- in m/s
DragCoef = 0.004,
FinMul = 0.005,
DragCoef = 0.002,
FinMul = 0.002,
GLimit = 1,
TailFinMul = 0.004,
TailFinMul = 0.08,
PenMul = 1,
ActualLength = 200,
ActualWidth = 12.7
Expand Down
24 changes: 12 additions & 12 deletions lua/acf/entities/missiles/uar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ Missiles.RegisterItem("RS82 ASR", "UAR", {
StarterPercent = 0.15,
MaxAgilitySpeed = 1, -- in m/s
DragCoef = 0.001,
FinMul = 0.01,
FinMul = 0,
GLimit = 1,
TailFinMul = 0.05,
TailFinMul = 0.4,
PenMul = 0.8,
CanDelayLaunch = true,
ActualLength = 60,
Expand Down Expand Up @@ -93,10 +93,10 @@ Missiles.RegisterItem("HVAR ASR", "UAR", {
FuelConsumption = 0.016, -- in g/s/f
StarterPercent = 0.15,
MaxAgilitySpeed = 1, -- in m/s
DragCoef = 0.005,
FinMul = 0.01,
DragCoef = 0.019,
FinMul = 0,
GLimit = 1,
TailFinMul = 0.075,
TailFinMul = 0.844,
PenMul = 1.148,
FillerMul = 1,
LinerMassMul = 1,
Expand Down Expand Up @@ -125,7 +125,7 @@ Missiles.RegisterItem("SPG-9 ASR", "UAR", {
Navigation = "Chase",
Fuzes = { Contact = true },
Agility = 1,
ArmDelay = 0.1,
ArmDelay = 0, -- :)
Round = {
Model = "models/missiles/rs82.mdl",
RackModel = "models/missiles/rs82.mdl",
Expand All @@ -135,12 +135,12 @@ Missiles.RegisterItem("SPG-9 ASR", "UAR", {
PropLength = 67.8,
Thrust = 180000, -- in kg*in/s^2
FuelConsumption = 0.03, -- in g/s/f
StarterPercent = 0.1,
StarterPercent = 0.4,
MaxAgilitySpeed = 1, -- in m/s
DragCoef = 0.002,
FinMul = 0.01,
FinMul = 0,
GLimit = 1,
TailFinMul = 0.023,
TailFinMul = 0.06,
PenMul = 2.273,
FillerMul = 1.06,
LinerMassMul = 2.8,
Expand Down Expand Up @@ -182,7 +182,7 @@ Missiles.RegisterItem("S-24 ASR", "UAR", {
StarterPercent = 0.15,
MaxAgilitySpeed = 1, -- in m/s
DragCoef = 0.01,
FinMul = 0.1,
FinMul = 0,
GLimit = 1,
TailFinMul = 0.3,
PenMul = 1.05,
Expand Down Expand Up @@ -210,7 +210,7 @@ Missiles.RegisterItem("RW61 ASR", "UAR", {
Navigation = "Chase",
Fuzes = { Contact = true, Optical = true },
Agility = 1,
ArmDelay = 0.5,
ArmDelay = 0.2,
Round = {
Model = "models/missiles/RW61M.mdl",
RackModel = "models/missiles/RW61M.mdl",
Expand All @@ -225,7 +225,7 @@ Missiles.RegisterItem("RW61 ASR", "UAR", {
DragCoef = 0.02,
FinMul = 0,
GLimit = 1,
TailFinMul = 10,
TailFinMul = 38.25,
PenMul = 1.2,
ActualLength = 150,
ActualWidth = 38
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions lua/acf/entities/sensors/receiver_menu_cl.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
local ACF = ACF
local Text = "Mass : %s kg\n"

function ACF.CreateReceiverMenu(Data, Menu)

Menu:AddLabel(Text:format(Data.Mass))

ACF.SetClientData("PrimaryClass", "acf_receiver")
end
Loading

0 comments on commit 498d1da

Please sign in to comment.