Just took a look at the BrewLan mines, specifically unit SEB2220. Looks like he's also using the standard intel system for stealth, along with the "Suicide" weapon trigger event.
--Snippet from the units blueprint
Intel = {
Cloak = true,
RadarStealth = true,
SonarStealth = true,
VisionRadius = 0,
OmniRadius = 1,
},
SEB2220 = Class(MineStructureUnit) {
Weapons = {
Suicide = Class(MineStructureUnit.Weapons.Suicide) {
FxDeathLand = EffectTemplate.TSmallYieldNuclearBombHit01,
},
},
}
TypeClass = SEB2220
Only significant change here is that the mines are using there own Omni Intel rather than other types. Thus the mines can see thru stealthed units. But notice that the mines are all labeled as Structures. This means once they've been discovered via Omni that they will always remain so, even after Omni has been removed.
In comparison from 4DFAF unit UEB2102 (yes the identifier shows it as a structure but its not. This is deliberate)
--Snippet from the unit blueprint
Intel = {
Cloak = true,
RadarStealth = true,
VisionRadius = 2,
},
-----------------------------------------------------------------------------
-- File : /units/ueb2102/ueb2102_script.lua
--
-- Author(s): EbolaSoup, Resin Smoker, Optimus Prime, Vissroid, Domino
--
-- Summary : UEF Basic Land Mine Script
--
-- Copyright © 2024 4DFAF, All rights reserved.
-----------------------------------------------------------------------------
local bombWeap = import('/lua/sim/DefaultWeapons.lua').KamikazeWeapon
local emtBpPath = ('/effects/emitters/')
local TLandUnit = import('/lua/terranunits.lua').TLandUnit
local util = import('/lua/utilities.lua')
--Mine custom FX Tables
local mineFX = {
emtBpPath .. 'destruction_explosion_concussion_ring_01_emit.bp',
emtBpPath .. 'tti_dirt02_large01_01_emit.bp',
emtBpPath .. 'tti_dirt02_large01_02_emit.bp',
}
ueb2102 = Class(TLandUnit) {
Weapons = {
Suicide = Class(bombWeap) {
OnFire = function(self)
--Check to see if mine has already fired once
if not self.unit.Detonated then
--Set flag true
self.unit.Detonated = true
--Trigger FX
self.unit:DetonateFX()
--Callback to KamikazeWeapon to perform damage
bombWeap.OnFire(self)
end
end,
},
},
OnCreate = function(self,builder,layer)
TLandUnit.OnCreate(self)
--Set hitbox
self:SetCollisionShape('Sphere', 0, 0, 0, 0.5)
--Make the mine uncapturable
self:SetCapturable(false)
--Enable stealth
self:EnableIntel('Cloak')
self:EnableIntel('RadarStealth')
--Set flag to prevent multiple firings
self.Detonated = false
end,
OnDamage = function(self, instigator, amount, vector, damagetype)
--Trigger mine detonation if the mine is damaged
if self and not self:IsDead() and not self.Detonated then
self:GetWeaponByLabel('Suicide'):FireWeapon()
end
--Null the damage amount so the unit attacking the mine doesnt earn a kill counter, as it just triggered the detonation instead
amount = 0
TLandUnit.OnDamage(self, instigator, amount, vector, damagetype)
end,
DetonateFX = function(self)
--Sound FX
self:PlayUnitSound('Detonate')
--Do local calls
local army = self:GetArmy()
local pos = self:GetPosition()
local bp = self:GetBlueprint()
local ran = util.GetRandomFloat(0.75, 1.0)
local myWeapon = self:GetWeaponByLabel('Suicide')
--Disable the weapon to prevent them triggering more than once
self:SetWeaponEnabledByLabel('Suicide', false)
--Make FX and decals
for k, v in mineFX do
local mineEmitter01 = CreateEmitterAtBone(self,-2,army,v):ScaleEmitter(0.5)
self.Trash:Add(mineEmitter01)
end
CreateDecal( pos, util.GetRandomFloat(0,2*math.pi), 'nuke_scorch_001_normals', '', 'Alpha Normals', 1 + ran, 1 + ran, 150, 60, army )
CreateDecal( pos, util.GetRandomFloat(0,2*math.pi), 'nuke_scorch_002_albedo', '', 'Albedo', 2 + ran, 2 + ran, 150, 60, army )
--Shake camera
self:ShakeCamera(myWeapon:GetBlueprint().DamageRadius, 0.5, 0.25, 1)
end,
}
TypeClass = ueb2102
Biggest difference here is that the 4DC mines have more destruction effects, impact shake and leave craters.