Update first playable version

- add brief
- fix event handler bugs
This commit is contained in:
2025-04-04 18:02:54 +08:00
parent d1cdac51a8
commit ec3178c2d6
23 changed files with 385 additions and 29 deletions
+33 -4
View File
@@ -29,6 +29,18 @@ PatrolUnit.Database = {
fireRange = 2500,
eyeHight = 3,
},
['HL_KORD'] = {
fireRange = 1200,
eyeHight = 3,
},
['tt_DSHK'] = {
fireRange = 1200,
eyeHight = 3,
},
['tt_KORD'] = {
fireRange = 1200,
eyeHight = 3,
},
}
PatrolUnit.AllGroups = {}
do
@@ -50,6 +62,18 @@ do
return
end
if PatrolUnit.DebugMod then
local unitType = unit:getTypeName()
if unitType then
Utils.Debug('UnitType: '..unitType)
end
if not unitType then
Utils.Debug('UnitType: nil')
end
end
fireRange = fireRange or PatrolUnit.Database[unit:getTypeName()].fireRange or PatrolUnit.DefaultFireRange
eyeHight = eyeHight or PatrolUnit.Database[unit:getTypeName()].eyeHight or PatrolUnit.DefaultEyeHight
@@ -190,21 +214,21 @@ do
[1] = {
x = roadPoint_start.x,
y = roadPoint_start.y,
speed = 1000,
speed = math.random(40,60)/3.6,
type = AI.Task.WaypointType.TURNING_POINT,
action = AI.Task.VehicleFormation.ON_ROAD,
},
[2] = {
x = roadPoint_end.x,
y = roadPoint_end.y,
speed = 1000,
speed = math.random(40,60)/3.6,
type = AI.Task.WaypointType.TURNING_POINT,
action = AI.Task.VehicleFormation.ON_ROAD,
},
[3] = {
x = endPoint_vec3.x,
y = endPoint_vec3.z,
speed = 1000,
speed = math.random(40,60)/3.6,
type = AI.Task.WaypointType.TURNING_POINT,
action = AI.Task.VehicleFormation.OFF_ROAD,
},
@@ -228,6 +252,11 @@ do
local self = vars.context
local repeatTime = vars.repeatTime
if not self.group:isExist() then
self:Remove()
return
end
local myUnit = self.group:getUnit(1)
if not myUnit then self:remove() return end
if not myUnit:isActive() then return time + repeatTime end
@@ -350,7 +379,7 @@ do
local patrolGroupName = 'Red-Patrol-AAA-'
for i=1,20,1 do
for i=1,30,1 do
if not Group.getByName(patrolGroupName..i) then return end
PatrolUnit:New(patrolGroupName..i)
end