local oldStructureUnit = StructureUnit
StructureUnit = Class(oldStructureUnit) {
OnCreate = function(self)
oldStructureUnit.OnCreate(self)
LOG('*** we hooked sucessfully')
end,
}
local oldRadarUnit = RadarUnit
RadarUnit = Class(oldRadarUnit) {
OnCreate = function(self)
StructureUnit.OnCreate(self)
end,
}
Statistics: Posted by BlackYps — 24 Jan 2020, 22:10
Statistics: Posted by BlackYps — 24 Jan 2020, 20:38
Statistics: Posted by Uveso — 24 Jan 2020, 20:16
Statistics: Posted by BlackYps — 24 Jan 2020, 19:02
\Mods\oil_slicks\hook\lua\cybranunits.lua
local oldCLandFactoryUnit = CLandFactoryUnit
CLandFactoryUnit = Class(oldCLandFactoryUnit) {
OnCreate = function(self)
WARN('***---*** CLandFactoryUnit OnCreate HOOK')
oldCLandFactoryUnit.OnCreate(self)
end,
OnKilled = function(self, instigator, type, overkillRatio)
WARN('***---*** CLandFactoryUnit OnKilled HOOK')
oldCLandFactoryUnit.OnKilled(self, instigator, type, overkillRatio)
end,
OnDestroy = function(self)
WARN('***---*** CLandFactoryUnit OnDestroy HOOK')
oldCLandFactoryUnit.OnDestroy(self)
end,
}
Statistics: Posted by Uveso — 22 Jan 2020, 20:44
StructureUnit = Class(Unit) {
--a ton of functions
}
FactoryUnit = Class(StructureUnit ) {
--more functions
}
--now comes the hooked part from the mod
local oldStructureUnit = StructureUnit
StructureUnit = Class(oldStructureUnit) {
OnKilled = function(self)
LOG('***---*** StructureUnit OnKilled HOOK')
oldStructureUnit.OnDestroy(self)
local orient = self.TarmacBag.Orientation
local currentBP = self.TarmacBag.CurrentBP
self:DestroyTarmac()
self:CreateTarmac(true, true, true, orient, currentBP, currentBP.DeathLifetime or 300)
end,
OnDestroy = function(self)
LOG('***---*** StructureUnit OnDestroy HOOK')
Unit.OnDestroy(self)
end,
}
Statistics: Posted by BlackYps — 21 Jan 2020, 17:15
Unit = Class(moho.unit_methods)
Supreme Commander\Gamedata\mohodata.SCD\lua\sim\Unit.lua
StructureUnit = Class(Unit) {}
FactoryUnit = Class(StructureUnit) {}
local oldFactoryUnit = FactoryUnit
FactoryUnit = Class(oldFactoryUnit)
Statistics: Posted by Uveso — 21 Jan 2020, 01:21
local oldFactoryUnit = FactoryUnit
FactoryUnit = Class(StructureUnit, oldFactoryUnit) {}
Statistics: Posted by BlackYps — 21 Jan 2020, 00:27
Statistics: Posted by BlackYps — 21 Jan 2020, 00:07
\Mods\YOURMODNAME\hook\lua\defaultunits.lua
local OLDStructureUnit = StructureUnit
StructureUnit = Class(OLDStructureUnit) {
OnDestroy = function(self)
LOG('***---*** StructureUnit OnDestroy HOOK')
Unit.OnDestroy(self)
local orient = self.TarmacBag.Orientation
local currentBP = self.TarmacBag.CurrentBP
self:DestroyTarmac()
self:CreateTarmac(true, true, true, orient, currentBP, currentBP.DeathLifetime or 300)
end,
}
Statistics: Posted by Uveso — 20 Jan 2020, 23:41
local oldStructureUnit = StructureUnit
StructureUnit = Class(oldStructureUnit) {
OnDestroy = function(self)
Unit.OnDestroy(self)
end,
}
oldStructureUnit.OnDestroy(self)
local oldStructureUnit = StructureUnit
StructureUnit = Class(oldStructureUnit) {
OnDestroy = function(self)
oldStructureUnit.OnDestroy(self)
end,
}
Statistics: Posted by Uveso — 20 Jan 2020, 23:12
local oldStructureUnit = StructureUnit
StructureUnit = Class(oldStructureUnit) {
OnDestroy = function(self)
Unit.OnDestroy(self)
end,
}
field 'OnDestroy' is ambiguous in class definition
Statistics: Posted by BlackYps — 20 Jan 2020, 22:14