-
-
Notifications
You must be signed in to change notification settings - Fork 561
Open
Labels
Description
Features include a lineOfSight
property:
warzone2100/data/base/stats/features.json
Lines 615 to 626 in f45d614
"Tree1": { | |
"armour": 10, | |
"breadth": 1, | |
"hitpoints": 50, | |
"id": "Tree1", | |
"lineOfSight": 0, | |
"model": "mitrees.pie", | |
"name": "*Tree1*", | |
"tileDraw": 1, | |
"type": "TREE", | |
"width": 1 | |
}, |
It seems that this propety controls whether units and structures can see through the feature and shoot at objects behind it:
warzone2100/data/base/stats/features.ini
Lines 4 to 6 in 85b79c1
; damageable <1|0> Whether or not the feature is damageable, if set to 0, the 'x' cursor will appear instead of the 'attack' cursor | |
; lineOfSight <1|0> Line Of Sight. Whether of not units and structures can see through them and shoot at objects behind them | |
; startVisible <1|0> Whether or not the feature is visible even if you haven't explored that area of terrain yet |
However, this property doesn't seem to do anything in the source code currently. It seems that visibility.cpp
is the right place to implement it?
warzone2100/src/visibility.cpp
Lines 1131 to 1154 in f45d614
{ | |
const MAPTILE *psTile; | |
halfway = current + (next - current) / 2; | |
psTile = mapTile(map_coord(halfway.x), map_coord(halfway.y)); | |
if (TileHasStructure(psTile) && psTile->psObject != psTarget) | |
{ | |
// check whether target was reached before tile's "half way" line | |
part = halfway - start; | |
partSq = dot(part, part); | |
if (partSq >= distSq) | |
{ | |
break; | |
} | |
// allowed to shoot over enemy structures if they are NOT the target | |
if (partSq > 0) | |
{ | |
angle_check(&angletan, oldPartSq, | |
psTile->psObject->pos.z + establishTargetHeight(psTile->psObject) - pos.z, | |
distSq, dest.z - pos.z, direct); | |
} | |
} | |
} |