fix castingVision giving vision to neutrals

This commit is contained in:
2025-01-24 14:41:30 +09:00
parent de3c175914
commit 2b2336bf70
11 changed files with 72 additions and 55 deletions
+2
View File
@@ -20,6 +20,7 @@ export default class Entity {
health = null
height = null
maxHealth = 1
model = null
position = null
radius = 0
rotation = 0
@@ -681,6 +682,7 @@ export default class Entity {
owner: this.id,
position: this.position.clone(),
visionRange: radius,
team: enemyTeam,
})
this.game?.spawnProjectile(projectile)
+15 -12
View File
@@ -7,9 +7,10 @@ export default class Template {
return {
abilities: {},
logic: this.#basiliskLogic(),
maxHealth: 3000,
model: 'models/generic-bam-placeholder.gltf',
radius: 180,
speed: 230,
maxHealth: 3000,
...overrides,
}
}
@@ -19,6 +20,7 @@ export default class Template {
abilities: { a: options.ranged ? Ability.rangedAttack.id : Ability.meleeAttack.id },
logic: this.#minionLogic(options.route, (team != Team.blue)),
maxHealth: options.ranged ? 300 : 450,
model: Team.blue == (team ?? Team.blue) ? 'models/generic-player-placeholder.gltf' : 'models/generic-player-placeholder-red.gltf',
pathfindingCooldown: 0.2,
pathfindingObstacleLimit: 0,
position: options.route?.at(0) ?? options.position ?? new Vector2(0, 0),
@@ -42,6 +44,7 @@ export default class Template {
},
logic: this.#playerLogic,
maxHealth: 600,
model: Team.blue == (overrides.team ?? Team.blue) ? 'models/generic-player-placeholder.gltf' : 'models/generic-player-placeholder-red.gltf',
pathfindingObstacleLimit: 3,
radius: 65,
spawnPosition: new Vector2(500, 150),
@@ -60,17 +63,17 @@ export default class Template {
const despawnDelay = entity.game?.secToTick(despawnDelaySec) ?? 1
const timestamp = entity.game?.currentTick ?? 0
if (entity.dead) {
if (diedOnTick == null) {
diedOnTick = timestamp
}
else if (diedOnTick + despawnDelay < timestamp) {
entity.despawn()
}
}
else if (diedOnTick != null) {
diedOnTick = null
}
if (entity.dead && diedOnTick == null) { diedOnTick = timestamp }
if (entity.dead && diedOnTick != null && diedOnTick + despawnDelay < timestamp) { entity.despawn() }
if (!entity.dead) { diedOnTick = null }
if (entity.dead) { return }
const target = entity.closestTargetTo(entity.position, 500)
if (target == null) { return }
const directionToTarget = target.position.clone().sub(entity.position).normalize()
const entityRotationVector = new Vector2(1, 0).rotateAround(new Vector2(), entity.rotation)
entity.rotation = directionToTarget.clone().add(entityRotationVector).add(entityRotationVector).add(entityRotationVector).angle()
}
}