Skip to content

Commit

Permalink
Apply UEF fx when gaining veterancy, scale effects based on the unit …
Browse files Browse the repository at this point in the history
…size
  • Loading branch information
Garanas committed May 12, 2024
1 parent 4ad5ea4 commit dfbcc33
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 26 deletions.
49 changes: 33 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
Contributing
------------
# Contributing to FAForever

To contribute, please fork this repository and make pull requests to the
`deploy/fafdevelop` branch.
Welcome commander to another battlefield filled with technology - the everlasting polishing of Supreme Commander: Forged Alliance Forever!

Use the normal git conventions for commit messages, with the following rules:
- Subject line shorter than 80 characters
- No trailing period
- For non-trivial commits, always include a commit message body, describing the change in detail
- If there are related issues, reference them in the commit message footer
Regardless of your faction - everyone is welcome to contribute. To smooth out this process we highly encourage you to read the relevant sections of this document before making your contributions. You can find an overview in the [Table of Contents](#table-of-contents). It will make it easier for your fellow commanders to review it and smooth out the experience for everyone and all factions involved. The community - except for maybe the Cybrans - look forward to your contributions!

We use [git flow](http://nvie.com/posts/a-successful-git-branching-model/) for our branch conventions.
## Table of Contents

When making _backwards incompatible API changes_, do so with a stub function and put in a logging statement including traceback. This gives time for mod authors to change their code, as well as for us to catch any incompatibilities introduced by the change.
- [Contributing to FAForever](#contributing-to-faforever)
- [Table of Contents](#table-of-contents)
- [I have a question](#i-have-a-question)
- [I want to contribute](#i-want-to-contribute)
- [Reporting bugs](#reporting-bugs)
- [Contribute via code](#contribute-via-code)
- [Contribute via assets](#contribute-via-assets)
- [Related repositories](#related-repositories)

Code convention
---------------
## I have a question

Please follow the [Lua Style Guide](http://lua-users.org/wiki/LuaStyleGuide) as
much as possible.
The community is available in various channels. For questions we encourage you to join the [FAForever Discord Server](https://discord.gg/mXahVSKGVb). There are separate channels for game development. We'd recommend the offtopic channel. There are various contributors available here to help find an answer to your question.

For file encoding, use UTF-8 and unix-style file endings in the repo (Set core.autocrlf).
## I want to contribute

### Reporting bugs

A good bug report should make it immediately clear to a maintainer what the perceived bug is and possibly how to reproduce it consistently. The time of maintainers is relatively scarce, a detailed bug report is therefore not only appreciated but it also reduces the overhead of understanding the context of the bug. You can follow these guidelines to create a detailed bug report:

- Find an (preferably easy) approach to reproduce it in a sandboxed environment.

Once you've found a way to reproduce the bug you need to make sure that it is not related to a mod. Disable all your (ui) mods and try to reproduce the bug again. If the bug still occurs then do attach the replay id to your bug report along with a timestamp as to when the bug occurs.

- Open a [new issue on Github](https://github.com/FAForever/fa/issues/new?assignees=&labels=status%3A+novel+issue&projects=&template=bug_report.md&title=) using the bug report template

In the issue you can add a description of the bug and relevant images or videos. You can add the replay id in the description. If you do not have a Github account then we encourage you to create one. Otherwise you can also report the bug on the [FAForever Discord Server](https://discord.gg/mXahVSKGVb).

### Contribute via code

### Contribute via assets

## Related repositories
13 changes: 13 additions & 0 deletions lua/defaultcomponents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ local VeterancyRegenBuffs = {
---@field VetLevel? number
VeterancyComponent = ClassSimple {

VeterancyFx = {},

---@param self VeterancyComponent | Unit
OnCreate = function(self)
local blueprint = self.Blueprint
Expand Down Expand Up @@ -755,6 +757,17 @@ VeterancyComponent = ClassSimple {
local mult = blueprint.VeteranHealingMult[nextLevel] or 0.1
self:AdjustHealth(self, maxHealth * mult)

-- effects

local army = self.Army
local blueprint = self.Blueprint
local sizeX = blueprint.SizeX or 1
local sizeZ = blueprint.SizeZ or 1
for _, effect in self.VeterancyFx do
LOG(effect)
CreateEmitterAtEntity(self, army, effect):ScaleEmitter(MathMin(sizeX, sizeZ))
end

-- callbacks

self:DoUnitCallbacks('OnVeteran')
Expand Down
8 changes: 6 additions & 2 deletions lua/sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2329,8 +2329,12 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent) {
--- "/effects/emitters/veterancy/cybran_vet_1_v2-2.bp",
}

for index, effect in effects do
CreateEmitterAtEntity(self, self.Army, effect)
local army = self.Army
local blueprint = self.Blueprint
local sizeX = blueprint.SizeX or 1
local sizeZ = blueprint.SizeZ or 1
for _, effect in effects do
CreateEmitterAtEntity(self, army, effect):ScaleEmitter(math.min(sizeX, sizeZ) * 0.5)
end

-- Create any idle effects on unit
Expand Down
9 changes: 8 additions & 1 deletion lua/sim/units/uef/TAirUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@
local AirUnit = import('/lua/defaultunits.lua').AirUnit

---@class TAirUnit : AirUnit
TAirUnit = ClassUnit(AirUnit) {}
TAirUnit = ClassUnit(AirUnit) {

VeterancyFx = {
"/effects/emitters/veterancy/uef_vet_1_v2.bp",
"/effects/emitters/veterancy/uef_vet_1_v3.bp",
}

}
5 changes: 5 additions & 0 deletions lua/sim/units/uef/TConstructionUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ local ForkThread = ForkThread
---@field TransformManipulator moho.AnimationManipulator
TConstructionUnit = ClassUnit(ConstructionUnit) {

VeterancyFx = {
"/effects/emitters/veterancy/uef_vet_1_v2.bp",
"/effects/emitters/veterancy/uef_vet_1_v3.bp",
},

---@param self TConstructionUnit
---@param builder Unit
---@param layer Layer
Expand Down
7 changes: 6 additions & 1 deletion lua/sim/units/uef/THoverLandUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@
local HoverLandUnit = import('/lua/defaultunits.lua').HoverLandUnit

---@class THoverLandUnit : HoverLandUnit
THoverLandUnit = ClassUnit(HoverLandUnit) {}
THoverLandUnit = ClassUnit(HoverLandUnit) {
VeterancyFx = {
"/effects/emitters/veterancy/uef_vet_1_v2.bp",
"/effects/emitters/veterancy/uef_vet_1_v3.bp",
}
}
7 changes: 6 additions & 1 deletion lua/sim/units/uef/TLandUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@
local LandUnit = import('/lua/defaultunits.lua').LandUnit

---@class TLandUnit : LandUnit
TLandUnit = ClassUnit(LandUnit) {}
TLandUnit = ClassUnit(LandUnit) {
VeterancyFx = {
"/effects/emitters/veterancy/uef_vet_1_v2.bp",
"/effects/emitters/veterancy/uef_vet_1_v3.bp",
}
}
9 changes: 8 additions & 1 deletion lua/sim/units/uef/TSeaUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@
local SeaUnit = import('/lua/defaultunits.lua').SeaUnit

---@class TSeaUnit : SeaUnit
TSeaUnit = ClassUnit(SeaUnit) {}
TSeaUnit = ClassUnit(SeaUnit) {

VeterancyFx = {
"/effects/emitters/veterancy/uef_vet_1_v2.bp",
"/effects/emitters/veterancy/uef_vet_1_v3.bp",
}

}
7 changes: 6 additions & 1 deletion lua/sim/units/uef/TShieldLandUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@
local ShieldLandUnit = import('/lua/defaultunits.lua').ShieldLandUnit

---@class TShieldLandUnit : ShieldLandUnit
TShieldLandUnit = ClassUnit(ShieldLandUnit) {}
TShieldLandUnit = ClassUnit(ShieldLandUnit) {
VeterancyFx = {
"/effects/emitters/veterancy/uef_vet_1_v2.bp",
"/effects/emitters/veterancy/uef_vet_1_v3.bp",
}
}
7 changes: 6 additions & 1 deletion lua/sim/units/uef/TShieldSeaUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@
local ShieldSeaUnit = import('/lua/defaultunits.lua').ShieldSeaUnit

---@class TShieldSeaUnit : ShieldSeaUnit
TShieldSeaUnit = ClassUnit(ShieldSeaUnit) {}
TShieldSeaUnit = ClassUnit(ShieldSeaUnit) {
VeterancyFx = {
"/effects/emitters/veterancy/uef_vet_1_v2.bp",
"/effects/emitters/veterancy/uef_vet_1_v3.bp",
}
}
7 changes: 6 additions & 1 deletion lua/sim/units/uef/TSubUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@
local SubUnit = import('/lua/defaultunits.lua').SubUnit

---@class TSubUnit : SubUnit
TSubUnit = ClassUnit(SubUnit) {}
TSubUnit = ClassUnit(SubUnit) {
VeterancyFx = {
"/effects/emitters/veterancy/uef_vet_1_v2.bp",
"/effects/emitters/veterancy/uef_vet_1_v3.bp",
}
}
7 changes: 6 additions & 1 deletion lua/sim/units/uef/TWalkingLandUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@
local WalkingLandUnit = import('/lua/defaultunits.lua').WalkingLandUnit

---@class TWalkingLandUnit : WalkingLandUnit
TWalkingLandUnit = ClassUnit(WalkingLandUnit) {}
TWalkingLandUnit = ClassUnit(WalkingLandUnit) {
VeterancyFx = {
"/effects/emitters/veterancy/uef_vet_1_v2.bp",
"/effects/emitters/veterancy/uef_vet_1_v3.bp",
}
}

0 comments on commit dfbcc33

Please sign in to comment.