39 flash_node =
fgGetNode(
"/environment/lightning/flash",
true);
40 flash_node->setBoolValue(
false);
44 subflash_array[0] = 1;
45 subflash_array[1] = 2;
46 subflash_array[2] = 1;
47 subflash_array[3] = 3;
48 subflash_array[4] = 2;
49 subflash_array[5] = 1;
50 subflash_array[6] = 1;
51 subflash_array[7] = 2;
53 turb_mag_node =
fgGetNode(
"/environment/turbulence/magnitude-norm",
true);
54 turb_rate_node =
fgGetNode(
"/environment/turbulence/rate-hz",
true);
64 setDiameter(scFileNode->getDoubleValue(
"diameter-ft", 0.0)/6076.11549);
65 setHeight(scFileNode->getDoubleValue(
"height-msl", 5000.0));
76void FGAIStorm::Run(
double dt) {
95 if (timer > random_delay) {
96 srand((
unsigned)time(0));
97 random_delay = delay + (rand()%3) - 1.0;
102 if (subflash_index == 8) subflash_index = 0;
103 subflashes = subflash_array[subflash_index];
107 if (flashed < subflashes) {
110 flash_node->setBoolValue(
true);
112 flash_node->setBoolValue(
false);
133 double rangeNm = d * SG_METER_TO_NM;
136 if (rangeNm < (diameter * 0.5) &&
138 user_altitude < height) {
139 turb_mag_node->setDoubleValue(strength_norm);
140 turb_rate_node->setDoubleValue(0.5);
virtual void readFromScenario(SGPropertyNode *scFileNode)
FGAIBase(object_type ot, bool enableHot)
virtual void update(double dt)
double UpdateRadar(FGAIManager *manager)
double speed_east_deg_sec
double speed_north_deg_sec
void setStrengthNorm(double s)
void update(double dt) override
void readFromScenario(SGPropertyNode *scFileNode) override
void setDiameter(double d)
SGGeod get_aircraft_position() const
SGVec3d get_aircraft_position_cart() const
SGPropertyNode * fgGetNode(const char *path, bool create)
Get a property node.