File size: 37,185 Bytes
24b81cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 |
class Environment
{
const float RAIN_LIMIT_LOW = 0.05;
const float WATER_LEVEL_HIGH = 1.5;
const float WATER_LEVEL_MID = 1.2;
const float WATER_LEVEL_LOW = 0.5;
const float WATER_LEVEL_NONE = 0.15;
protected float m_WetDryTick; //ticks passed since last clothing wetting or drying
protected float m_ItemsWetnessMax; //! keeps wetness of most wet item in player's possesion
protected float m_RoofCheckTimer; // keeps info about tick time
//player
protected PlayerBase m_Player;
protected float m_PlayerHeightPos; // y position of player above water level (meters)
protected float m_PlayerSpeed; // 1-3 speed of player movement
protected float m_PlayerTemperature; //34-44
protected float m_PlayerHeat; //3-9 heatcomfort generated by entites movement
protected float m_HeatComfort; //delta that changes entitys temperature
//environment
protected float m_Rain = 0; // 0-1 amount of rain
protected float m_Wind = 0; // strength of wind
protected float m_Fog = 0; // 0-1 how foggy it is
protected float m_DayOrNight = 0; // 0-1 day(1) or night(0)
protected float m_Clouds = 0; // 0-1 how cloudy it is
protected float m_EnvironmentTemperature = 0; //temperature of environment player is in
protected float m_Time = 0;
protected string m_SurfaceType;
//
protected float m_WaterLevel;
protected bool m_IsUnderRoof;
private bool m_IsUnderRoofBuilding;
protected bool m_IsInWater;
protected bool m_IsTempSet;
//
protected float m_HeatSourceTemp; //! DEPRECATED
protected float m_HeatBufferTimer;
protected ref array<int> m_SlotIdsComplete;
protected ref array<int> m_SlotIdsUpper;
protected ref array<int> m_SlotIdsBottom;
protected ref array<int> m_SlotIdsLower;
protected ref array<int> m_HeadParts;
protected ref array<int> m_BodyParts;
protected ref array<int> m_FeetParts;
protected ref SimpleMovingAverage<float> m_WindAverageBuffer;
protected bool m_HasTemperatureSources;
protected float m_UTSAverageTemperature;
protected ref array<UTemperatureSource> m_UTemperatureSources;
protected ref SimpleMovingAverage<float> m_UTSAverageTemperatureBuffer;
#ifdef DIAG_DEVELOPER
bool m_Debug = false;
bool m_DebugLogDryWet = false;
#endif
void Environment(PlayerBase pPlayer)
{
Init(pPlayer);
}
void Init(PlayerBase pPlayer)
{
m_Player = pPlayer;
m_PlayerSpeed = 0.0;
m_WetDryTick = 0.0;
m_RoofCheckTimer = 0.0;
m_WaterLevel = 0.0;
m_HeatComfort = 0.0;
m_IsUnderRoof = false;
m_IsInWater = false;
m_SurfaceType = "cp_dirt";
m_HeatBufferTimer = 0.0;
m_WindAverageBuffer = new SimpleMovingAverage<float>(30, 0.5);
m_UTSAverageTemperature = 0.0;
m_UTemperatureSources = new array<UTemperatureSource>();
m_UTSAverageTemperatureBuffer = new SimpleMovingAverage<float>(10, 0);
//! whole body slots
m_SlotIdsComplete = new array<int>;
m_SlotIdsComplete = {
InventorySlots.HEADGEAR,
InventorySlots.MASK,
InventorySlots.EYEWEAR,
InventorySlots.GLOVES,
InventorySlots.ARMBAND,
InventorySlots.BODY,
InventorySlots.HIPS,
InventorySlots.VEST,
InventorySlots.BACK,
InventorySlots.LEGS,
InventorySlots.FEET
};
//! upper body part slots
m_SlotIdsUpper = new array<int>;
m_SlotIdsUpper = {
InventorySlots.GLOVES,
InventorySlots.ARMBAND,
InventorySlots.BODY,
InventorySlots.HIPS,
InventorySlots.VEST,
InventorySlots.BACK,
InventorySlots.LEGS,
InventorySlots.FEET
};
//! bottom body part slots
m_SlotIdsBottom = new array<int>;
m_SlotIdsBottom = {
InventorySlots.HIPS,
InventorySlots.LEGS,
InventorySlots.FEET
};
//! lower body part slots
m_SlotIdsLower = new array<int>;
m_SlotIdsLower = {
InventorySlots.FEET,
};
//! --------------------------
//! heat comfort related slots
m_HeadParts = new array<int>;
m_HeadParts = {
InventorySlots.HEADGEAR,
InventorySlots.MASK,
};
m_BodyParts = new array<int>;
m_BodyParts = {
InventorySlots.GLOVES,
InventorySlots.BODY,
InventorySlots.BACK,
InventorySlots.VEST,
};
m_FeetParts = new array<int>;
m_FeetParts = {
InventorySlots.LEGS,
InventorySlots.FEET,
};
}
// Calculates heatisolation of clothing, process its wetness, collects heat from heated items and calculates player's heat comfort
void Update(float pDelta)
{
if (m_Player)
{
m_RoofCheckTimer += pDelta;
//! check if player is under roof (only if the Building check is false)
if ( m_RoofCheckTimer >= GameConstants.ENVIRO_TICK_ROOF_RC_CHECK )
{
if ( !IsInsideBuilding() )
CheckUnderRoof();
m_RoofCheckTimer = 0;
}
m_Time += pDelta;
if ( m_Time >= GameConstants.ENVIRO_TICK_RATE )
{
m_Time = 0;
m_WetDryTick++; // Sets whether it is time to add wetness to items and clothing
//! Updates data
CheckWaterContact(m_WaterLevel);
CollectAndSetPlayerData();
CollectAndSetEnvironmentData();
GatherTemperatureSources();
ProcessTemperatureSources();
//! Process temperature
ProcessItemsHeat();
//! Process item wetness/dryness
if ( m_WetDryTick >= GameConstants.ENVIRO_TICKS_TO_WETNESS_CALCULATION )
{
if ( IsWaterContact() )
{
ProcessWetnessByWaterLevel(m_WaterLevel);
}
else if ( IsRaining() && !IsInsideBuilding() && !IsUnderRoof() && !IsInsideVehicle() )
{
ProcessWetnessByRain();
}
else
{
ProcessItemsDryness();
}
//! setting of wetness/dryiness of player
if ( ( m_ItemsWetnessMax < GameConstants.STATE_WET ) && ( m_Player.GetStatWet().Get() == 1 ) )
{
m_Player.GetStatWet().Set( 0 );
}
else if ( ( m_ItemsWetnessMax >= GameConstants.STATE_WET ) && ( m_Player.GetStatWet().Get() == 0 ) )
{
m_Player.GetStatWet().Set( 1 );
}
m_WetDryTick = 0;
m_ItemsWetnessMax = 0; //! reset item wetness counter;
}
}
}
}
bool IsTemperatureSet()
{
return m_IsTempSet;
}
// DEPRECATED
void AddToEnvironmentTemperature(float pTemperature);
//! Returns heat player generated based on player's movement speed (for now)
protected float GetPlayerHeat()
{
float heat = Math.Max(m_PlayerSpeed * GameConstants.ENVIRO_DEFAULT_ENTITY_HEAT, GameConstants.ENVIRO_DEFAULT_ENTITY_HEAT);
return heat;
}
bool IsUnderRoof()
{
return m_IsUnderRoof;
}
protected bool IsWaterContact()
{
return m_IsInWater;
}
bool IsInsideBuilding()
{
return m_Player && m_Player.IsSoundInsideBuilding();
}
protected bool IsInsideVehicle()
{
return m_Player && m_Player.IsInVehicle();
}
private bool IsUnderRoofBuilding()
{
return m_IsUnderRoofBuilding;
}
protected bool IsRaining()
{
return m_Rain > RAIN_LIMIT_LOW;
}
//! Checks whether Player is sheltered
protected void CheckUnderRoof()
{
// if inside vehicle return immediatelly
if (IsInsideVehicle())
{
m_IsUnderRoof = false;
m_IsUnderRoofBuilding = false;
return;
}
float hitFraction;
vector hitPosition, hitNormal;
vector from = m_Player.GetPosition();
vector to = from + "0 25 0";
Object hitObject;
PhxInteractionLayers collisionLayerMask = PhxInteractionLayers.ITEM_LARGE|PhxInteractionLayers.BUILDING|PhxInteractionLayers.VEHICLE;
m_IsUnderRoof = DayZPhysics.RayCastBullet(from, to, collisionLayerMask, null, hitObject, hitPosition, hitNormal, hitFraction);
m_IsUnderRoofBuilding = hitObject && hitObject.IsInherited(House);
}
protected void CheckWaterContact(out float pWaterLevel)
{
m_IsInWater = false;
if (m_Player.IsSwimming())
{
m_IsInWater = true;
HumanMovementState hms = new HumanMovementState();
m_Player.GetMovementState(hms);
pWaterLevel = WATER_LEVEL_MID;
if (hms.m_iMovement >= DayZPlayerConstants.MOVEMENTIDX_WALK)
pWaterLevel = WATER_LEVEL_HIGH;
return;
}
//! no valid surface under character
if (IsUnderRoofBuilding())
{
m_IsInWater = false;
return;
}
string surfType;
int liquidType;
g_Game.SurfaceUnderObject(m_Player, surfType, liquidType);
switch ( liquidType )
{
case 0: // sea
case LIQUID_WATER:
case LIQUID_RIVERWATER:
pWaterLevel = m_Player.GetCurrentWaterLevel();
m_IsInWater = true;
break;
}
//! sync info about water contact to player
m_Player.SetInWater(m_IsInWater);
//! update active surface
m_SurfaceType = surfType;
}
// ENVIRONMENT
// Returns amount of deg C air temperature should be lowered by, based on player's height above water level
float GetTemperatureHeightCorrection()
{
float temperature_reduction = Math.Max(0, (m_PlayerHeightPos * GameConstants.ENVIRO_TEMPERATURE_HEIGHT_REDUCTION));
return temperature_reduction;
}
float GetWindModifierPerSurface()
{
if (IsUnderRoofBuilding())
return 0.0;
return g_Game.ConfigGetFloat("CfgSurfaces " + m_SurfaceType + " windModifier");
}
float GetTemperature()
{
return m_EnvironmentTemperature;
}
// Calculates and return temperature of environment
protected float GetEnvironmentTemperature()
{
float temperature;
temperature = g_Game.GetMission().GetWorldData().GetBaseEnvTemperature();
temperature += Math.AbsFloat(temperature * m_Clouds * GameConstants.ENVIRO_CLOUDS_TEMP_EFFECT);
if (IsWaterContact())
{
temperature -= Math.AbsFloat(temperature * GameConstants.ENVIRO_WATER_TEMPERATURE_COEF);
}
if (IsInsideBuilding() || m_IsUnderRoofBuilding)
{
temperature += Math.AbsFloat(temperature * GameConstants.ENVIRO_TEMPERATURE_INSIDE_COEF);
}
else if (IsInsideVehicle())
{
temperature += Math.AbsFloat(temperature * GameConstants.ENVIRO_TEMPERATURE_INSIDE_VEHICLE_COEF);
}
else if (IsUnderRoof() && !m_IsUnderRoofBuilding)
{
temperature += Math.AbsFloat(temperature * GameConstants.ENVIRO_TEMPERATURE_UNDERROOF_COEF);
temperature -= GameConstants.ENVIRO_TEMPERATURE_WIND_COEF * GetWindModifierPerSurface() * m_Wind;
}
else
{
temperature -= GameConstants.ENVIRO_TEMPERATURE_WIND_COEF * GetWindModifierPerSurface() * m_Wind;
temperature -= Math.AbsFloat(temperature * m_Fog * GameConstants.ENVIRO_FOG_TEMP_EFFECT);
temperature -= GetTemperatureHeightCorrection();
}
// incorporate temperature from temperature sources (buffer)
if (Math.AbsFloat(m_UTSAverageTemperature) > 0.001)
{
temperature += m_UTSAverageTemperature;
}
return temperature;
}
// Calculats wet/drying delta based on player's location and weather
float GetWetDelta()
{
float wetDelta = 0;
if ( IsWaterContact() )
{
//! player is getting wet by movement/swimming in water (+differentiate wetDelta by water level)
if (m_WaterLevel >= WATER_LEVEL_HIGH)
{
wetDelta = 1;
}
else if (m_WaterLevel >= WATER_LEVEL_MID && m_WaterLevel < WATER_LEVEL_HIGH)
{
wetDelta = 0.66;
}
else if (m_WaterLevel >= WATER_LEVEL_LOW && m_WaterLevel < WATER_LEVEL_MID)
{
wetDelta = 0.66;
}
else if (m_WaterLevel >= WATER_LEVEL_NONE && m_WaterLevel < WATER_LEVEL_LOW)
{
wetDelta = 0.33;
}
}
else if (IsRaining() && !IsInsideBuilding() && !IsUnderRoof() && !IsInsideVehicle())
{
//! player is getting wet from rain
wetDelta = GameConstants.ENVIRO_WET_INCREMENT * GameConstants.ENVIRO_TICKS_TO_WETNESS_CALCULATION * (m_Rain) * (1 + (GameConstants.ENVIRO_WIND_EFFECT * m_Wind));
}
else
{
//! player is drying
float tempEffect = Math.Max(m_PlayerHeat + GetEnvironmentTemperature(), 1.0);
float weatherEffect = ((1 - (m_Fog * GameConstants.ENVIRO_FOG_DRY_EFFECT))) * (1 - (m_Clouds * GameConstants.ENVIRO_CLOUD_DRY_EFFECT));
if (weatherEffect <= 0)
{
weatherEffect = 1.0;
}
wetDelta = -(GameConstants.ENVIRO_DRY_INCREMENT * weatherEffect * tempEffect);
if (!IsInsideBuilding())
{
wetDelta *= 1 + (GameConstants.ENVIRO_WIND_EFFECT * m_Wind);
}
}
return wetDelta;
}
// EXPOSURE
// Each tick updates current entity member variables
protected void CollectAndSetPlayerData()
{
vector playerPos = m_Player.GetPosition();
m_PlayerHeightPos = playerPos[1];
HumanCommandMove hcm = m_Player.GetCommand_Move();
if (hcm)
{
m_PlayerSpeed = hcm.GetCurrentMovementSpeed();
}
m_PlayerHeat = GetPlayerHeat();
}
// Each tick updates current environment member variables
protected void CollectAndSetEnvironmentData()
{
Weather weather = g_Game.GetWeather();
m_Rain = weather.GetRain().GetActual();
m_DayOrNight = g_Game.GetWorld().GetSunOrMoon();
m_Fog = weather.GetFog().GetActual();
m_Clouds = weather.GetOvercast().GetActual();
m_Wind = m_WindAverageBuffer.Add(weather.GetWindSpeed() / weather.GetWindMaximumSpeed());
SetEnvironmentTemperature();
}
void SetEnvironmentTemperature()
{
m_IsTempSet = true;
m_EnvironmentTemperature = GetEnvironmentTemperature();
}
protected void ProcessWetnessByRain()
{
ProcessItemsWetness(m_SlotIdsComplete);
}
protected void ProcessWetnessByWaterLevel(float pWaterLevel)
{
// process attachments by water depth
if (pWaterLevel >= WATER_LEVEL_HIGH)
{
//! complete
ProcessItemsWetness(m_SlotIdsComplete);
}
else if (pWaterLevel >= WATER_LEVEL_MID && pWaterLevel < WATER_LEVEL_HIGH)
{
//! upper part
ProcessItemsWetness(m_SlotIdsUpper);
}
else if (pWaterLevel >= WATER_LEVEL_LOW && pWaterLevel < WATER_LEVEL_MID)
{
//! bottom part
ProcessItemsWetness(m_SlotIdsBottom);
}
else if (pWaterLevel >= WATER_LEVEL_NONE && pWaterLevel < WATER_LEVEL_LOW)
{
//! feet
ProcessItemsWetness(m_SlotIdsLower);
}
}
// Wets or dry items once in given time
protected void ProcessItemsWetness(array<int> pSlotIds)
{
EntityAI attachment;
int playerAttachmentCount = m_Player.GetInventory().AttachmentCount();
LogDryWetProcess(string.Format("Environment :: ProcessItemsWetness (update interval=%1s)", GameConstants.ENVIRO_TICK_RATE));
for (int attIdx = 0; attIdx < playerAttachmentCount; ++attIdx)
{
attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
if (attachment.IsItemBase())
{
int attachmentSlotsCount = attachment.GetInventory().GetSlotIdCount();
for (int attachmentSlotId = 0; attachmentSlotId < attachmentSlotsCount; ++attachmentSlotId)
{
int attachmentSlot = attachment.GetInventory().GetSlotId(attachmentSlotId);
for (int i = 0; i < pSlotIds.Count(); ++i)
{
if (attachmentSlot == pSlotIds.Get(i))
{
ApplyWetnessToItem(ItemBase.Cast(attachment));
break;
}
}
}
}
}
if (m_Player.GetItemInHands())
ApplyWetnessToItem(m_Player.GetItemInHands());
LogDryWetProcess("==========");
}
protected void ProcessItemsDryness()
{
EntityAI attachment;
ItemBase item;
int attCount = m_Player.GetInventory().AttachmentCount();
LogDryWetProcess(string.Format("Environment :: ProcessItemsDryness (update interval=%1s)", GameConstants.ENVIRO_TICK_RATE));
EnvironmentDrynessData drynessData = new EnvironmentDrynessData();
drynessData.m_UseTemperatureSources = m_HasTemperatureSources;
if (m_HasTemperatureSources)
{
float distance = vector.Distance(m_UTemperatureSources[0].GetPosition(), m_Player.GetPosition());
distance = Math.Max(distance, 0.1);
drynessData.m_TemperatureSourceDistance = distance;
LogDryWetProcess(string.Format("distance to heatsource: %1 m", distance));
}
for (int attIdx = 0; attIdx < attCount; attIdx++)
{
attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
if (attachment && attachment.IsItemBase())
{
item = ItemBase.Cast(attachment);
if (item)
ApplyDrynessToItemEx(item, drynessData);
}
}
if (m_Player.GetItemInHands())
{
ApplyDrynessToItemEx(m_Player.GetItemInHands(), drynessData);
}
LogDryWetProcess("==========");
}
protected void ApplyWetnessToItem(ItemBase pItem)
{
if (pItem)
{
ItemBase parentItem;
bool isParentWet = false;
bool parentContainsLiquid = false;
InventoryLocation iLoc = new InventoryLocation();
if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
{
EntityAI parent = iLoc.GetParent();
if (parent)
{
parentItem = ItemBase.Cast(parent);
if (parentItem)
{
if (parentItem.GetWet() >= GameConstants.STATE_SOAKING_WET)
isParentWet = true;
if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
parentContainsLiquid = true;
}
else
isParentWet = true;
if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
m_ItemsWetnessMax = pItem.GetWet();
}
}
if (isParentWet || parentContainsLiquid)
{
float soakingCoef = 0;
if (parentContainsLiquid)
{
soakingCoef = pItem.GetSoakingIncrement("parentWithLiquid");
LogDryWetProcess(string.Format("%1 (soak coef=%2/s, current wetness=%3) [parent contains liquid]", pItem.GetDisplayName(), soakingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
}
else if (isParentWet && parentItem)
{
if (pItem.GetWet() < parentItem.GetWet())
{
soakingCoef = pItem.GetSoakingIncrement("wetParent");
LogDryWetProcess(string.Format("%1 (soak coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), soakingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
}
}
else
{
soakingCoef = GetWetDelta();
LogDryWetProcess(string.Format("%1 (soak coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), soakingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
}
pItem.AddWet(soakingCoef);
pItem.AddTemperature(GameConstants.ENVIRO_TICK_RATE * GameConstants.TEMPERATURE_RATE_COOLING_PLAYER * pItem.GetSoakingIncrement("wetParent"));
if (pItem.GetInventory().GetCargo())
{
int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
for (int i = 0; i < inItemCount; i++)
{
ItemBase inItem;
if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
ApplyWetnessToItem(inItem);
}
}
int attCount = pItem.GetInventory().AttachmentCount();
if (attCount > 0)
{
for (int attIdx = 0; attIdx < attCount; attIdx++)
{
EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
ItemBase itemAtt = ItemBase.Cast(attachment);
if (itemAtt)
ApplyWetnessToItem(itemAtt);
}
}
}
}
}
protected void ApplyDrynessToItem(ItemBase pItem)
{
EnvironmentDrynessData drynessData = new EnvironmentDrynessData();
ApplyDrynessToItemEx(pItem, drynessData);
}
protected void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)
{
if (pItem)
{
float dryingIncrement = pItem.GetDryingIncrement("player");
if (pDrynessData.m_UseTemperatureSources)
dryingIncrement = pItem.GetDryingIncrement("playerHeatSource");
ItemBase parentItem;
bool isParentWet = false;
bool parentContainsLiquid = false;
InventoryLocation iLoc = new InventoryLocation();
if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
{
EntityAI parent = iLoc.GetParent();
if (parent)
{
parentItem = ItemBase.Cast(parent);
if (parentItem)
{
if (parentItem.GetWet() >= GameConstants.STATE_SOAKING_WET)
isParentWet = true;
if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
parentContainsLiquid = true;
}
if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
{
m_ItemsWetnessMax = pItem.GetWet();
}
}
}
float dryingCoef = 0;
if (!isParentWet && !parentContainsLiquid)
{
dryingCoef = (-1 * GameConstants.ENVIRO_TICK_RATE * dryingIncrement) / pDrynessData.m_TemperatureSourceDistance;
if (pItem.GetWet() >= GameConstants.STATE_DAMP)
{
LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
pItem.AddWet(dryingCoef);
}
if (pItem.GetInventory().GetCargo())
{
int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
for (int i = 0; i < inItemCount; i++)
{
ItemBase inItem;
if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
ApplyDrynessToItemEx(inItem, pDrynessData);
}
}
int attCount = pItem.GetInventory().AttachmentCount();
if (attCount > 0)
{
for (int attIdx = 0; attIdx < attCount; attIdx++)
{
EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
ItemBase itemAtt;
if (ItemBase.CastTo(itemAtt, attachment))
ApplyDrynessToItemEx(itemAtt, pDrynessData);
}
}
pItem.AddTemperature(GameConstants.ENVIRO_TICK_RATE * GameConstants.TEMPERATURE_RATE_COOLING_PLAYER);
}
if (parentContainsLiquid)
{
//! adds wetness to item inside parent item containing liquid
dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("parentWithLiquid")) / pDrynessData.m_TemperatureSourceDistance;
LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [parent contains liquid]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
pItem.AddWet(dryingCoef);
pItem.AddTemperature(GameConstants.ENVIRO_TICK_RATE * GameConstants.TEMPERATURE_RATE_COOLING_PLAYER);
}
if (isParentWet)
{
if (pItem.GetWet() < parentItem.GetWet())
{
//! adds wetness to item inside wet parent item
dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("wetParent")) / pDrynessData.m_TemperatureSourceDistance;
LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
pItem.AddWet(dryingCoef);
}
pItem.AddTemperature(GameConstants.ENVIRO_TICK_RATE * GameConstants.TEMPERATURE_RATE_COOLING_PLAYER * 3.5);
}
}
}
// HEAT COMFORT
//! Calculates and process temperature of items
protected void ProcessItemsHeat()
{
float hcHead, hcBody, hcFeet; //! Heat Comfort
float hHead, hBody, hFeet; //! Heat (from items);
float heatComfortAvg;
float heatAvg;
BodyPartHeatProperties(m_HeadParts, GameConstants.ENVIRO_HEATCOMFORT_HEADPARTS_WEIGHT, hcHead, hHead);
BodyPartHeatProperties(m_BodyParts, GameConstants.ENVIRO_HEATCOMFORT_BODYPARTS_WEIGHT, hcBody, hBody);
BodyPartHeatProperties(m_FeetParts, GameConstants.ENVIRO_HEATCOMFORT_FEETPARTS_WEIGHT, hcFeet, hFeet);
heatComfortAvg = (hcHead + hcBody + hcFeet) / 3;
heatAvg = (hHead + hBody + hFeet) / 3;
heatAvg = heatAvg * GameConstants.ENVIRO_ITEM_HEAT_TRANSFER_COEF;
// heat buffer
float applicableHB = 0.0;
if (m_UTSAverageTemperature < 0.001)
{
applicableHB = m_Player.GetStatHeatBuffer().Get() / 30.0;
if (applicableHB > 0.0)
{
if (m_HeatBufferTimer > 1.0)
{
m_Player.GetStatHeatBuffer().Add(Math.Min(EnvTempToCoef(m_EnvironmentTemperature), -0.1) * GameConstants.ENVIRO_PLAYER_HEATBUFFER_DECREASE);
}
else
{
m_HeatBufferTimer += GameConstants.ENVIRO_PLAYER_HEATBUFFER_TICK;
}
}
else
{
m_HeatBufferTimer = 0.0;
}
}
else
{
applicableHB = m_Player.GetStatHeatBuffer().Get() / 30.0;
if (m_HeatComfort > PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_WARNING)
{
m_Player.GetStatHeatBuffer().Add(GameConstants.ENVIRO_PLAYER_HEATBUFFER_INCREASE);
m_HeatBufferTimer = 0.0;
}
else
{
m_HeatBufferTimer = 0.0;
}
}
m_HeatComfort = (heatComfortAvg + heatAvg + (GetPlayerHeat() / 100)) + EnvTempToCoef(m_EnvironmentTemperature);
if ((m_HeatComfort + applicableHB) < (PlayerConstants.THRESHOLD_HEAT_COMFORT_PLUS_WARNING - 0.01))
{
m_HeatComfort += applicableHB;
}
else
{
if (m_HeatComfort <= (PlayerConstants.THRESHOLD_HEAT_COMFORT_PLUS_WARNING - 0.01))
{
m_HeatComfort = PlayerConstants.THRESHOLD_HEAT_COMFORT_PLUS_WARNING - 0.01;
}
}
m_HeatComfort = Math.Clamp(m_HeatComfort, m_Player.GetStatHeatComfort().GetMin(), m_Player.GetStatHeatComfort().GetMax());
m_Player.GetStatHeatComfort().Set(m_HeatComfort);
}
//! DEPRECATED
protected bool OverridenHeatComfort(out float value);
protected float EnvTempToCoef(float pTemp)
{
if (pTemp >= GameConstants.ENVIRO_HIGH_TEMP_LIMIT)
{
return 1;
}
if (pTemp <= GameConstants.ENVIRO_LOW_TEMP_LIMIT)
{
return -1;
}
return (pTemp - GameConstants.ENVIRO_PLAYER_COMFORT_TEMP) / GameConstants.ENVIRO_TEMP_EFFECT_ON_PLAYER;
}
//! returns weighted avg heat comfort for bodypart
protected void BodyPartHeatProperties(array<int> pBodyPartIds, float pCoef, out float pHeatComfort, out float pHeat)
{
int attCount;
EntityAI attachment;
ItemBase item;
pHeatComfort = -1;
attCount = m_Player.GetInventory().AttachmentCount();
for (int attIdx = 0; attIdx < attCount; attIdx++)
{
attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
if (attachment.IsClothing())
{
item = ItemBase.Cast(attachment);
int attachmentSlot = attachment.GetInventory().GetSlotId(0);
//! go through all body parts we've defined for that zone (ex.: head, body, feet)
for (int i = 0; i < pBodyPartIds.Count(); i++)
{
if (attachmentSlot == pBodyPartIds.Get(i))
{
float heatIsoMult = 1.0;
if (attachmentSlot == InventorySlots.VEST)
{
heatIsoMult = GameConstants.ENVIRO_HEATISOLATION_VEST_WEIGHT;
}
if (attachmentSlot == InventorySlots.BACK)
{
heatIsoMult = GameConstants.ENVIRO_HEATISOLATION_BACK_WEIGHT;
}
pHeatComfort += heatIsoMult * MiscGameplayFunctions.GetCurrentItemHeatIsolation(item);
// go through any attachments and cargo (only current level, ignore nested containers - they isolate)
int inAttCount = item.GetInventory().AttachmentCount();
if (inAttCount > 0)
{
for (int inAttIdx = 0; inAttIdx < inAttCount; inAttIdx++)
{
EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
ItemBase itemAtt = ItemBase.Cast(inAttachment);
if (itemAtt)
{
pHeat += itemAtt.GetTemperature();
}
}
}
if (item.GetInventory().GetCargo())
{
int inItemCount = item.GetInventory().GetCargo().GetItemCount();
for (int j = 0; j < inItemCount; j++)
{
ItemBase inItem;
if (Class.CastTo(inItem, item.GetInventory().GetCargo().GetItem(j)))
{
pHeat += inItem.GetTemperature();
}
}
}
}
}
}
}
pHeatComfort = (pHeatComfort / pBodyPartIds.Count()) * pCoef;
pHeat = (pHeat / pBodyPartIds.Count()) * pCoef;
}
protected void GatherTemperatureSources()
{
m_UTemperatureSources.Clear();
array<Object> nearestObjects = new array<Object>;
GetGame().GetObjectsAtPosition(m_Player.GetPosition(), GameConstants.ENVIRO_TEMP_SOURCES_LOOKUP_RADIUS, nearestObjects, null);
foreach (Object nearestObject : nearestObjects)
{
EntityAI ent = EntityAI.Cast(nearestObject);
if (ent && ent.IsUniversalTemperatureSource() && ent != m_Player)
{
//! next temp source is too far
if (vector.DistanceSq(m_Player.GetPosition(), ent.GetPosition()) > Math.SqrFloat(ent.GetUniversalTemperatureSource().GetMaxRange()))
continue;
m_UTemperatureSources.Insert(ent.GetUniversalTemperatureSource());
}
}
if (m_Player.GetItemInHands() && m_Player.GetItemInHands().IsUniversalTemperatureSource())
m_UTemperatureSources.Insert(m_Player.GetItemInHands().GetUniversalTemperatureSource());
}
protected void ProcessTemperatureSources()
{
if (m_UTemperatureSources.Count() == 0)
{
m_HasTemperatureSources = false;
m_UTSAverageTemperature = m_UTSAverageTemperatureBuffer.Add(0);
return;
}
array<float> utsTemperatures = new array<float>();
// get temperature from the source (based on distance), save it for min/max filtering
foreach (UTemperatureSource tempSource : m_UTemperatureSources)
utsTemperatures.Insert(CalcTemperatureFromTemperatureSource(tempSource));
float min = MiscGameplayFunctions.GetMinValue(utsTemperatures);
float max = MiscGameplayFunctions.GetMaxValue(utsTemperatures);
if (max > 0 && min < 0)
{
//! adds average of 2 most significat sources to buffer
m_UTSAverageTemperature = m_UTSAverageTemperatureBuffer.Add((max + min) * 0.5);
}
else
{
m_UTSAverageTemperature = m_UTSAverageTemperatureBuffer.Add(max);
}
m_HasTemperatureSources = true;
}
float GetUniversalSourcesTemperageAverage()
{
return m_UTSAverageTemperature;
}
float CalcTemperatureFromTemperatureSource(notnull UTemperatureSource uts)
{
float distance = vector.Distance(m_Player.GetPosition(), uts.GetPosition());
distance = Math.Max(distance, 0.1); //min distance cannot be 0 (division by zero)
float temperature = 0;
//Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::distance: %1", distance), "Environment");
//! heat transfer through air to player (env temperature)
if (distance > uts.GetFullRange())
{
float distFactor = 1 - (distance / uts.GetMaxRange());
distFactor = Math.Max(distFactor, 0.0); //! dist factor minimum should be at 0
temperature = uts.GetTemperature() * distFactor;
//temperature = Math.Clamp(temperature, uts.GetTemperatureMin(), uts.GetTemperatureMax());
//Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::distFactor: %1", distFactor), "Environment");
//Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::temperatureXX: %1", temperature), "Environment");
}
else
{
temperature = uts.GetTemperature();
}
//Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::temperature: %1", temperature), "Environment");
return temperature;
}
//! debug
#ifdef DIAG_DEVELOPER
EnvDebugData GetEnvDebugData()
{
EnvDebugData data = new EnvDebugData();
data.Synch(this, m_Player);
return data;
}
void ShowEnvDebugPlayerInfo(bool enabled)
{
EnvDebugData data = GetEnvDebugData();
DisplayEnvDebugPlayerInfo(enabled, data);
}
static void DisplayEnvDebugPlayerInfo(bool enabled, EnvDebugData data)
{
int windowPosX = 10;
int windowPosY = 200;
Object obj;
DbgUI.Begin("Player stats", windowPosX, windowPosY);
if ( enabled )
{
DbgUI.Text(string.Format("Heat comfort: %1", data.m_PlayerData.m_HeatComfort));
DbgUI.Text(string.Format("Inside: %1 (%2)", data.m_PlayerData.m_Inside, data.m_PlayerData.m_Surface));
DbgUI.Text(string.Format("Under roof: %1 (%2)", data.m_PlayerData.m_UnderRoof, data.m_PlayerData.m_UnderRoofTimer));
if ( data.m_PlayerData.m_WaterLevel > 0 )
{
DbgUI.Text(string.Format("Water Level: %1", data.m_PlayerData.m_WaterLevel));
}
}
DbgUI.End();
DbgUI.Begin("Weather stats:", windowPosX, windowPosY + 200);
if ( enabled )
{
DbgUI.Text(string.Format("Env temperature (base): %1", data.m_MiscData.m_TemperatureBase));
DbgUI.Text(string.Format("Env temperature (modfied): %1", data.m_MiscData.m_TemperatureModified));
DbgUI.Text(string.Format("Wind: %1 (x%2)", data.m_WeatherData.m_Wind, data.m_WeatherData.m_WindModifier));
DbgUI.Text(string.Format("Rain: %1", data.m_WeatherData.m_Rain));
DbgUI.Text(string.Format("Day/Night (1/0): %1", data.m_MiscData.m_DayOrNight));
DbgUI.Text(string.Format("Fog: %1", data.m_WeatherData.m_Fog));
DbgUI.Text(string.Format("Clouds: %1", data.m_WeatherData.m_Clouds));
DbgUI.Text(string.Format("Height: %1", data.m_MiscData.m_Height));
DbgUI.Text(string.Format("Wet delta: %1", data.m_MiscData.m_WetDelta));
}
DbgUI.End();
}
void FillDebugWeatherData(EnvDebugWeatherData data)
{
data.m_Wind = m_Wind;
data.m_WindModifier = GetWindModifierPerSurface();
data.m_Rain = m_Rain;
data.m_Fog = m_Fog;
data.m_Clouds = m_Clouds;
}
#endif
string GetDebugMessage()
{
string message;
message += "Player stats";
message += "\nHeat comfort: " + m_HeatComfort.ToString();
message += "\nInside: " + IsInsideBuilding().ToString() + " (" + m_Player.GetSurfaceType() + ")";
message += "\nUnder roof: " + m_IsUnderRoof.ToString() + " (" + GetNextRoofCheck() + ")";
if (IsWaterContact() && m_WaterLevel > WATER_LEVEL_NONE)
{
message += "\nWater Level: " + m_WaterLevel;
}
message += "\n\nWeather stats";
message += "\nEnv temperature (base): " + g_Game.GetMission().GetWorldData().GetBaseEnvTemperature().ToString();
message += "\nEnv temperature (modified): " + m_EnvironmentTemperature.ToString();
message += "\nWind: " + m_Wind.ToString() + " (x" + GetWindModifierPerSurface() + ")";
message += "\nRain: " + m_Rain.ToString();
message += "\nDay/Night (1/0): " + m_DayOrNight.ToString();
message += "\nFog: " + m_Fog.ToString();
message += "\nClouds: " + m_Clouds.ToString();
message += "\nHeight: " + GetTemperatureHeightCorrection().ToString();
message += "\nWet delta: " + GetWetDelta().ToString();
return message;
}
int GetNextRoofCheck()
{
return (GameConstants.ENVIRO_TICK_ROOF_RC_CHECK - m_RoofCheckTimer) + 1;
}
float GetWaterLevel()
{
if (IsWaterContact() && m_WaterLevel > WATER_LEVEL_NONE)
{
return m_WaterLevel;
}
else
{
return 0;
}
}
float GetDayOrNight()
{
return m_DayOrNight;
}
private void LogDryWetProcess(string message, bool indented = false)
{
#ifdef DIAG_DEVELOPER
if (m_DebugLogDryWet)
{
string indentation = "";
if (indented)
indentation = "|--";
Debug.Log(string.Format("%1 %2", indentation, message));
}
#endif
}
}
class EnvironmentDrynessData
{
bool m_UseTemperatureSources = false;
float m_TemperatureSourceDistance = 1.0;
}
#ifdef DIAG_DEVELOPER
class EnvDebugPlayerData : Param
{
float m_HeatComfort;
bool m_Inside;
string m_Surface;
bool m_UnderRoof;
int m_UnderRoofTimer;
float m_WaterLevel;
void Synch(Environment env, PlayerBase player)
{
m_HeatComfort = player.GetStatHeatComfort().Get();
m_Inside = env.IsInsideBuilding();
m_Surface = player.GetSurfaceType();
m_UnderRoof = env.IsUnderRoof();
m_UnderRoofTimer = env.GetNextRoofCheck();
m_WaterLevel = env.GetWaterLevel();
}
override bool Serialize(Serializer ctx)
{
return (
ctx.Write(m_HeatComfort) && ctx.Write(m_Inside) && ctx.Write(m_Surface) && ctx.Write(m_UnderRoof) && ctx.Write(m_UnderRoofTimer) && ctx.Write(m_WaterLevel));
}
override bool Deserializer(Serializer ctx)
{
return ctx.Read(m_HeatComfort) && ctx.Read(m_Inside) && ctx.Read(m_Surface) && ctx.Read(m_UnderRoof) && ctx.Read(m_UnderRoofTimer) && ctx.Read(m_WaterLevel);
}
}
class EnvDebugMiscData : Param
{
float m_TemperatureBase;
float m_TemperatureModified;
float m_DayOrNight;
float m_Height;
float m_WetDelta;
void Synch(Environment env)
{
m_TemperatureBase = g_Game.GetMission().GetWorldData().GetBaseEnvTemperature();
m_TemperatureModified = env.GetTemperature();
m_DayOrNight = env.GetDayOrNight();
m_Height = env.GetTemperatureHeightCorrection();
m_WetDelta = env.GetWetDelta();
}
override bool Serialize(Serializer ctx)
{
return ctx.Write(m_TemperatureBase) && ctx.Write(m_TemperatureModified) && ctx.Write(m_DayOrNight) && ctx.Write(m_Height) && ctx.Write(m_WetDelta);
}
override bool Deserializer(Serializer ctx)
{
return ctx.Read(m_TemperatureBase) && ctx.Read(m_TemperatureModified) && ctx.Read(m_DayOrNight) && ctx.Read(m_Height) && ctx.Read(m_WetDelta);
}
}
class EnvDebugWeatherData : Param
{
float m_Wind;
float m_WindModifier;
float m_Rain;
float m_Fog;
float m_Clouds;
void Synch(Environment env)
{
env.FillDebugWeatherData(this);
}
override bool Serialize(Serializer ctx)
{
return ctx.Write(m_Wind) && ctx.Write(m_WindModifier) && ctx.Write(m_Rain) && ctx.Write(m_Fog) && ctx.Write(m_Clouds);
}
override bool Deserializer(Serializer ctx)
{
return ctx.Read(m_Wind) && ctx.Read(m_WindModifier) && ctx.Read(m_Rain) && ctx.Read(m_Fog) && ctx.Read(m_Clouds);
}
}
class EnvDebugData : Param
{
ref EnvDebugPlayerData m_PlayerData = new EnvDebugPlayerData();
ref EnvDebugMiscData m_MiscData = new EnvDebugMiscData();
ref EnvDebugWeatherData m_WeatherData = new EnvDebugWeatherData();
void Synch(Environment env, PlayerBase player)
{
m_PlayerData.Synch(env, player);
m_MiscData.Synch(env);
m_WeatherData.Synch(env);
}
override bool Serialize(Serializer ctx)
{
return m_PlayerData.Serialize(ctx) && m_MiscData.Serialize(ctx) && m_WeatherData.Serialize(ctx);
}
override bool Deserializer(Serializer ctx)
{
return m_PlayerData.Deserializer(ctx) && m_MiscData.Deserializer(ctx) && m_WeatherData.Deserializer(ctx);
}
}
#endif |