71#include <fmt/format.h>
72#include "half/half.hpp"
156 HandleGenericException(fmt::format(
"Actor::dispose(); instanceID:{}, streamID:{}, filename:{}; deleting scenenode {}/{} from `deletion list`.",
176 HandleGenericException(fmt::format(
"Actor::dispose(); instanceID:{}, streamID:{}, filename:{}; deleting entity {}/{} from `deletion list`.",
202 HandleGenericException(fmt::format(
"Actor::dispose(); instanceID:{}, streamID:{}, filename:{}; deleting wing {}/{}.",
240 for (
size_t i = 0; i < this->
ar_flares.size(); i++)
246 ar_flares[i].snode->removeAndDestroyAllChildren();
256 HandleGenericException(fmt::format(
"Actor::dispose(); instanceID:{}, streamID:{}, filename:{}; deleting flare {}/{}.",
334 hbeam.hb_ref_length *= value;
335 hbeam.hb_speed *= value;
362 return atan2(dir.dotProduct(Vector3::UNIT_X), dir.dotProduct(-Vector3::UNIT_Z));
379 Ogre::Vector3 localY = localZ.crossProduct(localX);
380 return Ogre::Quaternion(localX, localY, localZ);
409 float wspeed = *(
float*)(ptr);
411 ptr +=
sizeof(float);
418 char byte = *(ptr + (i / 8));
419 char mask = char(1) << (7 - (i % 8));
461 if (oob->
time > rnow + 100)
482 int index_offset = 0;
486 if (oob->
time > rnow)
493 char* netb1 = (
char*)
m_net_updates[index_offset ].node_data.data();
494 char* netb2 = (
char*)
m_net_updates[index_offset + 1].node_data.data();
495 float* net_rp1 = (
float*)
m_net_updates[index_offset ].wheel_data.data();
496 float* net_rp2 = (
float*)
m_net_updates[index_offset + 1].wheel_data.data();
498 float tratio = (float)(rnow - oob1->
time) / (float)(oob2->
time - oob1->
time);
505 else if (tratio > 1.0f)
514 half_float::half* halfb1 =
reinterpret_cast<half_float::half*
>(netb1 +
sizeof(float) * 3);
515 half_float::half* halfb2 =
reinterpret_cast<half_float::half*
>(netb2 +
sizeof(float) * 3);
516 Vector3 p1ref = Vector3::ZERO;
517 Vector3 p2ref = Vector3::ZERO;
518 Vector3 p1 = Vector3::ZERO;
519 Vector3 p2 = Vector3::ZERO;
526 p1.x = ((
float*)netb1)[0];
527 p1.y = ((
float*)netb1)[1];
528 p1.z = ((
float*)netb1)[2];
531 p2.x = ((
float*)netb2)[0];
532 p2.y = ((
float*)netb2)[1];
533 p2.z = ((
float*)netb2)[2];
539 const int bufpos = (i - 1) * 3;
540 const Vector3 p1rel(halfb1[bufpos + 0], halfb1[bufpos + 1], halfb1[bufpos + 2]);
541 const Vector3 p2rel(halfb2[bufpos + 0], halfb2[bufpos + 1], halfb2[bufpos + 2]);
555 float rp = net_rp1[i] + tratio * (net_rp2[i] - net_rp1[i]);
559 Plane pplan = Plane(axis,
ar_wheels[i].wh_axis_node_0->AbsPosition);
561 Vector3 ray = ortho.crossProduct(axis);
567 Vector3 uray = Quaternion(Radian(rp - drp * j), axis) * ray;
579 Vector3 uray = Quaternion(Radian(rp - drp * j), axis) * ray;
621 if ((flagmask & NETMASK_ENGINE_MODE_AUTOMATIC) != 0) { automode =
static_cast<int>(
SimGearboxMode::AUTO); }
623 else if ((flagmask & NETMASK_ENGINE_MODE_MANUAL) != 0) { automode =
static_cast<int>(
SimGearboxMode::MANUAL); }
627 bool contact = ((flagmask & NETMASK_ENGINE_CONT) != 0);
628 bool running = ((flagmask & NETMASK_ENGINE_RUN) != 0);
643 if ((flagmask & NETMASK_HORN))
653 for (
int i = 0; i < index_offset; i++)
663 float total_tyre = 0.f;
int num_tyre = 0;
664 float total_loaded = 0.f;
int num_loaded = 0;
665 float total_override = 0.f;
int num_override = 0;
694 LOG(fmt::format(
"Node masses: total: {} kg, tyre ({} nodes): {} kg, loaded ({} nodes): {} kg, override ({} nodes): {} kg",
696 num_tyre, total_tyre,
697 num_loaded, total_loaded,
698 num_override, total_override));
708 LOG(fmt::format(
"recalculateNodeMasses() - before reset (dry mass: {} kg, loaded mass: {} kg, prev. calculated total mass: {} kg",
733 else if (!
ar_nodes[i].nd_override_mass)
774 LOG(fmt::format(
"recalculateNodeMasses() - average linear density (total beam len: {}m)", len));
779 for (std::vector<rope_t>::iterator it =
ar_ropes.begin(); it !=
ar_ropes.end(); it++)
781 it->rp_beam->p2->mass = 100.0f;
795 LOG(
"recalculateNodeMasses() - ropes and cinecams");
809 snprintf(buf, 300,
"Node '%d' mass (%f Kg) is too light. Resetting to 'minimass' (%f Kg)", i,
ar_nodes[i].mass,
ar_minimass[i]);
818 LOG(fmt::format(
"recalculateNodeMasses() - minimass (ar_minimass_skip_loaded_nodes: {})",
832 msg +=
" (overriden by node mass)";
855 mass += actor->ar_total_mass;
869 std::map<ActorPtr, bool> lookup_table;
871 lookup_table.insert(std::pair<ActorPtr, bool>(
this,
false));
877 for (
auto it_actor = lookup_table.begin(); it_actor != lookup_table.end(); ++it_actor)
879 if (!it_actor->second)
884 auto actor_pair = inter_actor_link.second;
885 if (actor == actor_pair.first || actor == actor_pair.second)
887 auto other_actor = (actor != actor_pair.first) ? actor_pair.first : actor_pair.second;
888 auto ret = lookup_table.insert(std::pair<ActorPtr, bool>(other_actor,
false));
896 it_actor->second =
true;
930 AxisAlignedBox bb = AxisAlignedBox(bb_min, bb_max);
945 Ray ray(origin, target - origin);
954 auto result = Ogre::Math::intersects(ray, a, b, c);
955 if (result.first && result.second < 1.0f)
972 Ray ray(origin, target - origin);
981 auto result = Ogre::Math::intersects(ray, a, b, c);
982 if (result.first && result.second < 1.0f)
994 if (direction == Vector3::ZERO)
995 return Vector3::ZERO;
997 Real max_distance = direction.normalise();
1000 Vector3 collision_offset = Vector3::ZERO;
1002 while (collision_offset.length() < max_distance)
1006 AxisAlignedBox bb = AxisAlignedBox(bb_min, bb_max);
1008 bool collision =
false;
1014 if (!bb.intersects(actor->ar_bounding_box))
1020 for (
int i = 0; i < actor->ar_num_collcabs; i++)
1022 int tmpv = actor->ar_collcabs[i] * 3;
1023 node_t* no = &actor->ar_nodes[actor->ar_cabs[tmpv]];
1024 node_t* na = &actor->ar_nodes[actor->ar_cabs[tmpv + 1]];
1025 node_t* nb = &actor->ar_nodes[actor->ar_cabs[tmpv + 2]];
1030 actor->ar_collision_range * 3.0f);
1040 float proximity = std::max(.05f, std::sqrt(std::max(
m_min_camera_radius, actor->m_min_camera_radius)) / 50.f);
1050 for (
int j = 0; j < actor->ar_num_nodes; j++)
1052 if (!actor->ar_nodes[j].nd_contacter && !actor->ar_nodes[j].nd_contactable)
1055 if (collision = query_position.squaredDistance(actor->ar_nodes[j].AbsPosition) < proximity)
1094 if (collision = this->
Intersects(actor, collision_offset))
1102 collision_offset += direction * 0.05f;
1105 return collision_offset;
1118 if (offset == Vector3::ZERO)
1122 offset += 0.2f * Vector3(offset.x, 0.0f, offset.z).normalisedCopy();
1135 Vector3 u = Vector3::UNIT_Y;
1137 Vector3 l = u.crossProduct(f);
1142 Vector3 lateral = left.length() < right.length() * 1.1f ? left : right;
1146 Vector3 sagittal = front.length() < back.length() * 1.1f ? front : back;
1148 Vector3 offset = lateral.length() < sagittal.length() * 1.2f ? lateral : sagittal;
1153 if (up.length() * 1.2f < offset.length())
1157 if (offset == Vector3::ZERO)
1161 offset += 0.2f * Vector3(offset.x, 0.0f, offset.z).normalisedCopy();
1186 Vector3 aposition = Vector3::ZERO;
1215 const float CABNODE_MAX_CAMDIST = 15.f;
1226 if (mainCamPos.squaredDistance(
ar_nodes[i].
RelPosition) < (CABNODE_MAX_CAMDIST*CABNODE_MAX_CAMDIST))
1252 if (
ar_nodes[0].RelPosition.squaredLength() > 10000.0)
1270 matrix.FromEulerAnglesXYZ(Radian(0), Radian(-rot +
m_spawn_rotation), Radian(0));
1307 vertical_offset += std::max(0.0f,
App::GetGameContext()->GetTerrain()->getWater()->GetStaticWaterHeight() - miny);
1311 if (
ar_nodes[i].nd_no_ground_contact)
1314 vertical_offset += std::max(0.0f, terrainHeight - (
ar_nodes[i].AbsPosition.y + vertical_offset));
1323 float mesh_offset = 0.0f;
1326 if (mesh_offset >= 1.0f)
1328 if (
ar_nodes[i].nd_no_ground_contact)
1330 float offset = mesh_offset;
1331 while (offset < 1.0f)
1334 if (!
App::GetGameContext()->GetTerrain()->GetCollisions()->collisionCorrect(&query,
false))
1336 mesh_offset = offset;
1354 if (translation != Vector3::ZERO)
1364 if (setInitPosition)
1428 _L(
"No inter-axle differential installed on current vehicle!"),
"error.png");
1432 String message =
"";
1447 "Inter-axle differentials:\n" + message,
"cog.png");
1456 _L(
"No inter-wheel differential installed on current vehicle!"),
"error.png");
1460 String message =
"";
1468 message +=
_L(
"Axle ") +
TOSTRING(i + 1) +
": ";
1473 "Inter-wheel differentials:\n" + message,
"cog.png");
1487 _L(
"No transfercase installed on current vehicle!"),
"error.png");
1530 std::rotate(gear_ratios->begin(), gear_ratios->begin() + 1, gear_ratios->end());
1552 Vector3 sum = Vector3::ZERO;
1553 std::vector<Vector3> positions;
1557 const auto it = std::find_if(positions.begin(), positions.end(),
1558 [pos](
const Vector3 ref) { return pos.positionEquals(ref, 0.01f); });
1559 if (it == positions.end())
1562 positions.push_back(pos);
1565 return sum / positions.size();
1570 float height = std::numeric_limits<float>::max();
1573 if (!skip_virtual_nodes || !
ar_nodes[i].nd_no_ground_contact)
1575 height = std::min(
ar_nodes[i].AbsPosition.y, height);
1578 return (!skip_virtual_nodes || height < std::numeric_limits<float>::max()) ? height :
getMinHeight(
false);
1583 float height = std::numeric_limits<float>::min();
1586 if (!skip_virtual_nodes || !
ar_nodes[i].nd_no_ground_contact)
1588 height = std::max(height,
ar_nodes[i].AbsPosition.y);
1591 return (!skip_virtual_nodes || height > std::numeric_limits<float>::min()) ? height :
getMaxHeight(
false);
1596 float agl = std::numeric_limits<float>::max();
1599 if (!skip_virtual_nodes || !
ar_nodes[i].nd_no_ground_contact)
1605 return (!skip_virtual_nodes || agl < std::numeric_limits<float>::max()) ? agl :
getHeightAboveGround(
false);
1610 float agl = std::numeric_limits<float>::max();
1613 if (!skip_virtual_nodes || !
ar_nodes[i].nd_no_ground_contact)
1619 return (!skip_virtual_nodes || agl < std::numeric_limits<float>::max()) ? agl :
getHeightAboveGroundBelow(height,
false);
1646 Vector3 translation = -agl * Vector3::UNIT_Y;
1650 actor->resetPosition(actor->ar_nodes[0].AbsPosition + translation,
false);
1713 h.hk_beam->bm_disabled =
true;
1718 t.ti_locked_ropable =
nullptr;
1719 t.ti_beam->bm_disabled =
true;
1726 r.attached_ties = 0;
1727 r.attached_ropes = 0;
1748 for (
int i = 0; i < num_axle_diffs; i++)
1767 hydrobeam.hb_inertia.ResetCmdKeyDelay();
1773 if (!reset_position)
1800 b.cmb_state->auto_moving_mode = 0;
1801 b.cmb_state->pressed_center_mode =
false;
1848#ifdef USE_ANGELSCRIPT
1899 float sum_movement = 0.0f;
1900 float movement = 0.0f;
1901 float sum_velocity = 0.0f;
1902 float velocity = 0.0f;
1903 float sum_stress = 0.0f;
1904 float stress = 0.0f;
1913 movement = std::max(movement, v);
1920 velocity = std::max(velocity, std::abs(v));
1922 stress = std::max(stress, std::abs(
ar_beams[i].stress));
1923 if (k == 0 &&
ar_beams[i].bm_broken)
1941 ar_nb_optimum = {stress, sum_stress, velocity, sum_velocity, movement, sum_movement, (float)sum_broken};
1956 float rotation = Radian(
getRotation()).valueDegrees();
2008 std::string bq_filename = fmt::format(
"{}:{}", bname,
ar_filename);
2009 strncpy(reg.
name, bq_filename.c_str(), 128);
2044 unsigned int packet_len = 0;
2062 send_oob->
flagmask += NETMASK_ENGINE_CONT;
2064 send_oob->
flagmask += NETMASK_ENGINE_RUN;
2093 send_oob->
flagmask += NETMASK_PARTICLE;
2096 send_oob->
flagmask += NETMASK_PBRAKE;
2098 send_oob->
flagmask += NETMASK_TC_ACTIVE;
2100 send_oob->
flagmask += NETMASK_ALB_ACTIVE;
2103 send_oob->
flagmask += NETMASK_HORN;
2113 float* send_nodes = (
float *)ptr;
2121 send_nodes[0] = refpos.x;
2122 send_nodes[1] = refpos.y;
2123 send_nodes[2] = refpos.z;
2125 ptr +=
sizeof(float) * 3;
2128 half_float::half* sbuf = (half_float::half*)ptr;
2132 sbuf[(i-1) * 3 + 0] =
static_cast<half_float::half
>(relpos.x);
2133 sbuf[(i-1) * 3 + 1] =
static_cast<half_float::half
>(relpos.y);
2134 sbuf[(i-1) * 3 + 2] =
static_cast<half_float::half
>(relpos.z);
2136 ptr +=
sizeof(half_float::half) * 3;
2140 float* wfbuf = (
float*)ptr;
2153 char& dst_byte = *(ptr + (i / 8));
2204 if (name ==
"Split")
2206 if (name ==
"Locked")
2220 cstate = (heading * 57.29578f) / 360.0f;
2231 cstate -= torque / 10.0f;
2235 if (cstate <= -1.0f)
2284 else if (shifter < 0)
2290 cstate -= int((shifter - 1.0) / 2.0);
2306 cstate = shifter % 2;
2316 cstate -= (shifter + 2.0) / (numgears + 2.0);
2332 cstate -= speedo * 3.0f;
2348 cstate -= turbo / 67.0f;
2363 cstate -= accel + 0.06f;
2372 cstate -= fabs(1.0f - clutch);
2385 angle = -5.0 + pcent * 1.9167;
2386 else if (pcent < 110.0)
2387 angle = 110.0 + (pcent - 60.0) * 4.075;
2390 cstate -= angle / 314.0f;
2412 cstate = tp->
pitch / 120.0f;
2433 float sea_level_pressure = 101325;
2434 float airpressure = sea_level_pressure * pow(1.0 - 0.0065 * altitude / 288.15, 5.24947);
2435 float airdensity = airpressure * 0.0000120896;
2436 float kt = ground_speed_kt * sqrt(airdensity / 1.225);
2437 cstate -= kt / 100.0f;
2446 cstate -= vvi / 6000.0f;
2449 if (cstate <= -1.0f)
2461 int alti_int = int(altimeter);
2462 float alti_mod = (altimeter - alti_int);
2470 int alti_int = int(alti);
2471 float alti_mod = (alti - alti_int);
2473 if (cstate <= -1.0f)
2482 if (cstate <= -1.0f)
2494 if ((
ar_nodes[0].Velocity.length() * 1.9438) < 10.0f)
2497 if (cstate <= -1.0f)
2509 Vector3 upv = dirv.crossProduct(-rollv);
2510 float rollangle = asin(rollv.dotProduct(Vector3::UNIT_Y));
2512 rollangle = Math::RadiansToDegrees(rollangle);
2515 rollangle = 180.0f - rollangle;
2516 cstate = rollangle / 180.0f;
2520 cstate = cstate - 2.0f;
2528 float pitchangle = asin(dirv.dotProduct(Vector3::UNIT_Y));
2530 cstate = (Math::RadiansToDegrees(pitchangle) / 90.0f);
2539 cstate -= airbrake / 5.0f;
2581 float logafactor = 1.0f;
2585 logafactor = std::min(logafactor * logafactor, 1.0f);
2595 float logafactor = 1.0f;
2596 if (
ar_beams[i].shortbound != 0.0f)
2599 logafactor = std::min(logafactor * logafactor, 1.0f);
2610 if (difftoBeamL > longboundprelimit)
2616 float logafactor = 1.0f;
2620 logafactor = std::min(logafactor * logafactor, 1.0f);
2629 logafactor = std::min(logafactor * logafactor, 1.0f);
2631 k += (k + 100.0f) *
ar_beams[i].shock->sprogout * logafactor;
2632 d += (d + 100.0f) *
ar_beams[i].shock->dprogout * logafactor;
2640 else if (difftoBeamL < shortboundprelimit)
2646 float logafactor = 1.0f;
2647 if (
ar_beams[i].shortbound != 0.0f)
2650 logafactor = std::min(logafactor * logafactor, 1.0f);
2656 if (
ar_beams[i].shortbound != 0.0f)
2659 logafactor = std::min(logafactor * logafactor, 1.0f);
2661 k += (k + 100.0f) *
ar_beams[i].shock->sprogout * logafactor;
2662 d += (d + 100.0f) *
ar_beams[i].shock->dprogout * logafactor;
2673 k = std::max(k,
ar_beams[i].shock->sbd_spring);
2674 d = std::max(d,
ar_beams[i].shock->sbd_damp);
2701 v = Math::Clamp(std::abs(v), +0.15f, +20.0f);
2709 v = Math::Clamp(std::abs(v), +0.15f, +20.0f);
2726 if (
ar_beams[i].shock->trigger_switch_state <= 0.0f)
2736 LOG(
" Trigger disabled. Blocker BeamID " +
TOSTRING(i) +
" enabled trigger " +
TOSTRING(scount));
2751 LOG(
" Trigger enabled. Inverted Blocker BeamID " +
TOSTRING(i) +
" disabled trigger " +
TOSTRING(scount));
2763 LOG(
" F-key trigger block released. Blocker BeamID " +
TOSTRING(i) +
" Released F" +
TOSTRING(
ar_beams[i].shock->trigger_cmdshort));
2769 if (!
ar_beams[i].shock->trigger_switch_state)
2778 if (((short1 == short2 && long1 == long2) || (short1 == long2 && long1 == short2)) && i != tmpi)
2838 LOG(
" Trigger Longbound activated. Trigger BeamID " +
TOSTRING(i) +
" Triggered F" +
TOSTRING(
ar_beams[i].shock->trigger_cmdlong));
2890 LOG(
" Trigger Shortbound activated. Trigger BeamID " +
TOSTRING(i) +
" Triggered F" +
TOSTRING(
ar_beams[i].shock->trigger_cmdshort));
2904 float diffPercentage = difftoBeamL /
ar_beams[i].
L;
2907 triggerValue = std::max(0.0f, triggerValue);
2908 triggerValue = std::min(triggerValue, 1.0f);
2930 LOG(
" Trigger enabled. Blocker BeamID " +
TOSTRING(i) +
" disabled trigger " +
TOSTRING(scount));
2945 LOG(
" Trigger disabled. Inverted Blocker BeamID " +
TOSTRING(i) +
" enabled trigger " +
TOSTRING(scount));
2957 LOG(
" Trigger switch reset. Switch BeamID " +
TOSTRING(i));
2978 else if (intensity < 0)
2992 else if (flapsLevel < 0)
3009 if (!n || !n->nd_has_ground_contact || n->nd_last_collision_gm ==
nullptr ||
3014 if (n->nd_avg_collision_slip > 6.f && n->nd_last_collision_slip.squaredLength() > 9.f)
3016 m_skid_trails[i]->
update(n->AbsPosition, j, n->nd_avg_collision_slip, n->nd_last_collision_gm->name);
3031 MaterialPtr seatmat = (MaterialPtr)(MaterialManager::getSingleton().getByName(
"driversseat"));
3032 seatmat->setDepthWriteEnabled(
false);
3033 seatmat->setSceneBlending(SBT_TRANSPARENT_ALPHA);
3045 MaterialPtr seatmat = (MaterialPtr)(MaterialManager::getSingleton().getByName(
"driversseat"));
3046 seatmat->setDepthWriteEnabled(
true);
3047 seatmat->setSceneBlending(SBT_REPLACE);
3086 for (
size_t i = 0; i <
ar_flares.size(); i++)
3096 for (
size_t i = 0; i < this->
ar_flares.size(); i++)
3114 bool isvisible =
false;
3131 isvisible = isvisible &&
ar_flares[i].blinkdelay_state;
3148 ar_flares[i].intensity = (float)isvisible;
3229 if ((
m_lightmask & LIGHTMASK_HEADLIGHT) != (lightmask & LIGHTMASK_HEADLIGHT))
3231 if ((
m_lightmask & LIGHTMASK_BEACONS) != (lightmask & LIGHTMASK_BEACONS))
3235 if ((lightmask & LIGHTMASK_BLINK_LEFT) != 0)
3237 else if ((lightmask & LIGHTMASK_BLINK_RIGHT) != 0)
3239 else if ((lightmask & LIGHTMASK_BLINK_WARN) != 0)
3287 Vector3 ref(Vector3::UNIT_Y);
3306 float autoaileron = 0;
3307 float autorudder = 0;
3308 float autoelevator = 0;
3320 if (autoaileron < -1.0)
3322 if (autoaileron > 1.0)
3324 if (autorudder < -1.0)
3326 if (autorudder > 1.0)
3328 if (autoelevator < -1.0)
3329 autoelevator = -1.0;
3330 if (autoelevator > 1.0)
3378 std::pair<ActorPtr, ActorPtr> actor_pair(
this, other);
3382 if (linked_before != linked_now)
3387 actor->DetermineLinkedActors();
3391 actor->DetermineLinkedActors();
3428 if (linked_before != linked_now)
3433 actor->DetermineLinkedActors();
3441 actor->DetermineLinkedActors();
3448 actor->ar_physics_paused =
false;
3488 bool istied =
false;
3490 for (std::vector<tie_t>::iterator it =
ar_ties.begin(); it !=
ar_ties.end(); it++)
3493 if (group != -1 && (it->ti_group != -1 && it->ti_group != group))
3498 && forceunlock_filter !=
ACTORINSTANCEID_INVALID && it->ti_locked_actor && it->ti_locked_actor->ar_instance_id != forceunlock_filter)
3506 istied = !it->ti_beam->bm_disabled;
3509 it->ti_tied =
false;
3510 it->ti_tying =
false;
3511 if (it->ti_locked_ropable)
3512 it->ti_locked_ropable->attached_ties--;
3515 it->ti_beam->bm_inter_actor =
false;
3516 it->ti_beam->bm_disabled =
true;
3517 if (it->ti_locked_actor !=
this)
3521 it->ti_locked_actor =
nullptr;
3528 for (std::vector<tie_t>::iterator it =
ar_ties.begin(); it !=
ar_ties.end(); it++)
3531 if (group != -1 && (it->ti_group != -1 && it->ti_group != group))
3537 float mindist = it->ti_beam->refL;
3538 node_t* nearest_node = 0;
3545 (actor ==
this && it->ti_no_self_lock))
3551 for (std::vector<ropable_t>::iterator itr = actor->ar_ropables.begin(); itr != actor->ar_ropables.end(); itr++)
3554 if (!itr->multilock && itr->attached_ties > 0)
3558 if (
this == actor.GetRef() && itr->node->pos == it->ti_beam->p1->pos)
3562 float dist = (it->ti_beam->p1->AbsPosition - itr->node->AbsPosition).length();
3566 nearest_node = itr->node;
3567 nearest_actor = actor;
3568 locktedto = &(*itr);
3576 it->ti_beam->bm_disabled =
false;
3578 it->ti_locked_actor = nearest_actor;
3579 it->ti_beam->p2 = nearest_node;
3580 it->ti_beam->bm_inter_actor = nearest_actor !=
this;
3581 it->ti_beam->stress = 0;
3582 it->ti_beam->L = it->ti_beam->refL;
3584 it->ti_tying =
true;
3585 it->ti_locked_ropable = locktedto;
3587 if (it->ti_beam->bm_inter_actor)
3605 for (std::vector<rope_t>::iterator it =
ar_ropes.begin(); it !=
ar_ropes.end(); it++)
3608 if (group != -1 && (it->rp_group != -1 && it->rp_group != group))
3613 && forceunlock_filter !=
ACTORINSTANCEID_INVALID && it->rp_locked_actor && it->rp_locked_actor->ar_instance_id != forceunlock_filter)
3623 if (it->rp_locked_ropable)
3624 it->rp_locked_ropable->attached_ropes--;
3625 if (it->rp_locked_actor !=
this)
3629 it->rp_locked_actor =
nullptr;
3630 it->rp_locked_ropable =
nullptr;
3636 float mindist = it->rp_beam->L;
3645 for (std::vector<ropable_t>::iterator itr = actor->ar_ropables.begin(); itr != actor->ar_ropables.end(); itr++)
3648 if (!itr->multilock && itr->attached_ropes > 0)
3652 float dist = (it->rp_beam->p1->AbsPosition - itr->node->AbsPosition).length();
3656 nearest_actor = actor;
3666 it->rp_locked_ropable = rop;
3668 if (nearest_actor !=
this)
3684 for (std::vector<hook_t>::iterator it =
ar_hooks.begin(); it !=
ar_hooks.end(); it++)
3694 if (it->hk_group <= -2)
3700 if (it->hk_group >= -1 || !it->hk_autolock)
3706 if (it->hk_group >= -1 || !it->hk_autolock)
3712 if (it->hk_group != group)
3727 && forceunlock_filter !=
ACTORINSTANCEID_INVALID && it->hk_locked_actor && it->hk_locked_actor->ar_instance_id != forceunlock_filter)
3732 ActorPtr prev_locked_actor = it->hk_locked_actor;
3739 float mindist = it->hk_lockrange;
3740 float distance = 100000000.0f;
3746 if (
this == actor.GetRef() && !it->hk_selflock)
3749 node_t* nearest_node =
nullptr;
3750 for (
int i = 0; i < actor->ar_num_nodes; i++)
3753 if (actor->ar_nodes[i].nd_lockgroup == 9999)
3757 if (
this == actor.GetRef() && i == it->hk_hook_node->pos)
3761 if (it->hk_lockgroup != -1 && it->hk_lockgroup != actor->ar_nodes[i].nd_lockgroup)
3765 float n2n_distance = (it->hk_hook_node->AbsPosition - actor->ar_nodes[i].AbsPosition).length();
3766 if (n2n_distance < mindist)
3768 if (distance >= n2n_distance)
3771 distance = n2n_distance;
3772 nearest_node = &actor->ar_nodes[i];
3779 it->hk_lock_node = nearest_node;
3780 it->hk_locked_actor = actor;
3783 if (it->hk_beam->bm_disabled)
3785 it->hk_beam->p2 = it->hk_lock_node;
3786 it->hk_beam->bm_inter_actor = (it->hk_locked_actor !=
nullptr);
3787 it->hk_beam->L = (it->hk_hook_node->AbsPosition - it->hk_lock_node->AbsPosition).length();
3788 it->hk_beam->bm_disabled =
false;
3800 if (it->hk_group <= -2)
3805 it->hk_lock_node = 0;
3806 it->hk_locked_actor = 0;
3809 it->hk_beam->bm_inter_actor =
false;
3811 it->hk_beam->bm_disabled =
true;
3915 int totallivebeams = 0;
3921 return totallivebeams;
3926 for (std::vector<tie_t>::iterator it =
ar_ties.begin(); it !=
ar_ties.end(); it++)
3934 for (std::vector<hook_t>::iterator it =
ar_hooks.begin(); it !=
ar_hooks.end(); it++)
3935 if (it->hk_locked ==
LOCKED)
3957 String str = String();
3973 str = ((cg ==
Engine::REAR) ?
"#ffffff" :
"#868686") + String(
"R\n");
3974 str += ((cg ==
Engine::NEUTRAL) ?
"#ff0012" :
"#8a000a") + String(
"N\n");
3975 str += ((cg ==
Engine::DRIVE) ?
"#12ff00" :
"#248c00") + String(
"D\n");
3976 str += ((cg ==
Engine::TWO) ?
"#ffffff" :
"#868686") + String(
"2\n");
3977 str += ((cg ==
Engine::ONE) ?
"#ffffff" :
"#868686") + String(
"1");
3982 str =
"#b8b8b8M\na\nn\nu";
4027 if (cam_dir != Vector3::ZERO)
4029 velocity = cam_dir.dotProduct(
ar_nodes[0].Velocity);
4043 if (cam_roll != Vector3::ZERO)
4045 float angle = asin(cam_roll.dotProduct(Vector3::UNIT_Y));
4047 float f = Radian(angle).valueDegrees();
4063 if (cam_dir != Vector3::ZERO)
4065 float angle = asin(cam_dir.dotProduct(Vector3::UNIT_Y));
4067 float f = Radian(angle).valueDegrees();
4087 int dash_tc_mode = 1;
4101 int dash_alb_mode = 1;
4183 float sea_level_pressure = 101325;
4185 float airpressure = sea_level_pressure * pow(1.0f - 0.0065f * altitude / 288.15f, 5.24947f);
4186 float airdensity = airpressure * 0.0000120896f;
4188 float knots = ground_speed_kt * sqrt(airdensity / 1.225f);
4198 sprintf(altc,
"%03u", (
int)(
ar_nodes[0].AbsPosition.y / 30.48f));
4209 bool hasEngine = (
ar_engine !=
nullptr);
4210 bool hasturbo =
false;
4211 bool autogearVisible =
false;
4273 Vector3 rollv=curr_truck->ar_nodes[curr_truck->ar_camera_node_pos[0]].RelPosition-curr_truck->ar_nodes[curr_truck->ar_camera_node_roll[0]].RelPosition;
4275 float rollangle=asin(rollv.dotProduct(Vector3::UNIT_Y));
4278 Vector3 dirv=curr_truck->ar_nodes[curr_truck->ar_camera_node_pos[0]].RelPosition-curr_truck->ar_nodes[curr_truck->ar_camera_node_dir[0]].RelPosition;
4280 float pitchangle=asin(dirv.dotProduct(Vector3::UNIT_Y));
4281 Vector3 upv=dirv.crossProduct(-rollv);
4282 if (upv.y<0) rollangle=3.14159-rollangle;
4288 Vector3 idir=curr_truck->ar_nodes[curr_truck->ar_camera_node_pos[0]].RelPosition-curr_truck->ar_nodes[curr_truck->ar_camera_node_dir[0]].RelPosition;
4290 float dirangle=atan2(idir.dotProduct(Vector3::UNIT_X), idir.dotProduct(-Vector3::UNIT_Z));
4292 if (curr_truck->autopilot)
4297 curr_truck->autopilot->getRadioFix(localizers, free_localizer, &vdev, &hdev);
4298 if (hdev>15) hdev=15;
4299 if (hdev<-15) hdev=-15;
4301 if (vdev>15) vdev=15;
4302 if (vdev<-15) vdev=-15;
4307 float vvi=curr_truck->ar_nodes[0].Velocity.y*196.85;
4308 if (vvi<1000.0 && vvi>-1000.0) angle=vvi*0.047;
4309 if (vvi>1000.0 && vvi<6000.0) angle=47.0+(vvi-1000.0)*0.01175;
4310 if (vvi>6000.0) angle=105.75;
4311 if (vvi<-1000.0 && vvi>-6000.0) angle=-47.0+(vvi+1000.0)*0.01175;
4312 if (vvi<-6000.0) angle=-105.75;
4323 if (pcent<60.0) angle=-5.0+pcent*1.9167;
4324 else if (pcent<110.0) angle=110.0+(pcent-60.0)*4.075;
4336 if (pcent<60.0) angle=-5.0+pcent*1.9167;
4337 else if (pcent<110.0) angle=110.0+(pcent-60.0)*4.075;
4349 if (pcent<60.0) angle=-5.0+pcent*1.9167;
4350 else if (pcent<110.0) angle=110.0+(pcent-60.0)*4.075;
4362 if (pcent<60.0) angle=-5.0+pcent*1.9167;
4363 else if (pcent<110.0) angle=110.0+(pcent-60.0)*4.075;
4376 ar_dashboard->
update(dt);
4383 Vector3 cam_up = cam_dir.crossProduct(cam_roll);
4436 unsigned int vector_index,
4441 : ar_nb_optimum(7, std::numeric_limits<float>::max())
4442 , ar_nb_reference(7, std::numeric_limits<float>::max())
4443 , m_tyre_pressure(this)
4444 , ar_nb_beams_scale(std::make_pair(1.0f, 1.0f))
4445 , ar_nb_shocks_scale(std::make_pair(1.0f, 1.0f))
4446 , ar_nb_wheels_scale(std::make_pair(1.0f, 1.0f))
4447 , ar_nb_beams_k_interval(std::make_pair(0.1f, 2.0f))
4448 , ar_nb_beams_d_interval(std::make_pair(0.1f, 2.0f))
4449 , ar_nb_shocks_k_interval(std::make_pair(0.1f, 8.0f))
4450 , ar_nb_shocks_d_interval(std::make_pair(0.1f, 8.0f))
4451 , ar_nb_wheels_k_interval(std::make_pair(1.0f, 1.0f))
4452 , ar_nb_wheels_d_interval(std::make_pair(1.0f, 1.0f))
4455 , m_avg_node_position_prev(rq.asr_position)
4457 , m_avg_node_position(rq.asr_position)
4458 , ar_instance_id(actor_id)
4459 , ar_vector_index(vector_index)
4460 , m_avg_proped_wheel_radius(0.2f)
4461 , ar_filename(rq.asr_cache_entry->fname)
4462 , m_section_config(rq.asr_config)
4463 , m_used_actor_entry(rq.asr_cache_entry)
4464 , m_used_skin_entry(rq.asr_skin_entry)
4465 , m_working_tuneup_def(rq.asr_working_tuneup)
4468 , ar_update_physics(false)
4469 , ar_disable_aerodyn_turbulent_drag(false)
4470 , ar_engine_hydraulics_ready(true)
4471 , ar_guisettings_use_engine_max_rpm(false)
4472 , ar_hydro_speed_coupling(false)
4473 , ar_collision_relevant(false)
4474 , ar_is_police(false)
4475 , ar_rescuer_flag(false)
4476 , ar_forward_commands(false)
4477 , ar_import_commands(false)
4478 , ar_toggle_ropes(false)
4479 , ar_toggle_ties(false)
4482 , m_hud_features_ok(false)
4483 , m_slidenodes_locked(false)
4484 , m_net_initialized(false)
4485 , m_water_contact(false)
4486 , m_water_contact_old(false)
4487 , m_has_command_beams(false)
4488 , ar_cparticles_active(false)
4489 , m_beam_break_debug_enabled(false)
4490 , m_beam_deform_debug_enabled(false)
4491 , m_trigger_debug_enabled(false)
4492 , m_disable_default_sounds(false)
4493 , m_disable_smoke(false)
4543 LOG(fmt::format(
"invalid custom-light ID {}, allowed range is 0-{}", number,
MAX_CLIGHTS-1));
4565 LOG(fmt::format(
"invalid Light ID {}, allowed range is 0-{}", number,
MAX_CLIGHTS-1));
4585 LOG(fmt::format(
"invalid custom-light ID {}, allowed range is 0-{}", number,
MAX_CLIGHTS-1));
4590 for (
int i = 0; i <
ar_flares.size(); i++)
4592 if (
ar_flares[i].controlnumber == number)
4601 for (
int i = 0; i <
ar_flares.size(); i++)
4677 return Ogre::MaterialPtr();
4682 std::vector<std::string> names;
4685 names.push_back(it->first);
4698 return Ogre::Vector3::ZERO;
4734 return Ogre::Vector3::ZERO;
4746 return Ogre::Vector3::ZERO;
4760 overrideMass =
false;
4791 std::stringstream buf;
4793 buf <<
"[nodes]" << std::endl;
4803 <<
", loaded:" << (int)(
ar_nodes[i].nd_loaded_mass)
4805 <<
" wheel_rim:" << (int)
ar_nodes[i].nd_rim_node
4807 <<
" (set_node_defaults)"
4821 buf <<
"[beams]" << std::endl;
4825 <<
" " << std::setw(4) << i
4829 <<
" (set_beam_defaults/scale)"
4830 <<
" spring:" << std::setw(8) <<
ar_beams[i].
k
4831 <<
", damp:" << std::setw(8) <<
ar_beams[i].
d
4841 Ogre::DataStreamPtr outStream = Ogre::ResourceGroupManager::getSingleton().createResource(fileName,
RGN_LOGS,
true);
4842 std::string text = buf.str();
4843 outStream->write(text.c_str(), text.length());
4851 if (state.eventlock_present)
4854 if (ev_active && (ev_active != state.event_active_prev))
4856 state.anim_active = !state.anim_active;
4862 state.anim_active = ev_active;
4864 state.event_active_prev = ev_active;
4962 "Cannot change simulation attributes in multiplayer mode.");
5064 default:
return 0.f;
void PadBoundingBox(Ogre::AxisAlignedBox &box)
static const Ogre::Vector3 BOUNDING_BOX_PADDING(0.05f, 0.05f, 0.05f)
static void debugLogNodeMass(Actor *actor)
Central state/object manager and communications hub.
#define ROR_ASSERT(_EXPR)
void LOG(const char *msg)
Legacy alias - formerly a macro.
#define BITMASK_SET_0(VAR, FLAGS)
void BITMASK_SET(BitMask_t &mask, BitMask_t flag, bool val)
#define BITMASK_SET_1(VAR, FLAGS)
A database of user-installed content alias 'mods' (vehicles, terrains...)
#define DD_MAX_AEROENGINE
Game state manager and message-queue provider.
Manager for all visuals belonging to a single actor.
This creates a billboarding object that displays a text.
static const int MAX_CLIGHTS
See RoRnet::Lightmask and enum events in InputEngine.h.
static const int MAX_COMMANDS
maximum number of commands per actor
Core data structures for simulation; Everything affected by by either physics, network or user intera...
#define SOUND_GET_STATE(_ACTOR_, _TRIG_)
#define SOUND_START(_ACTOR_, _TRIG_)
#define SOUND_STOP(_ACTOR_, _TRIG_)
#define SOUND_PLAY_ONCE(_ACTOR_, _TRIG_)
#define SOUND_MODULATE(_ACTOR_, _MOD_, _VALUE_)
Softbody object; can be anything from soda can to a space shuttle Constructed from a truck definition...
Ogre::String getTransferCaseName()
Toggles between Hi and Lo mode.
bool alb_mode
Anti-lock brake state; Enabled? {1/0}.
std::pair< float, float > ar_nb_wheels_k_interval
Search interval for springiness & damping of wheel / rim beams.
float m_odometer_user
GUI state.
std::vector< std::vector< int > > ar_node_to_beam_connections
BitMask_t ar_forced_cinecam_flags
Sim state; flags for forced CineCam supplied by script.
std::pair< float, float > ar_nb_shocks_k_interval
Search interval for springiness & damping of shock beams.
NodeNum_t ar_custom_camera_node
Sim state; custom tracking node for 3rd-person camera.
Ogre::AxisAlignedBox ar_bounding_box
standard bounding box (surrounds all nodes of an actor)
int ar_nb_measure_steps
Amount of physics steps to be measured.
int m_wheel_node_count
Static attr; filled at spawn.
size_t m_net_total_buffer_size
For incoming/outgoing traffic; calculated on spawn.
float ar_collision_range
Physics attr.
bool m_antilockbrake
GUI state.
std::vector< Ogre::AxisAlignedBox > ar_predicted_coll_bounding_boxes
std::vector< float > ar_minimass
minimum node mass in Kg - can be scaled in-game via NBUtil
TransferCase * m_transfer_case
Physics.
float ar_guisettings_speedo_max_kph
float ar_dry_mass
User-defined (editable via NBUtil); from 'globals' arg#1 - default for all nodes.
int ar_airbrake_intensity
Physics state; values 0-5.
void toggleTransferCaseGearRatio()
bool m_blinker_left_lit
Blinking state of left turn signal.
float ar_hydro_elevator_state
std::pair< float, float > ar_nb_beams_scale
Scales for springiness & damping of regular beams.
bool ar_forward_commands
Sim state.
void toggleSlideNodeLock()
void engineTriggerHelper(int engineNumber, EngineTriggerType type, float triggerValue)
void resetSlideNodes()
Reset all the SlideNodes.
CacheEntryPtr & getUsedSkinEntry()
void antilockbrakeToggle()
bool m_ongoing_reset
Hack to prevent position/rotation creep during interactive truck reset (aka LiveRepair).
void calcNodeConnectivityGraph()
float m_mouse_grab_move_force
void sendStreamData()
Send outgoing data.
float ar_wheel_speed
Physics state; wheel speed in m/s.
void updateSkidmarks()
Creates or updates skidmarks.
collcab_rate_t ar_intra_collcabrate[MAX_CABS]
std::vector< float > ar_nodes_override_loadweights
'nodes': 'l' flag and number.
CacheEntryPtrVec & getUsedAddonpartEntries()
Ogre::AxisAlignedBox ar_evboxes_bounding_box
bounding box around nodes eligible for eventbox triggering
int GetNumActiveConnectedBeams(int nodeid)
Returns the number of active (non bounded) beams connected to a node.
std::vector< ropable_t > ar_ropables
CmdKeyArray ar_command_key
BEWARE: commandkeys are indexed 1-MAX_COMMANDS!
wheel_t ar_wheels[MAX_WHEELS]
std::vector< float > ar_nb_reference
Temporary storage of the reference search result.
std::vector< rope_t > ar_ropes
void hookToggle(int group=-1, ActorLinkingRequestType mode=ActorLinkingRequestType::HOOK_TOGGLE, NodeNum_t mousenode=NODENUM_INVALID, ActorInstanceID_t forceunlock_filter=ACTORINSTANCEID_INVALID)
NodeNum_t m_mouse_grab_node
Sim state; node currently being dragged by user.
DashBoardManagerPtr ar_dashboard
float m_odometer_total
GUI state.
float getSimAttribute(ActorSimAttr attr)
void prepareInside(bool inside)
Prepares vehicle for in-cabin camera use.
void displayTransferCaseMode()
Gets the current transfer case mode name (4WD Hi, ...)
int getWheelNodeCount() const
float getMaxHeight(bool skip_virtual_nodes=true)
bool getCustomParticleMode()
Ogre::Vector3 getNodeVelocity(int nodeNumber)
void ropeToggle(int group=-1, ActorLinkingRequestType mode=ActorLinkingRequestType::ROPE_TOGGLE, ActorInstanceID_t forceunlock_filter=ACTORINSTANCEID_INVALID)
Ogre::Vector3 m_camera_gforces
Physics state (global)
int ar_aerial_flap
Sim state; state of aircraft flaps (values: 0-5)
void dispose()
Effectively destroys the object but keeps it in memory to satisfy shared pointers.
void updateVisual(float dt=0)
bool isNodeWheelRim(int nodeNumber)
Is node marked as wheel rim? Note some wheel models use only tire nodes. See https://docs....
Ogre::AxisAlignedBox ar_predicted_bounding_box
void setNodeMass(int nodeNumber, float m)
void calculateLocalGForces()
Derive the truck local g-forces from the global ones.
int m_num_wheel_diffs
Physics attr.
void updateFlareStates(float dt)
int m_num_proped_wheels
Physics attr, filled at spawn - Number of propelled wheels.
Actor(ActorInstanceID_t actor_id, unsigned int vector_index, RigDef::DocumentPtr def, ActorSpawnRequest rq)
std::vector< Ogre::SceneNode * > m_deletion_scene_nodes
For unloading vehicle; filled at spawn.
Ogre::Vector3 m_camera_local_gforces_max
Physics state (camera local)
std::vector< tie_t > ar_ties
void NotifyActorCameraChanged()
Logic: sound, display; Notify this vehicle that camera changed;.
float ar_hydro_rudder_state
std::pair< float, float > ar_nb_wheels_scale
Scales for springiness & damping of wheel / rim beams.
bool m_water_contact_old
Scripting state.
void mouseMove(NodeNum_t node, Ogre::Vector3 pos, float force)
int m_anglesnap_request
Accumulator.
int m_num_axle_diffs
Physics attr.
float m_stabilizer_shock_ratio
Physics state.
float ar_posnode_spawn_height
CineCameraID_t ar_current_cinecam
Sim state; index of current CineCam (CINECAMERAID_INVALID if using 3rd-person camera)
ground_model_t * ar_submesh_ground_model
void updateDashBoards(float dt)
float tc_wheelslip_constant
use ACTORSIMATTR_TC_WHEELSLIP_CONSTANT
void DisjoinInterActorBeams()
Helper for MSG_ handlers, do not invoke by hand.
void importLightStateMask(BitMask_t lightmask)
Only for linked (locked/tied) actors forwarding flare states; see 'flaregroups_no_import' in ....
bool m_slidenodes_locked
Physics state; Are SlideNodes locked?
void clearForcedCinecam()
int * ar_nodes_id
Number in truck file, -1 for nodes generated by wheels/cinecam.
void updateInitPosition()
float getMinHeight(bool skip_virtual_nodes=true)
void toggleWheelDiffMode()
std::vector< std::pair< float, float > > ar_initial_beam_defaults
Differential * m_axle_diffs[1+MAX_WHEELS/2]
Physics.
ScrewpropPtr ar_screwprops[MAX_SCREWPROPS]
void removeWorkingTuneupDef()
Deletes the working tuneup def object if it exists.
void tieToggle(int group=-1, ActorLinkingRequestType mode=ActorLinkingRequestType::TIE_TOGGLE, ActorInstanceID_t forceunlock_filter=ACTORINSTANCEID_INVALID)
Replay * m_replay_handler
void setAirbrakeIntensity(float intensity)
NodeNum_t ar_main_camera_node_pos
Sim attr; ar_camera_node_pos[0] >= 0 ? ar_camera_node_pos[0] : 0.
Ogre::Vector3 getRotationCenter()
std::vector< Airbrake * > ar_airbrakes
void ResetAngle(float rot)
bool ar_physics_paused
Actor physics individually paused by user.
AeroEnginePtr getTurbojet(int index)
int getShockNode2(int shock_number)
void toggleBlinkType(BlinkType blink)
float getShockSpringRate(int shock_number)
Ogre::Vector3 getPosition()
bool m_tractioncontrol
GUI state.
void toggleTransferCaseMode()
void ForceFeedbackStep(int steps)
float ar_hydro_dir_command
Ogre::Vector3 getNodeForces(int nodeNumber)
void pushNetwork(char *data, int size)
Process incoming data; fills actor's data buffers and flips them. Called by the network thread....
std::vector< float > ar_nb_optimum
Temporary storage of the optimum search result.
Airfoil * m_fusealge_airfoil
Physics attr; defined in truckfile.
float ar_elevator
Sim state; aerial controller.
std::vector< Ogre::AxisAlignedBox > ar_collision_bounding_boxes
smart bounding boxes, used for determining the state of an actor (every box surrounds only a subset o...
void displayAxleDiffMode()
Cycles through the available inter axle diff modes.
void CalcShocks3(int i, Ogre::Real difftoBeamL, Ogre::Real &k, Ogre::Real &d, Ogre::Real v)
std::vector< authorinfo_t > getAuthors()
soundsource_t ar_soundsources[MAX_SOUNDSCRIPTS_PER_TRUCK]
std::vector< Ogre::Vector3 > ar_initial_node_positions
Absolute world positions, for resetting to pristine state.
void ensureWorkingTuneupDef()
Creates a working tuneup def if it doesn't exist yet.
std::pair< float, float > ar_nb_wheels_d_interval
Search interval for springiness & damping of wheel / rim beams.
void UpdatePhysicsOrigin()
void displayWheelDiffMode()
Cycles through the available inter wheel diff modes.
int ar_net_source_id
Unique ID of remote player who spawned this actor.
float ar_wheel_spin
Physics state; wheel speed in radians/s.
void recalculateNodeMasses()
std::vector< flare_t > ar_flares
std::pair< float, float > ar_nb_beams_d_interval
Search interval for springiness & damping of regular beams.
std::vector< Ogre::Entity * > m_deletion_entities
For unloading vehicle; filled at spawn.
std::unique_ptr< Buoyance > m_buoyance
bool alb_nodash
Anti-lock brake attribute: Hide the dashboard indicator?
AeroEnginePtr getAircraftEngine(int index)
Ogre::Vector3 calculateCollisionOffset(Ogre::Vector3 direction)
Virtually moves the actor at most 'direction.length()' meters towards 'direction' trying to resolve a...
int countFlaresByType(FlareType type)
std::vector< std::string > getManagedMaterialNames()
unsigned long ar_net_last_update_time
ExtCameraMode ar_extern_camera_mode
float ar_load_mass
User-defined (editable via NBUtil); from 'globals' arg#2 - only applies to nodes with 'l' flag.
int ar_masscount
Calculated; Number of nodes loaded with l option.
float getHeightAboveGround(bool skip_virtual_nodes=true)
void updateSoundSources()
bool m_blinker_right_lit
Blinking state of right turn signal.
PointColDetector * m_inter_point_col_detector
Physics.
float ar_hydro_elevator_command
BitMask_t m_flaregroups_no_import
RoRnet::Lightmask.
int m_stabilizer_shock_request
Physics state; values: { -1, 0, 1 }.
void setSimAttribute(ActorSimAttr attr, float val)
HAZARDOUS - values may not be checked; Pay attention to 'safe values' at each attribute description.
std::vector< RailGroup * > m_railgroups
all the available RailGroups for this actor
NodeNum_t ar_extern_camera_node
bool ar_engine_hydraulics_ready
Sim state; does engine have enough RPM to power hydraulics?
Ogre::Vector3 ar_origin
Physics state; base position for softbody nodes.
bool getCustomLightVisible(int number)
std::unique_ptr< GfxActor > m_gfx_actor
void RemoveInterActorBeam(beam_t *beam, ActorLinkingRequestType type)
Do not call directly - use MSG_SIM_ACTOR_LINKING_REQUESTED
void updateSlideNodePositions()
incrementally update the position of all SlideNodes
Ogre::Vector3 getDirection()
average actor velocity, calculated using the actor positions of the last two frames
float getHeightAboveGroundBelow(float height, bool skip_virtual_nodes=true)
Ogre::Vector3 m_translation_request
Accumulator.
AeroEnginePtr ar_aeroengines[MAX_AEROENGINES]
float ar_hydro_aileron_command
int ar_num_shocks
Number of shock absorbers.
void setNodeMassOptions(int nodeNumber, bool loaded, bool overrideMass)
float m_avionic_chatter_timer
Sound fx state (some pseudo random number, doesn't matter)
float ar_total_mass
Calculated; total mass in Kg.
void setLightStateMask(BitMask_t lightmask)
Does all the necessary toggling.
void applyNodeBeamScales()
For GUI::NodeBeamUtils.
void HandleInputEvents(float dt)
Ogre::Vector3 getNodePosition(int nodeNumber)
Returns world position of node.
float ar_hydro_aileron_state
float ar_anim_shift_timer
For 'animator' with flag 'shifter'.
void setForcedCinecam(CineCameraID_t cinecam_id, BitMask_t flags)
void WriteDiagnosticDump(std::string const &filename)
Ogre::MaterialPtr getManagedMaterialInstance(const std::string &orig_name)
std::map< std::string, Ogre::MaterialPtr > ar_managed_materials
void searchBeamDefaults()
Searches for more stable beam defaults.
float getShockVelocity(int shock_number)
void getNodeMassOptions(int nodeNumber, bool &loaded, bool &overrideMass)
std::vector< authorinfo_t > authors
int countCustomLights(int control_number)
std::vector< std::string > getDescription()
void UpdatePropAnimInputEvents()
void toggleAxleDiffMode()
ActorInstanceID_t ar_instance_id
Static attr; session-unique ID.
void autoBlinkReset()
Resets the turn signal when the steering wheel is turned back.
void setCustomLightVisible(int number, bool visible)
float ar_rudder
Sim state; aerial/marine controller.
ActorPtrVec ar_linked_actors
BEWARE: Includes indirect links, see DetermineLinkedActors(); Other actors linked using 'hooks/ties/r...
bool alb_notoggle
Anti-lock brake attribute: Disable in-game toggle?
void SyncReset(bool reset_position)
this one should be called only synchronously (without physics running in background)
float ar_avg_wheel_speed
Physics state; avg wheel speed in m/s.
std::vector< PropAnimKeyState > m_prop_anim_key_states
Ogre::Real ar_brake
Physics state; braking intensity.
bool ar_minimass_skip_loaded_nodes
std::string ar_filename
Attribute; filled at spawn.
std::string * ar_nodes_name
Name in truck file, only if defined with 'nodes2'.
bool ar_cparticles_active
Gfx state.
void CalcShocks2(int i, Ogre::Real difftoBeamL, Ogre::Real &k, Ogre::Real &d, Ogre::Real v)
Ogre::Real m_min_camera_radius
virtual ~Actor() override
int ar_num_cinecams
Sim attr;.
bool getBeaconMode() const
CacheEntryPtr m_used_actor_entry
Required.
GfxFlaresMode m_flares_mode
Snapshot of cvar 'gfx_flares_mode' on spawn.
std::string m_section_config
Classic 'sectionconfig' in truck file.
bool cc_mode
Cruise Control.
bool isNodeWheelTire(int nodeNumber)
Is node marked as wheel tire? Note some wheel models use only tire nodes. See https://docs....
void CalcAnimators(hydrobeam_t const &hydrobeam, float &cstate, int &div)
Differential * m_wheel_diffs[MAX_WHEELS/2]
Physics.
std::deque< NetUpdate > m_net_updates
Incoming stream of NetUpdates.
void parkingbrakeToggle()
Ogre::Real getMinimalCameraRadius()
bool m_water_contact
Scripting state.
float ar_hydro_rudder_command
Skidmark * m_skid_trails[MAX_WHEELS *2]
std::vector< beam_t * > ar_inter_beams
Beams connecting 2 actors.
void CalcForcesEulerCompute(bool doUpdate, int num_steps)
Ogre::Quaternion ar_main_camera_dir_corr
Sim attr;.
Ogre::Vector3 m_mouse_grab_pos
std::pair< float, float > ar_nb_shocks_scale
Scales for springiness & damping of shock beams.
void setBlinkType(BlinkType blink)
std::vector< std::string > m_description
CineCameraID_t ar_forced_cinecam
Sim state; index of CineCam forced by script (CINECAMERAID_INVALID if not forced)
bool m_blinker_autoreset
When true, we're steering and blinker will turn off automatically.
VehicleAIPtr ar_vehicle_ai
BitMask_t m_lightmask
RoRnet::Lightmask.
float getTotalMass(bool withLocked=true)
int getShockNode1(int shock_number)
float getShockDamping(int shock_number)
void scaleTruck(float value)
float ar_anim_previous_crank
For 'animator' with flag 'torque'.
void CalcTriggers(int i, Ogre::Real difftoBeamL, bool update_hooks)
std::string getTruckFileResourceGroup()
Ogre::Vector3 ar_fusedrag
Physics state.
bool tc_notoggle
Disable in-game toggle?
float ar_aileron
Sim state; aerial controller.
void HandleAngelScriptEvents(float dt)
AutopilotPtr ar_autopilot
float ar_scale
Physics state; scale of the actor (nominal = 1.0)
float tc_ratio
Regulating force.
void resolveCollisions(Ogre::Vector3 direction)
Moves the actor at most 'direction.length()' meters towards 'direction' to resolve any collisions.
std::vector< hydrobeam_t > ar_hydros
int ar_nodes_name_top_length
For nicely formatted diagnostic output.
Ogre::Vector3 GetCameraDir()
std::vector< std::vector< int > > ar_node_to_node_connections
void calculateAveragePosition()
std::pair< float, float > ar_nb_shocks_d_interval
Search interval for springiness & damping of shock beams.
Ogre::Quaternion getOrientation()
std::vector< hook_t > ar_hooks
void UpdateBoundingBoxes()
void tractioncontrolToggle()
PointColDetector * m_intra_point_col_detector
Physics.
float getNodeMass(int nodeNumber)
void AddInterActorBeam(beam_t *beam, ActorPtr other, ActorLinkingRequestType type)
Do not call directly - use MSG_SIM_ACTOR_LINKING_REQUESTED
CacheEntryPtr m_used_skin_entry
Optional, only graphics.
int m_previous_gear
Sim state; land vehicle shifting.
std::pair< float, float > ar_nb_beams_k_interval
Search interval for springiness & damping of regular beams.
ScrewpropPtr getScrewprop(int index)
float m_rotation_request
Accumulator.
shock_t * ar_shocks
Shock absorbers.
int m_net_first_wheel_node
Network attr; Determines data buffer layout; calculated on spawn.
Ogre::Vector3 m_camera_local_gforces_cur
Physics state (camera local)
CacheEntryPtr & getUsedActorEntry()
The actor entry itself.
Ogre::Vector3 GetCameraRoll()
bool CalcForcesEulerPrepare(bool doUpdate)
bool tc_nodash
Hide the dashboard indicator?
NodeNum_t ar_cinecam_node[MAX_CAMERAS]
Sim attr; Cine-camera node indexes.
Ogre::Vector3 * ar_nodes_spawn_offsets
Relative positions (incl. Tuning system tweaks) from the definition file, for spawn-like resetting (i...
Ogre::Vector3 m_avg_node_position
average node position
bool Intersects(ActorPtr actor, Ogre::Vector3 offset=Ogre::Vector3::ZERO)
Slow intersection test.
void toggleCustomParticles()
CacheEntryPtrVec m_used_addonpart_entries
Optional, assigned by player via Tuning menu (.tuneup files).
bool m_hud_features_ok
Gfx state; Are HUD features matching actor's capabilities?
Ogre::Real ar_hydro_dir_wheel_display
size_t m_net_node_buf_size
For incoming/outgoing traffic; calculated on spawn.
void softRespawn(Ogre::Vector3 spawnpos, Ogre::Quaternion spawnrot)
Use MSG_SIM_MODIFY_ACTOR_REQUESTED with type SOFT_RESPAWN; Resets the actor to given position as if s...
bool m_trigger_debug_enabled
Logging state.
void DetermineLinkedActors()
bool ar_trailer_parking_brake
void reset(bool keep_position=false)
call this one to reset a truck from any context
struct RoR::Actor::VehicleForceSensors m_force_sensors
Data for ForceFeedback devices.
CacheEntryPtrVec m_used_assetpack_entries
Optional, specified by mod author in truck file via 'assetpacks' section.
Ogre::Timer m_reset_timer
int ar_collcabs[MAX_CABS]
void setAircraftFlaps(int flapsLevel)
float getNodeInitialMass(int nodeNumber)
int ar_nb_skip_steps
Amount of physics steps to be skipped before measuring.
bool ar_has_active_shocks
Are there active stabilizer shocks?
CacheEntryPtrVec & getUsedAssetpackEntries()
TuneupDefPtr m_working_tuneup_def
Each actor gets unique instance, even if loaded from .tuneup file in modcache.
std::vector< float > ar_initial_node_masses
void resetPosition(Ogre::Vector3 translation, bool setInitPosition)
Moves the actor to given world coords (pivot point is node 0).
TuneupDefPtr & getWorkingTuneupDef()
bool getForcedCinecam(CineCameraID_t &cinecam_id, BitMask_t &flags)
bool isLocked()
Are hooks locked?
ActorType ar_driveable
Sim attr; marks vehicle type and features.
void setLoadedMass(float m)
AeroEnginePtr getTurboprop(int index)
bool getHeadlightsVisible() const
Ogre::Vector3 m_rotation_request_center
ActorPtrVec & GetActors()
std::map< beam_t *, std::pair< ActorPtr, ActorPtr > > inter_actor_links
void UpdateNetTimeOffset(int sourceid, int offset)
unsigned long GetNetTime()
const ActorPtr & GetActorById(ActorInstanceID_t actor_id)
void AddStreamMismatch(RoRnet::ActorStreamRegister *reg)
bool AreActorsDirectlyLinked(const ActorPtr &a1, const ActorPtr &a2)
virtual bool isFailed()=0
virtual float getRPMpc()=0
virtual float getThrottle()=0
void gpws_update(float spawnheight)
Ogre::String dname
name parsed from the file
Ogre::String resource_group
Resource group of the loaded bundle. Empty if not loaded yet.
std::string resource_bundle_path
Path of ZIP or directory which contains the media. Shared between CacheEntries, loaded only once.
RigDef::DocumentPtr actor_def
Cached actor definition (aka truckfile) after first spawn.
Ogre::Camera * GetCamera()
float getSurfaceHeightBelow(float x, float z, float height)
float getSurfaceHeight(float x, float z)
@ CONSOLE_MSGTYPE_INFO
Generic message.
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
void setVisible(bool visibility)
bool _getBool(size_t key)
void setEnabled(size_t key, bool val)
float _getFloat(size_t key)
void setChar(size_t key, const char *val)
void setInt(size_t key, int val)
void setBool(size_t key, bool val)
void setFloat(size_t key, float val)
int di_idx_1
array location of wheel / axle 1
void ToggleDifferentialMode()
int di_idx_2
array location of wheel / axle 2
std::string GetDifferentialTypeName()
void setWheelSpin(float rpm)
float m_engine_shiftup_rpm
Shift down RPM ('engine' attr #1)
void pushNetworkState(float engine_rpm, float acc, float clutch, int gear, bool running, bool contact, char auto_mode, char auto_select=-1)
float m_antilag_power_factor
char m_engine_type
't' = truck (default), 'c' = car ('engoption' attr #2)
SimGearboxMode getAutoMode()
void startEngine()
Quick engine start. Plays sounds.
float getClutchForce() const
('engoption' attr #3)
float m_diff_ratio
Global gear ratio ('engine' attr #4)
float m_engine_inertia
('engoption' attr #1)
float m_antilag_rand_chance
float m_min_wastegate_psi
float m_engine_idle_rpm
('engoption' attr #8)
bool m_turbo_has_wastegate
float m_max_idle_mixture
Maximum throttle to maintain the idle RPM ('engoption' attr #9)
void setTCaseRatio(float ratio)
Set current transfer case gear (reduction) ratio.
float m_turbo_wg_threshold_n
float m_braking_torque
Engine attribute.
float m_turbo_wg_threshold_p
float m_turbo_engine_rpm_operation
float m_shift_time
Time (in seconds) that it takes to shift ('engoption' attr #4)
float getShiftUpRPM() const
Shift up RPM ('engine' attr #2)
float m_clutch_time
Time (in seconds) the clutch takes to apply ('engoption' attr #5)
float m_min_idle_mixture
Minimum throttle to maintain the idle RPM ('engoption' attr #10)
float m_clutch_force
('engoption' attr #3)
void shift(int val)
Changes gear by a relative offset. Plays sounds.
void setClutch(float clutch)
float m_post_shift_time
Time (in seconds) until full torque is transferred ('engoption' attr #6)
float m_engine_max_rpm
Shift up RPM ('engine' attr #2)
float m_engine_stall_rpm
('engoption' attr #7)
float m_turbo_inertia_factor
float m_engine_torque
Torque in N/m ('engine' attr #3)
bool hasContact()
Ignition.
void updateVerticesPhysics()
void setControlDeflection(float val)
const ActorPtr & GetPlayerActor()
const TerrainPtr & GetTerrain()
void PushMessage(Message m)
Doesn't guarantee order! Use ChainMessage() if order matters.
ActorManager * GetActorManager()
void SetDebugView(DebugViewType dv)
DebugViewType GetDebugView() const
Ogre::SceneManager * GetSceneManager()
void AddLocalStream(RoRnet::StreamRegister *reg, int size)
void AddPacket(int streamid, int type, int len, const char *content)
bool GetUserInfo(int uid, RoRnet::UserInfo &result)
void query(const Ogre::Vector3 &vec1, const Ogre::Vector3 &vec2, const Ogre::Vector3 &vec3, const float enlargeBB)
void UpdateIntraPoint(bool contactables=false)
std::vector< PointidID_t > hit_list
void UpdateInterPoint(bool ignorestate=false)
void triggerEvent(scriptEvents eventnum, int arg1=0, int arg2ex=0, int arg3ex=0, int arg4ex=0, std::string arg5ex="", std::string arg6ex="", std::string arg7ex="", std::string arg8ex="")
triggers an event; Not to be used by the end-user.
void update(Ogre::Vector3 contact_point, int index, float slip, Ogre::String ground_model_name)
void setPosition(Ogre::Vector3 pos)
void setVelocity(Ogre::Vector3 velo)
void removeInstance(const SoundScriptInstancePtr &ssi)
Wrapper for classic c-string (local buffer) Refresher: strlen() excludes '\0' terminator; strncat() A...
const char * ToCStr() const
float getHeightAt(float x, float z)
Collisions * GetCollisions()
bool tr_2wd
Does it support 2WD mode?
bool tr_4wd_mode
Enables 4WD mode.
std::vector< float > tr_gear_ratios
Gear reduction ratios.
int tr_ax_2
This axle is only driven in 4WD mode.
bool tr_2wd_lo
Does it support 2WD Lo mode?
void ResolveIntraActorCollisions(const float dt, PointColDetector &intraPointCD, const int free_collcab, int collcabs[], int cabs[], collcab_rate_t intra_collcabrate[], node_t nodes[], const float collrange, ground_model_t &submesh_ground_model)
@ UNLOCKED
lock not locked
@ PRELOCK
prelocking, attraction forces in action
@ AIRPLANE
its an airplane
@ MSG_SIM_ACTOR_LINKING_REQUESTED
Payload = RoR::ActorLinkingRequest* (owner)
@ MSG_SIM_DELETE_ACTOR_REQUESTED
Payload = RoR::ActorPtr* (owner)
@ MSG_SIM_MODIFY_ACTOR_REQUESTED
Payload = RoR::ActorModifyRequest* (owner)
static const float FLAP_ANGLES[6]
@ BEAM_VIRTUAL
Excluded from mass calculations, visuals permanently disabled.
@ SHOCK1
either 'shock1' (with flag BEAM_HYDRO) or a wheel beam
@ LOCAL_SIMULATED
simulated (local) actor
@ LOCAL_SLEEPING
sleeping (local) actor
@ DISPOSED
removed from simulation, still in memory to satisfy pointers.
@ SHOCK_FLAG_TRG_CMD_BLOCKER
@ SHOCK_FLAG_TRG_HOOK_UNLOCK
@ SHOCK_FLAG_TRG_HOOK_LOCK
@ SHOCK_FLAG_TRG_BLOCKER_A
@ SHOCK_FLAG_TRG_CONTINUOUS
@ SHOCK_FLAG_TRG_CMD_SWITCH
void TRIGGER_EVENT_ASYNC(scriptEvents type, int arg1, int arg2ex=0, int arg3ex=0, int arg4ex=0, std::string arg5ex="", std::string arg6ex="", std::string arg7ex="", std::string arg8ex="")
Asynchronously (via MSG_SIM_SCRIPT_EVENT_TRIGGERED) invoke script function eventCallbackEx(),...
@ MANUAL_STICK
Fully manual: stick shift.
@ MANUAL_RANGES
Fully manual: stick shift with ranges.
@ SEMI_AUTO
Manual shift with auto clutch.
@ MANUAL
Fully manual: sequential shift.
std::shared_ptr< Document > DocumentPtr
OverlayWrapper * GetOverlayWrapper()
InputEngine * GetInputEngine()
CVar * io_blink_lock_range
CameraManager * GetCameraManager()
SoundScriptManager * GetSoundScriptManager()
GameContext * GetGameContext()
ScriptEngine * GetScriptEngine()
CVar * gfx_reduce_shadows
static const NodeNum_t NODENUM_INVALID
@ ASMANIP_ACTORSIMATTR_SET
Triggered when setSimAttribute() is called; additional args: #2 RoR::ActorSimAtrr,...
@ DD_CUSTOM_LIGHT6
custom light 6 on
@ DD_CUSTOM_LIGHT7
custom light 7 on
@ DD_CUSTOM_LIGHT10
custom light 10 on
@ DD_CUSTOM_LIGHT2
custom light 2 on
@ DD_CUSTOM_LIGHT4
custom light 4 on
@ DD_ENGINE_NUM_GEAR
current gear
@ DD_LIGHTS_LEGACY
Alias of 'sidelights'.
@ DD_ENGINE_AUTOGEAR_STRING
string like "<current gear>/<max gear>"
@ DD_PARKINGBRAKE
chassis pitch
@ DD_CUSTOM_LIGHT9
custom light 9 on
@ DD_SIGNAL_WARNING
The warning-blink indicator is lit.
@ DD_CUSTOM_LIGHT3
custom light 3 on
@ DD_SIGNAL_TURNLEFT
Left blinker is lit.
@ DD_ENGINE_SPEEDO_MPH
speedo in kilometer per hour
@ DD_ENGINE_IGNITION
turbo gauge
@ DD_CUSTOM_LIGHT8
custom light 8 on
@ DD_ENGINE_GEAR
clutch warning lamp
@ DD_AEROENGINE_THROTTLE_0
@ DD_LOCKED
parking brake status
@ DD_ENGINE_AUTO_GEAR
string like "P R N G"
@ DD_SIGNAL_TURNRIGHT
Right blinker is lit.
@ DD_CUSTOM_LIGHT5
custom light 5 on
@ DD_ENGINE_CLUTCH_WARNING
battery lamp
@ DD_LOW_PRESSURE
locked lamp
@ DD_ENGINE_TURBO
speedo in miles per hour
@ DD_ENGINE_CLUTCH
automatic gear
@ DD_CUSTOM_LIGHT1
custom light 1 on
@ DD_TRACTIONCONTROL_MODE
low pressure
@ DD_SCREW_THROTTLE_0
ties locked
void HandleGenericException(const std::string &from, BitMask_t flags)
int ActorInstanceID_t
Unique sequentially generated ID of an actor in session. Use ActorManager::GetActorById()
int CineCameraID_t
Index into Actor::ar_cinecam_node and Actor::ar_camera_node_* arrays; use RoR::CINECAMERAID_INVALID a...
void LogFormat(const char *format,...)
Improved logging utility. Uses fixed 2Kb buffer.
ActorSimAttr
Parameter to Actor::setSimAttribute() and Actor::getSimAttribute(); allows advanced users to tweak ph...
@ ACTORSIMATTR_ENGOPTION_MIN_IDLE_MIXTURE
Min throttle to maintain idle RPM - Param #10 of 'engoption'.
@ ACTORSIMATTR_ENGTURBO2_WASTEGATE_THRESHOLD_N
1 - WgThreshold ~ calculated from Param #10 of 'engturbo2'
@ ACTORSIMATTR_ENGOPTION_BRAKING_TORQUE
How much engine brakes on zero throttle - Param #11 of 'engoption'.
@ ACTORSIMATTR_ENGINE_TORQUE
Engine torque in newton-meters (N/m) - Param #3 of 'engine'.
@ ACTORSIMATTR_ENGOPTION_CLUTCH_FORCE
@ ACTORSIMATTR_ENGTURBO2_ANTILAG_CHANCE
@ ACTORSIMATTR_ENGTURBO2_WASTEGATE_THRESHOLD_P
1 + WgThreshold ~ calculated from Param #10 of 'engturbo2'
@ ACTORSIMATTR_ENGOPTION_CLUTCH_TIME
@ ACTORSIMATTR_ENGTURBO2_WASTEGATE_MAX_PSI
@ ACTORSIMATTR_ENGOPTION_ENGINE_TYPE
@ ACTORSIMATTR_ENGTURBO2_WASTEGATE_ENABLED
@ ACTORSIMATTR_ENGTURBO2_ANTILAG_POWER
@ ACTORSIMATTR_ENGTURBO2_INERTIA_FACTOR
Time to spool up - Param #2 of 'engturbo2'.
@ ACTORSIMATTR_ENGOPTION_POST_SHIFT_TIME
Time (in seconds) until full torque is transferred - Param #6 of 'engoption'.
@ ACTORSIMATTR_ENGTURBO2_BOV_MIN_PSI
Blow-off valve PSI threshold - Param #7 of 'engturbo2'.
@ ACTORSIMATTR_ENGINE_GEAR_RATIOS_ARRAY
Gearbox - Format: "<reverse_gear> <neutral_gear> <forward_gear 1> [<forward gear 2>]....
@ ACTORSIMATTR_TC_PULSE_TIME
Pulse duration in seconds, safe values <0.00005 - 1>
@ ACTORSIMATTR_ENGOPTION_STALL_RPM
RPM where engine stalls - Param #7 of 'engoption'.
@ ACTORSIMATTR_ENGOPTION_MAX_IDLE_MIXTURE
Max throttle to maintain idle RPM - Param #9 of 'engoption'.
@ ACTORSIMATTR_ENGTURBO2_NUM_TURBOS
Number of turbos - Param #3 of 'engturbo2'.
@ ACTORSIMATTR_ENGOPTION_ENGINE_INERTIA
@ ACTORSIMATTR_ENGTURBO2_ANTILAG_MIN_RPM
@ ACTORSIMATTR_TC_WHEELSLIP_CONSTANT
Minimum wheel slip threshold, safe value = 0.25.
@ ACTORSIMATTR_ENGTURBO2_MAX_RPM
MaxPSI * 10000 ~ calculated from Param #4 of 'engturbo2'.
@ ACTORSIMATTR_ENGOPTION_IDLE_RPM
Target idle RPM - Param #8 of 'engoption'.
@ ACTORSIMATTR_ENGTURBO2_ANTILAG_ENABLED
@ ACTORSIMATTR_ENGINE_SHIFTUP_RPM
Automatic transmission - Param #2 of 'engine'.
@ ACTORSIMATTR_ENGTURBO2_BOV_ENABLED
Blow-off valve - Param #6 of 'engturbo2'.
@ ACTORSIMATTR_ENGTURBO2_ENGINE_RPM_OP
Engine RPM threshold for turbo to operate - Param #5 of 'engturbo2'.
@ ACTORSIMATTR_ENGOPTION_SHIFT_TIME
@ ACTORSIMATTR_TC_RATIO
Regulating force, safe values: <1 - 20>
@ ACTORSIMATTR_ENGINE_SHIFTDOWN_RPM
Automatic transmission - Param #1 of 'engine'.
@ ACTORSIMATTR_ENGINE_DIFF_RATIO
Differential ratio (aka global gear ratio) - Param #4 of 'engine'.
static const ActorInstanceID_t ACTORINSTANCEID_INVALID
std::vector< CacheEntryPtr > CacheEntryPtrVec
static const CineCameraID_t CINECAMERAID_INVALID
RefCountingObjectPtr< Actor > ActorPtr
@ SE_ANGELSCRIPT_MANIPULATIONS
triggered when the user tries to dynamically use the scripting capabilities (prevent cheating) args: ...
@ SE_TRUCK_BEACONS_TOGGLE
triggered when the user toggles beacons, the argument refers to the actor ID
@ SE_TRUCK_TIE_TOGGLE
triggered when the user toggles ties, the argument refers to the actor ID
@ SE_TRUCK_PARKINGBRAKE_TOGGLE
triggered when the user toggles the parking brake, the argument refers to the actor ID
@ SE_TRUCK_TOUCHED_WATER
triggered when any part of the actor touches water, the argument refers to the actor ID
@ SE_TRUCK_CPARTICLES_TOGGLE
triggered when the user toggles custom particles, the argument refers to the actor ID
@ SE_GENERIC_TRUCK_LINKING_CHANGED
Triggered when 2 actors become linked or unlinked via ties/hooks/ropes/slidenodes; args: #1 state (1=...
@ SE_TRUCK_LIGHT_TOGGLE
triggered when the main light is toggled, the argument refers to the actor ID
@ SE_TRUCK_RESET
triggered when the user resets the truck, the argument refers to the actor ID of the vehicle
uint16_t NodeNum_t
Node position within Actor::ar_nodes; use RoR::NODENUM_INVALID as empty value.
const char * ActorSimAttrToString(ActorSimAttr attr)
@ HANDLEGENERICEXCEPTION_LOGFILE
@ LIGHTMASK_REVERSE
reverse light on
@ LIGHTMASK_CUSTOM8
custom light 8 on
@ LIGHTMASK_BEACONS
beacons on
@ LIGHTMASK_CUSTOM7
custom light 7 on
@ LIGHTMASK_CUSTOM3
custom light 3 on
@ LIGHTMASK_CUSTOM4
custom light 4 on
@ LIGHTMASK_CUSTOM1
custom light 1 on
@ LIGHTMASK_BRAKES
brake lights on
@ LIGHTMASK_CUSTOM2
custom light 2 on
@ LIGHTMASK_CUSTOM6
custom light 6 on
@ LIGHTMASK_BLINK_RIGHT
right blinker on
@ LIGHTMASK_CUSTOM10
custom light 10 on
@ LIGHTMASK_CUSTOM5
custom light 5 on
@ LIGHTMASK_BLINK_WARN
warn blinker on
@ LIGHTMASK_CUSTOM9
custom light 9 on
@ LIGHTMASK_BLINK_LEFT
left blinker on
@ MSG2_STREAM_REGISTER_RESULT
result of a stream creation
#define RORNET_MAX_MESSAGE_LENGTH
maximum size of a RoR message. 8192 bytes = 8 kibibytes
static int ShowError(const std::string &title, const std::string &message)
shows a simple error message box
std::vector< char > veh_state
Actor properties (engine, brakes, lights, ...)
std::vector< char > node_data
Compressed node positions.
std::vector< float > wheel_data
Wheel rotations.
Ogre::Vector3 out_body_forces
Ogre::Vector3 accu_body_forces
Estabilishing a physics linkage between 2 actors modifies a global linkage table and triggers immedia...
ActorLinkingRequestType alr_type
ActorInstanceID_t alr_actor_instance_id
ActorInstanceID_t amr_actor
Unified game event system - all requests and state changes are reported using a message.
User input state for animated props with 'source:event'.
Simulation: An edge in the softbody structure.
float debug_v
debug shock velocity
float refL
reference length
ActorPtr bm_locked_actor
in case p2 is on another actor
float debug_d
debug shock damping
float default_beam_deform
for reset
float initial_beam_strength
for reset
float debug_k
debug shock spring_rate
< beams updating length based on simulation variables, generally known as actuators.
float hb_anim_param
Only for 'animators'.
BitMask_t hb_anim_flags
Only for 'animators'.
Physics: A vertex in the softbody structure.
Ogre::Vector3 AbsPosition
absolute position in the world (shaky)
static const int8_t INVALID_BBOX
bool nd_rim_node
Attr; This node is part of a rim (only wheel types with separate rim nodes)
bool nd_has_mesh_contact
Physics state.
bool nd_contacter
Attr; User-defined.
Ogre::Vector3 RelPosition
relative to the local physics origin (one origin per actor) (shaky)
bool nd_cab_node
Attr; This node is part of collision triangle.
bool nd_contactable
Attr; This node will be treated as contacter on inter truck collisions.
int16_t nd_coll_bbox_id
Optional attribute (-1 = none) - multiple collision bounding boxes defined in truckfile.
bool nd_tyre_node
Attr; This node is part of a tyre (note some wheel types don't use rim nodes at all)
bool nd_loaded_mass
User-defined attr; mass is calculated from 'globals/loaded-mass' rather than 'globals/dry-mass' - set...
bool nd_override_mass
User defined attr; mass is user-specified rather than calculated (override the calculation)
NodeNum_t pos
This node's index in Actor::ar_nodes array.
int trigger_cmdshort
F-key for trigger injection shortbound-check.
float sbd_damp
set beam default for damping
float dampin
shocks2 & shocks3
float trigger_switch_state
needed to avoid doubleswitch, bool and timer in one
bool trigger_enabled
general trigger,switch and blocker state
int last_debug_state
smart debug output
float springout
shocks2 & shocks3
float springin
shocks2 & shocks3
float trigger_boundary_t
optional value to tune trigger_switch_state autorelease
float dampout
shocks2 & shocks3
int trigger_cmdlong
F-key for trigger injection longbound-check.
float sbd_spring
set beam default for spring
SoundScriptInstancePtr ssi
Ogre::Real wh_speed
Current wheel speed in m/s.
WheelPropulsion wh_propulsed
node_t * wh_rim_nodes[50]
Ogre::Real wh_avg_speed
Internal physics state; Do not read from this.
Ogre::Real wh_torque
Internal physics state; Do not read from this.
< Must preserve mem. layout of RoRnet::StreamRegister
char sectionconfig[60]
section configuration
int32_t status
initial stream status
char name[128]
truck file name
int32_t origin_sourceid
origin sourceid
int32_t origin_streamid
origin streamid
int32_t time
initial time stamp
< Sent from the client to server and vice versa, to broadcast a new stream
char username[RORNET_MAX_USERNAME_LEN]
the nickname of the user (UTF-8)
float brake
the brake value
float engine_speed
engine RPM
BitMask_t flagmask
flagmask: NETMASK_*
float wheelspeed
the wheel speed value
BitMask_t lightmask
flagmask: LIGHTMASK_*
float engine_clutch
the clutch value
float hydrodirstate
the turning direction status
int32_t engine_gear
engine gear
float engine_force
engine acceleration