Skip to content

Commit

Permalink
V1.79 (#286)
Browse files Browse the repository at this point in the history
* Fix Additional RoF Errors

* Fix Major Bugs in Shield.lua

* Move OnDamage to QUIET Base Repo

* V1.79 Release Point & Changelog
  • Loading branch information
Azraeel authored Dec 30, 2024
1 parent 107041a commit 649e6cd
Show file tree
Hide file tree
Showing 10 changed files with 316 additions and 62 deletions.
10 changes: 10 additions & 0 deletions changelog/V1.79.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Game Balance & Game Patch Changelog

## Version 1.79 - 2024-12-30
### General Changes

- **General Changes**
- Fix Shield.lua Personal Shields initializing legacy code instead of the New Shield.lua Code
- Fix Shield.lua not carrying default values resulting in some Nil Values
- Shield.lua now applies to all Shield Types (Personal, Bubble, and etc) meaning that Personal Shields now interact correctly with AoE Weapons not allowing AoE to damage the base Health of the Unit. The Shield is now treated as an additional health layer to the Unit and no longer carries it's own collision sphere/box. Damage that overkills the shield now applies onto the base health of the unit.
- Fix Multiple Units with Rate Of Fire Errors (many having too short of Rate of Fires)
1 change: 1 addition & 0 deletions hook/lua/aeonweapons.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
--- /lua/aeonweapons.lua
--- Default definitions of Aeon weapons
--- Credit to Jip (FAF) for GC TractorClaw Rework
--- QUIET's First Overhaul, Courtesy of FAF!

local Entity = import('/lua/sim/Entity.lua').Entity
local Weapon = import('/lua/sim/weapon.lua').Weapon
Expand Down
84 changes: 43 additions & 41 deletions hook/lua/shield.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,25 @@ local IEffectOffsetEmitter = moho.IEffect.OffsetEmitter

local CategoriesOverspill = categories.SHIELD * categories.DEFENSE

-- default values for a shield specification table (to be passed to native code)
local DEFAULT_OPTIONS = {
Mesh = '',
MeshZ = '',
ImpactMesh = '',
ImpactEffects = '',
Size = 10,
ShieldMaxHealth = 250,
ShieldRechargeTime = 10,
ShieldEnergyDrainRechargeTime = 10,
ShieldVerticalOffset = -1,
ShieldRegenRate = 1,
ShieldRegenStartTime = 5,
PassOverkillDamage = false,

-- flags for mods
-- SkipAttachmentCheck = false, -- defaults to nil, same as false
}

LargestShieldDiameter = 0
for k, bp in __blueprints do
-- check for blueprints that have a shield and a shield size set
Expand All @@ -118,6 +137,9 @@ Shield = Class(QCEShield) {
--LOG("We've entered LCE Version of Shield.lua"),

__init = function(self, spec)
-- Apply default options
local spec = TableAssimilate(spec, DEFAULT_OPTIONS)

_c_CreateShield(self, spec)
end,

Expand Down Expand Up @@ -152,7 +174,7 @@ Shield = Class(QCEShield) {
self.OffHealth = -1

-- copy over information from specifiaction
self.Size = spec.Size or 10
self.Size = spec.Size
self.Owner = spec.Owner
self.MeshBp = spec.Mesh
self.MeshZBp = spec.MeshZ
Expand Down Expand Up @@ -323,11 +345,6 @@ Shield = Class(QCEShield) {
local brain = self.Brain
local position = EntityGetPosition(self.Owner)

-- Safety Check for nil shield size
if self.Size == nil then
self.Size = 10
end

-- diameter where other shields overlap with us or are contained by us
local diameter = LargestShieldDiameter + self.Size

Expand Down Expand Up @@ -428,10 +445,18 @@ Shield = Class(QCEShield) {
end,

GetOverkill = function(self,instigator,amount,type)
-- Like armor damage, first multiply by armor reduction, then apply handicap
-- See SimDamage.cpp (DealDamage function) for how this should work
amount = amount * (self.Owner:GetArmorMult(type))
amount = amount * (1.0 - ArmyGetHandicap(self.Army))
local finalVal = amount - EntityGetHealth(self)
if finalVal < 0 or type == "FAF_AntiShield" then
finalVal = 0
end
return finalVal
end,

OnDamage = function(self, instigator, amount, vector, damageType)

-- only applies to trees
if damageType == "TreeForce" or damageType == "TreeFire" then
return
Expand Down Expand Up @@ -499,13 +524,9 @@ Shield = Class(QCEShield) {
-- do damage logic for shield

if self.Owner ~= instigator then
--LOG("Calling OnGetDamageAbsorption")
local absorbed = self:OnGetDamageAbsorption(instigator, amount, dmgType)

-- Safety Check for nil shield size
if self.Size == nil then
self.Size = 10
end

-- take some damage
EntityAdjustHealth(self, instigator, -absorbed)

Expand Down Expand Up @@ -580,7 +601,6 @@ Shield = Class(QCEShield) {
end,

RegenStartThread = function(self)

local AdjustHealth = AdjustHealth
local GetHealth = GetHealth
local GetMaxHealth = GetMaxHealth
Expand Down Expand Up @@ -616,7 +636,6 @@ Shield = Class(QCEShield) {
end,

CreateImpactEffect = function(self, vector)

if IsDestroyed(self) then
return
end
Expand Down Expand Up @@ -751,12 +770,6 @@ Shield = Class(QCEShield) {
end,

CreateShieldMesh = function(self)

-- Safety Check for nil shield size
if self.Size == nil then
self.Size = 10
end

local vec = VectorCached
vec[1] = 0
vec[2] = self.ShieldVerticalOffset
Expand Down Expand Up @@ -821,7 +834,6 @@ Shield = Class(QCEShield) {
OnState = State {

Main = function(self)

local GetHealth = GetHealth
local GetMaxHealth = GetMaxHealth
local GetResourceConsumed = moho.unit_methods.GetResourceConsumed
Expand Down Expand Up @@ -888,7 +900,6 @@ Shield = Class(QCEShield) {
OffState = State {

Main = function(self)

self.Enabled = false

-- No regen during off state
Expand Down Expand Up @@ -920,7 +931,6 @@ Shield = Class(QCEShield) {
DamageRechargeState = State {

Main = function(self)

-- No regen during off state
if self.RegenThread then
KillThread(self.RegenThread)
Expand Down Expand Up @@ -948,7 +958,6 @@ Shield = Class(QCEShield) {
EnergyDrainRechargeState = State {

Main = function(self)

-- No regen during off state
if self.RegenThread then
KillThread(self.RegenThread)
Expand Down Expand Up @@ -992,8 +1001,9 @@ Shield = Class(QCEShield) {
}

-- Unit shields typically hug the shape of the unit
QCEUnitShield = UnitShield
UnitShield = Class(QCEUnitShield){
UnitShield = Class(Shield){

RemainEnabledWhenAttached = true,

OnCreate = function(self,spec)

Expand Down Expand Up @@ -1032,8 +1042,9 @@ UnitShield = Class(QCEUnitShield){
end,

CreateShieldMesh = function(self)

self:SetCollisionShape( 'Box', self.CollisionCenterX, self.CollisionCenterY, self.CollisionCenterZ, self.CollisionSizeX, self.CollisionSizeY, self.CollisionSizeZ)
-- Personal shields (unit shields) don't handle collisions anymore.
-- This is done in the Unit's OnDamage function instead.
self:SetCollisionShape('None')

self.Owner:SetMesh(self.OwnerShieldMesh,true)

Expand Down Expand Up @@ -1066,8 +1077,7 @@ UnitShield = Class(QCEUnitShield){
}

-- AntiArtillery shields are typical bubbles but only intercept certain projectiles
QCEAntiArtilleryShield = AntiArtilleryShield
AntiArtilleryShield = Class(QCEAntiArtilleryShield){
AntiArtilleryShield = Class(Shield){

OnCreate = function(self, spec)
Shield.OnCreate(self, spec)
Expand Down Expand Up @@ -1137,8 +1147,7 @@ AntiArtilleryShield = Class(QCEAntiArtilleryShield){
}

-- Hunker Shields take no damage while on --
QCEDomeHunkerShield = DomeHunkerShield
DomeHunkerShield = Class(QCEDomeHunkerShield) {
DomeHunkerShield = Class(Shield) {

OnCollisionCheckWeapon = function(self, firingWeapon)
return true
Expand All @@ -1154,8 +1163,7 @@ DomeHunkerShield = Class(QCEDomeHunkerShield) {
}

-- Hunker Shields are time limited shields that take no damage --
QCEPersonalHunkerShield = PersonalHunkerShield
PersonalHunkerShield = Class(QCEPersonalHunkerShield) {
PersonalHunkerShield = Class(Shield) {

OnCreate = function(self, spec)
Shield.OnCreate(self, spec)
Expand Down Expand Up @@ -1196,8 +1204,7 @@ PersonalHunkerShield = Class(QCEPersonalHunkerShield) {

}

QCEProjectedShield = ProjectedShield
ProjectedShield = Class(QCEProjectedShield){
ProjectedShield = Class(Shield){

OnDamage = function(self,instigator,amount,vector,type)

Expand Down Expand Up @@ -1268,11 +1275,6 @@ ProjectedShield = Class(QCEProjectedShield){
local WaitTicks = coroutine.yield

if not self.Dead then

-- Safety Check for nil shield size
if self.Size == nil then
self.Size = 10
end

local army = self.Army

Expand Down
9 changes: 3 additions & 6 deletions hook/lua/sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@ Unit = Class(QCEUnit) {
excessDamageRatio = -excess / maxHealth

end

Kill( self, instigator, damageType, excessDamageRatio)

Kill( self, instigator, damageType, excessDamageRatio)
end

end

end

-- Handle incoming OC damage for ACUs
if damageType == 'Overcharge' and LOUDENTITY(categories.COMMAND, self) then

Expand Down
2 changes: 1 addition & 1 deletion mod_info.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "QUIET"
author = "QUIET Team"
version = 1.78
version = 1.79
description = "QUIET is a massive collection of Bug Fixes, Game Rebalance, & Other Various Actions"
exclusive = false
ui_only = false
Expand Down
Loading

0 comments on commit 649e6cd

Please sign in to comment.