-- 置くだけ迎撃LUA ver1.0 -- Munition warnerやPassive Sonar 360の配置を忘れずに! -- ミサイル迎撃用スロット MissileSlot = 4 -- 魚雷迎撃用スロット TorpedoSlot = 5 -- メインフレーム番号 MFNO = 0 -- ミサイル迎撃距離 MissileLength = 500 --魚雷迎撃距離 TorpedoLength = 1000 -- よくわかんない人はここから触らない function Update(I) I:ClearLogs() WarnNum = I:GetNumberOfWarnings(MFNO) fireMissile = false fireTorpedo = false for i =0,WarnNum do wobj = I:GetMissileWarning(MFNO,i) if(wobj.Valid == true) then I:Log(i..":"..wobj.Range) if(wobj.Position.y > 0 and wobj.Range < MissileLength) then fireMissile = true I:Log("FIREMISSILE!!") end if(wobj.Position.y < 0 and wobj.Range < TorpedoLength) then fireTorpedo = true I:Log("FIRETORPEDO!!") end end end if fireMissile then Fire(I,MissileSlot) end if fireTorpedo then Fire(I,TorpedoSlot) end end function Fire(I,slot) for i=0,I:GetWeaponCount() do info = I:GetWeaponInfo(i) I:AimWeaponInDirection(i, info.CurrentDirection.x,info.CurrentDirection.y,info.CurrentDirection.z, slot) I:FireWeapon(i, slot) end TSNum = I:GetTurretSpinnerCount() for i=0,TSNum do for j=0,I:GetWeaponCountOnTurretOrSpinner(i) do info = I:GetWeaponInfoOnTurretOrSpinner(i, j) I:AimWeaponInDirectionOnTurretOrSpinner(i, j, info.CurrentDirection.x,info.CurrentDirection.y,info.CurrentDirection.z, slot) I:FireWeaponOnTurretOrSpinner(i, j, slot) end end end