File size: 30,180 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 |
/** @file */
// -------------------------------------------------------------------------
// object (SF) Spawn Flags (use to setup behavior and/ or trigger functionality)
//
const int ECE_NONE = 0;
const int ECE_SETUP = 2; // process full entity setup (when creating NEW entity)
const int ECE_TRACE = 4; // trace under entity when being placed (from the point of creation)
const int ECE_CENTER = 8; // use center from shape (model) for placement
const int ECE_UPDATEPATHGRAPH = 32; // update navmesh when object placed upon it
const int ECE_ROTATIONFLAGS = 512; // enable rotation flags for object placement
const int ECE_CREATEPHYSICS = 1024; // create collision envelope and related physics data (if object has them)
const int ECE_INITAI = 2048; // init ai
const int ECE_AIRBORNE = 4096; // create flying unit in the air
const int ECE_EQUIP_ATTACHMENTS = 8192; // equip with configured ATTACHMENTS
const int ECE_EQUIP_CARGO = 16384; // equip with configured CARGO
const int ECE_EQUIP = 24576; // equip with configured (ATTACHMENTS + CARGO)
const int ECE_EQUIP_CONTAINER = 2097152; // populate DE/ group CONTAINER during spawn
const int ECE_LOCAL = 1073741824; // create object locally
const int ECE_NOSURFACEALIGN = 262144; // do not align object on surface/ terrain
const int ECE_KEEPHEIGHT = 524288; // keep height when creating object (do not use trace or placement on surface)
const int ECE_NOLIFETIME = 4194304; // do not set lifetime when creating the object
const int ECE_NOPERSISTENCY_WORLD = 8388608; // do not save this object in world
const int ECE_NOPERSISTENCY_CHAR = 16777216; // do not save this object in character
const int ECE_DYNAMIC_PERSISTENCY = 33554432; // spawns in without persistency, once player takes it, persistency will be enabled if available
// note: use predefined combination when not solving something specific
//
const int ECE_IN_INVENTORY = 787456; // ECE_CREATEPHYSICS|ECE_KEEPHEIGHT|ECE_NOSURFACEALIGN
const int ECE_PLACE_ON_SURFACE = 1060; // ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH|ECE_TRACE
const int ECE_OBJECT_SWAP = 787488; // ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH|ECE_KEEPHEIGHT|ECE_NOSURFACEALIGN
const int ECE_FULL = 25126; // ECE_SETUP|ECE_TRACE|ECE_ROTATIONFLAGS|ECE_UPDATEPATHGRAPH|ECE_EQUIP
// -------------------------------------------------------------------------
// object (RF) Rotation Flags (use to force and/ or invoke placement rotation)
//
const int RF_NONE = 0;
const int RF_FRONT = 1; // front side placement
const int RF_TOP = 2; // top side placement
const int RF_LEFT = 4; // left side placement
const int RF_RIGHT = 8; // right side placement
const int RF_BACK = 16; // back side placement
const int RF_BOTTOM = 32; // bottom side placement
const int RF_ALL = 63; // RF_FRONT|RF_TOP|RF_LEFT|RF_RIGHT|RF_BACK|RF_BOTTOM
const int RF_IGNORE = 64; // ignore placement RF flags - object will spawn as model was created
const int RF_TOPBOTTOM = 34; // RF_TOP|RF_BOTTOM
const int RF_LEFTRIGHT = 12; // RF_LEFT|RF_RIGHT
const int RF_FRONTBACK = 17; // RF_FRONT|RF_BACK
const int RF_RANDOMROT = 64; // allow random rotation around axis when placing
const int RF_ORIGINAL = 128; // use default placement setuped on object in config
const int RF_DECORRECTION = 256; // angle correction when spawning InventoryItem at Building angle
const int RF_DEFAULT = 512; // use default placement setuped on object in config
// -------------------------------------------------------------------------
//! Categories for CEApi.EconomyLog
class EconomyLogCategories
{
private void EconomyLogCategories();
private void ~EconomyLogCategories();
const string Economy = "economy";
const string EconomyRespawn = "economy_respawn";
const string RespawnQueue = "respawn_queue";
const string Container = "container";
const string Matrix = "matrix";
const string UniqueLoot = "uniqueloot";
const string Bind = "bind";
const string SetupFail = "setupfail";
const string Storage = "storage";
const string Classes = "class";
const string Category = "category";
const string Tag = "tag";
const string SCategory = "s_category";
const string STag = "s_tag";
const string SAreaflags = "s_areaflags";
const string SCrafted = "s_crafted";
const string MapGroup = "map_group";
const string MapComplete = "map_complete";
const string InfectedZone = "infected_zone";
}
// -------------------------------------------------------------------------
//! Special strings for CEApi.EconomyMap
class EconomyMapStrings
{
private void EconomyMapStrings();
private void ~EconomyMapStrings();
/**
\brief Generates string that will make CEApi.EconomyMap use all items with this category
\note This is refering to the CE categories of loot defined in cfglimitsdefinition.xml
\warning This is persistent per session, when you set it, it will persist until it is set to something else
\param category \p string The desired loot category
\return \p string The string to pass into CEApi.EconomyMap
@code
GetCEApi().EconomyMap(EconomyMapStrings.Category("food"));
@endcode
*/
static string Category(string category)
{
return string.Format("category:%1", category);
}
/**
\brief Generates string that will make CEApi.EconomyMap use all items with this tag
\note This is refering to the CE tags of loot defined in cfglimitsdefinition.xml
\warning This is persistent per session, when you set it, it will persist until it is set to something else
\param category \p string The desired loot tag
\return \p string The string to pass into CEApi.EconomyMap
@code
GetCEApi().EconomyMap(EconomyMapStrings.Tag("floor"));
@endcode
*/
static string Tag(string tag)
{
return string.Format("tag:%1", tag);
}
//! Everything
const string ALL_ALL = "all:all";
//! All loot
const string ALL_LOOT = "all:loot";
//! All vehicles
const string ALL_VEHICLE = "all:vehicle";
//! All infected
const string ALL_INFECTED = "all:infected";
//! All animals
const string ALL_ANIMAL = "all:animal";
//! All players
const string ALL_PLAYER = "all:player";
//! All proxies
const string ALL_PROXY = "all:proxy";
//! All static loot spawns
const string ALL_PROXY_STATIC = "all:proxystatic";
//! All dynamic loot spawns
const string ALL_PROXY_DYNAMIC = "all:proxydynamic";
//! All abandoned loot spawns
const string ALL_PROXY_ABANDONED = "all:proxyabandoned";
}
// -------------------------------------------------------------------------
//! Special strings for CEApi.EconomyOutput
class EconomyOutputStrings
{
private void EconomyOutputStrings();
private void ~EconomyOutputStrings();
/**
\brief Lists stats regarding which loot spawn) that are linked together and how many there are
\note In logs: "[linked_groups]"
*/
const string LINKS = "links";
/**
\brief Lists loot spawns that have more loot than their maximum + 4
\note In logs: "[autotest:ListSuspiciousGroups]"
*/
const string SUSPICIOUS = "suspicious";
/**
\brief Lists DE spawns that have positions that are within supplied range (< fRange, not equal)
\note In logs: "[ClosePosition]"
*/
const string DE_CLOSE_POINT = "declosepoint";
/**
\brief Lists loot spawns that have been marked as abandoned
\note In logs: "[autotest:ListAbandonedGroups]"
*/
const string ABANDONED = "abandoned";
/**
\brief Lists loot spawns that are not abandoned but have no loot
\note In logs: "[autotest:ListEmptyGroups]"
*/
const string EMPTY = "empty";
/**
\brief Lists loot spawns that are not abandoned and within the supplied range (< fRange, not equal)
\note In logs: "[autotest:ListCloseGroups]"
\note Is the same as CEApi.ListCloseProxy
*/
const string CLOSE = "close";
/**
\brief Lists the number of objects inside of categories
\note In logs: "[autotest:ProcessDebugLog]"
*/
const string WORLD = "world";
/**
\brief Lists overall CE stats
\note In logs: "[autotest:OverallStatus]"
*/
const string STATUS = "status";
/**
\brief Lists the maxlootsize of all CE items
\note In logs: "[autotest:ListLootSize]"
*/
const string LOOT_SIZE = "lootsize";
}
// -------------------------------------------------------------------------
enum ESpawnVolumeVis
{
OFF = 0,
ADAPTIVE,
VOLUME,
OCCUPIED,
}
// -------------------------------------------------------------------------
/**
\brief API to interact with Central Economy
\note Accessible through GetCEApi, make sure to read the documentation for that as well
\note Any mention of 'storage/' means the '$mission:storage_#' folder
*/
class CEApi
{
private void CEApi() {}
private void ~CEApi() {}
/**
\brief Regenerates "storage/spawnpoints.bin" if necessary
\note Already happens automatically when server starts before it is loaded in
@code
GetCEApi().ExportSpawnData();
@endcode
*/
proto native void ExportSpawnData();
/**
\brief Generates "storage/export/mapgrouppos.xml"
\param vCenter \p vector Center of area to generate from
\note When using a zero vector, this will automatically get the world center
\param fRadius \p float Radius in meters of area to generate from
\note When 0, this will automatically get a radius covering the map
@code
// Export for whole map
GetCEApi().ExportProxyData();
@endcode
*/
proto native void ExportProxyData( vector vCenter = vector.Zero, float fRadius = 0 );
/**
\brief Generates "storage/export/mapgroupcluster.xml"
@code
GetCEApi().ExportClusterData();
@endcode
*/
proto native void ExportClusterData();
/**
\brief Generates "storage/export/mapgroupproto.xml"
@code
GetCEApi().ExportProxyProto();
@endcode
*/
proto native void ExportProxyProto();
/**
\brief Invalidates loot spawn points which are closer than the radius supplied
\note Will output a message indicating how many points were invalidated
\param fRadius \p float The minimum desired distance in meters between loot spawn points
\note When 0 it will use a radius of 0.5
\param bAllSelections \p bool When false, will only check the points within a container against each other, when true will against all points
@code
// Example: I want there to be a minimum distance of 0.3m between any loot spawn point
GetCEApi().MarkCloseProxy(0.3, true);
@endcode
*/
proto native void MarkCloseProxy( float fRadius, bool bAllSelections );
/**
\brief Removes all invalid points
\note Is best paired with a MarkCloseProxy call first to invalidate unwanted points
\note Will output a message indicating the amount of deleted points
@code
GetCEApi().RemoveCloseProxy();
@endcode
*/
proto native void RemoveCloseProxy();
/**
\brief Outputs a list of all loot points closer than specified radius
\note This will automatically be checking all points against all points
\note This is a better way of handling it than the above two methods, as it can be then be removed manually from the xmls
\note Is the same as CEApi.EconomyOutput(EconomyOutputStrings.CLOSE, fRadius)
\param fRadius \p float The minimum desired distance in meters between loot spawn points
@code
GetCEApi().ListCloseProxy(0.3);
@endcode
*/
proto native void ListCloseProxy( float fRadius );
/**
\brief Will emulate the spawning of the item which is being looked at and generate images (.tga) in storage/lmap and output logs
\note DEVELOPER/DIAG ONLY
\note This will only work if the loot spawner is active
\param sClassName \p string The class name of the desired item to analyze
\note When using "*" as class name, instead of generating images, it will generate a .csv in storage/log containing the output of all spawnable items
\return \p bool Whether the operation was successful, it might fail in certain scenarios if the CE doesn't update in time
@code
GetCEApi().SpawnAnalyze("FlatCap_Grey");
@endcode
*/
proto native bool SpawnAnalyze( string sClassName );
/**
\brief Subtracts the supplied value from the current lifetime of all items in the world
\note Uses RadiusLifetimeDecrease under the hood and then calculates the parameters to fit the world
\note Will automatically clamp result between min and max lifetime [3, 316224000] (3 seconds to 10 years)
\param fShift \p float The value in seconds which will be subtracted from the current lifetimes
@code
// Shortens the lifetimes of all items in the world by 3 seconds
GetCEApi().TimeShift(3);
@endcode
*/
proto native void TimeShift( float fShift );
/**
\brief Fills in the Debug Lifetime, which will be used for any new DE spawned
\param fLifeTime \p float The lifetime for any DE spawned after this call
\note When this is set back to 0, it will stop using the Debug Lifetime
@code
// Any DE spawned after this call will have a lifetime of 300 seconds
GetCEApi().OverrideLifeTime(300);
@endcode
*/
proto native void OverrideLifeTime( float fLifeTime );
/**
\brief Force spawn specific prototype group + loot at position
\note DEVELOPER/DIAG ONLY
\note This can also spawn in other CE & DE related objects, but is best used exclusively for testing prototype groups
\param sGroupName \p string The group name to spawn
\param vPos \p vector The position to spawn the Entity at
\param fAngle \p float Angle to spawn the Entity with in degrees [0, 360]
\note When a negative value, will pick a random one
\return \p Entity The spawned Entity or null if unsuccessful
@code
GetCEApi().SpawnGroup("Land_Shed_M1", Vector(5, 10, 5));
@endcode
*/
proto native Entity SpawnGroup( string sGroupName, vector vPos, float fAngle = -1 );
/**
\brief Force spawn specific dynamic event
\note DEVELOPER/DIAG ONLY
\note Versatile, can be used for Animal, Infected, Static, Item and Vehicle
\note Is the only one capable of spawning DE's that have DE Groups
\note Is the same as the next one, but has ECE_FULL flags and a hidden flag which overrides herd limit
\note This is also FORCE spawn, so it will bypass any limit and avoidance checks
\param sEvName \p string The DE to spawn
\param vPos \p vector The position to spawn the Entity at
\param fAngle \p float Angle to spawn the Entity with in degrees [0, 360]
\note When a negative value, will pick a random one
\return \p bool Whether the spawn was successful
@code
GetCEApi().SpawnDE("StaticHeliCrash", Vector(5, 10, 5));
@endcode
*/
proto native void SpawnDE( string sEvName, vector vPos, float fAngle = -1 );
/**
\brief Force spawn specific dynamic event
\note DEVELOPER/DIAG ONLY
\note Is the same one as above but with the possibility of custom flags
\param sEvName \p string The DE to spawn
\param vPos \p vector The position to spawn the Entity at
\param fAngle \p float Angle to spawn the Entity with in degrees [0, 360]
\note When a negative value, will pick a random one
\param uFlags \p int ECE flags to apply while spawning the DE
\return \p bool Whether the spawn was successful
@code
GetCEApi().SpawnDEEx("StaticHeliCrash", Vector(5, 10, 5), ECE_FULL);
@endcode
*/
proto native void SpawnDEEx( string sEvName, vector vPos, float fAngle, int uFlags );
/**
\brief Spawn an item through CE
\note DEVELOPER/DIAG ONLY
\param sEvName \p string The DE to spawn
\param vPos \p vector The position to spawn the Entity at
\param fAngle \p float Angle to spawn the Entity with in degrees [0, 360]
\note When a negative value, will pick a random one
\param iCount \p int The amount of items
\param fRange \p float Circle radius
\note When iCount is larger than 1, changing this will make it so that they are spawned in a circle around vPos
@code
GetCEApi().SpawnLoot("Deagle", Vector(5, 10, 5), 0, 9, 1);
@endcode
*/
proto native void SpawnLoot( string sEvName, vector vPos, float fAngle, int iCount = 1, float fRange = 1 );
/**
\brief Spawn all entities with dynamic category through CE
\note DEVELOPER/DIAG ONLY
\note Will print additional logs to RPT
\param vPos \p vector The position to spawn the Entities at
\note This will be the starting position, the items will be split into segments by CE BBox size (smallest to largest)
\param bShowCylinders \p bool Whether to draw the CE BBox with debug shapes
\note Red: Invalid BBox; Yellow: Not in DB; Green: All ok
\param fDefaultDistance \p float The default distance to use when the entity does not have a CE BBox
\note This means that all the ones with invalid CE BBoxes will be piled up at the starting position when this is 0
@code
GetCEApi().SpawnDynamic(Vector(5, 10, 5), true);
@endcode
*/
proto native void SpawnDynamic( vector vPos, bool bShowCylinders = true, float fDefaultDistance = 0 );
/**
\brief Spawn all entities with vehicles category through CE
\note DEVELOPER/DIAG ONLY
\note Will print additional logs to RPT
\param vPos \p vector The position to spawn the Entities at
\note This will be the starting position, vehicles spawn with 20m spacing
\note Make sure you do it on a surface as flat and open as possible, they need a lot of space
\param bShowCylinders \p bool Does nothing for Vehicles, left for backwards compat
\param fDefaultDistance \p float The default distance to use when the entity does not have a CE BBox
\note This means that all the ones with invalid CE BBoxes will be piled up at the starting position when this is 0
@code
GetCEApi().SpawnVehicles(Vector(5, 10, 5));
@endcode
*/
proto native void SpawnVehicles( vector vPos, bool bShowCylinders = false, float fDefaultDistance = 20 );
/**
\brief Spawn all entities with building category through CE
\note DEVELOPER/DIAG ONLY
\note Will print additional logs to RPT
\param vPos \p vector The position to spawn the Entities at
\note This will be the starting position, the items will be split into segments by CE BBox size (smallest to largest)
\param bShowCylinders \p bool Whether to draw the CE BBox with debug shapes
\note Red: Invalid BBox; Yellow: Not in DB; Green: All ok
\note These will most likely just always be red
\param fDefaultDistance \p float The default distance to use when the entity does not have a CE BBox
\note This means that all the ones with invalid CE BBoxes will be piled up at the starting position when this is 0
@code
GetCEApi().SpawnBuilding(Vector(5, 10, 5), true);
@endcode
*/
proto native void SpawnBuilding( vector vPos, bool bShowCylinders = false, float fDefaultDistance = 20 );
/**
\brief Spawn an entity through CE
\note DEVELOPER/DIAG ONLY
\note Is similar to SpawnLoot, but works better on Animal/Infected/Vehicle
\param sClassName \p string The entity to spawn
\param vPos \p vector The position to spawn the Entity at
\param fRange \p float Circle radius
\note When iCount is larger than 1, changing this will make it so that they are spawned in a circle around vPos
\param iCount \p int The amount of items
@code
GetCEApi().SpawnEntity("Deagle", Vector(5, 10, 5), 1, 9);
@endcode
*/
proto native void SpawnEntity( string sClassName, vector vPos, float fRange, int iCount );
/**
\brief Spawn an entity through CE
\note DEVELOPER/DIAG ONLY
\note Is the same as SpawnEntity, but spawns only one and returns the spawned Object
\param sClassName \p string The entity to spawn
\param vPos \p vector The position to spawn the Entity at
\return \p Object The spawned Object
@code
GetCEApi().SpawnSingleEntity("Deagle", Vector(5, 10, 5));
@endcode
*/
proto native Object SpawnSingleEntity( string sClassName, vector vPos );
/**
\brief Spawn an entity through CE
\note DEVELOPER/DIAG ONLY
\note Is the same as SpawnEntity, under the hood it just defaults to RF_ORIGINAL
\param sClassName \p string The entity to spawn
\param vPos \p vector The position to spawn the Entity at
\param fRange \p float Circle radius
\note When iCount is larger than 1, changing this will make it so that they are spawned in a circle around vPos
\param iCount \p int The amount of items
\param iFlags \p int The rotation flags to apply
@code
GetCEApi().SpawnRotation("Deagle", Vector(5, 10, 5), 1, 9, RF_ALL);
@endcode
*/
proto native void SpawnRotation( string sClassName, vector vPos, float fRange, int iCount, int iFlags );
/**
\brief Spawn an entity through CE, x amount of times in a grid
\note DEVELOPER/DIAG ONLY
\note The name may imply it does something else, but a profiler is needed to actually benchmark it
\note The position starts at 0 0 0
\param sClassName \p string The entity to spawn
\param iCount \p int The amount of items
@code
GetCEApi().SpawnPerfTest("Deagle", 30);
@endcode
*/
proto native void SpawnPerfTest( string sClassName, int iCount );
/**
\brief Queue up the depleting of lifetime of everything in the world
\note DEVELOPER/DIAG ONLY
@code
GetCEApi().CleanMap();
@endcode
*/
proto native void CleanMap();
/**
\brief Outputs debug file to storage/log/*.csv
\note DEVELOPER/DIAG ONLY
\param sLogType \p string The type of log (EconomyLogCategories)
@code
GetCEApi().EconomyLog(EconomyLogCategories.Economy);
@endcode
*/
proto native void EconomyLog( string sLogType );
/**
\brief Outputs debug file to storage/lmap/*.tga showing the current places this is spawned
\note DEVELOPER/DIAG ONLY
\note This works best when you have an image of the map to overlay the tga with afterwards
\param sMapType \p string The type of lmap, can be just a class name or a special string
\note There are several prefixes and sets of strings that can be passed in here, see EconomyMapStrings
@code
// To check only a specific item
GetCEApi().EconomyMap("Deagle");
@endcode
*/
proto native void EconomyMap( string sMapType );
/**
\brief Outputs debug logs into server log or rpt
\note DEVELOPER/DIAG ONLY
\param sOutputType \p string One of the strings specified in EconomyOutputStrings
\param fRange \p float Range parameter used for some of the options
@code
GetCEApi().EconomyOutput(EconomyOutputStrings.CLOSE, 3);
@endcode
*/
proto native void EconomyOutput( string sOutputType, float fRange );
/**
\brief Process lifetime increase within radius by value (sec)
\note Will automatically clamp result between min and max lifetime [3, 316224000] (3 seconds to 10 years)
\param vCenter \p vector The center point
\param fRadius \p float The radius around the center point
\param fValue \p float The value to increase the lifetime by
\note When 0, this will reset it to default instead (but it's better to use RadiusLifetimeReset still)
@code
GetCEApi().RadiusLifetimeIncrease(Vector(500, 0, 500), 3, 500);
@endcode
*/
proto native void RadiusLifetimeIncrease( vector vCenter, float fRadius, float fValue );
/**
\brief Process lifetime decrease within radius by value (sec)
\note Will automatically clamp result between min and max lifetime [3, 316224000] (3 seconds to 10 years)
\param vCenter \p vector The center point
\param fRadius \p float The radius around the center point
\param fValue \p float The value to decrease the lifetime by
@code
GetCEApi().RadiusLifetimeDecrease(Vector(500, 0, 500), 3, 500);
@endcode
*/
proto native void RadiusLifetimeDecrease( vector vCenter, float fRadius, float fValue );
/**
\brief Process lifetime reset to default value from DB within radius
\param vCenter \p vector The center point
\param fRadius \p float The radius around the center point
@code
GetCEApi().RadiusLifetimeReset(Vector(500, 0, 500), 3);
@endcode
*/
proto native void RadiusLifetimeReset( vector vCenter, float fRadius );
/** \name Globals API
Get values from globals.xml
*/
//@{
/**
\brief Get int from globals.xml
\note type="0"
\param varName \p string The name of the entry
\return \p int The value or int.MIN if not found/not an int
*/
proto native int GetCEGlobalInt(string varName);
/**
\brief Get float from globals.xml
\note type="1"
\param varName \p string The name of the entry
\return \p float The value or float.MIN if not found/not a float
*/
proto native float GetCEGlobalFloat(string varName);
/**
\brief Get string from globals.xml
\note type="2"
\param varName \p string The name of the entry
\return \p string The value or empty string if not found/not a string
*/
proto native string GetCEGlobalString(string varName);
//@}
/** \name Avoidance API
Optimized internal methods that the CE uses to avoid spawning DE within certain distances
*/
//@{
/**
\brief Check if there is a player within a radius
\param vPos \p vector The center point
\param fDistance \p float The radius around the center point
\return \p bool Returns false when there is a player inside supplied area, true when it successfully avoided players
@code
GetCEApi().AvoidPlayer(Vector(500, 0, 500), 20);
@endcode
*/
proto native bool AvoidPlayer(vector vPos, float fDistance); // return false when there is a player
/**
\brief Check if there is a vehicle within a radius
\param vPos \p vector The center point
\param fDistance \p float The radius around the center point
\param sDEName \p string A specific DE to avoid, if left empty, will avoid all vehicles
\return \p bool Returns false when there is a vehicle inside supplied area, true when it successfully avoided vehicles
@code
GetCEApi().AvoidVehicle(Vector(500, 0, 500), 500, "VehicleCivilianSedan");
@endcode
*/
proto native bool AvoidVehicle(vector vPos, float fDistance, string sDEName = "");
/**
\brief Check if there is a vehicle within a radius
\param vPos \p vector The center point
\param fRange \p float The radius around the center point
\return \p int The amoutn of players inside supplied area
@code
GetCEApi().CountPlayersWithinRange(Vector(500, 0, 500), 500);
@endcode
*/
proto native int CountPlayersWithinRange(vector vPos, float fRange);
//@}
/** \name CE Debug menu Script API
DIAG ONLY: These options are available from the in-game debug menu on Diag exe (Game > Central Economy), documentation can be found on wiki
*/
//@{
// "Loot Spawn Edit"
//{
//! "Spawn Volume Vis"
proto native void LootSetSpawnVolumeVisualisation(ESpawnVolumeVis mode);
//! "Setup Vis"
proto native void LootToggleSpawnSetup(bool mode);
//! "Edit Volume"
proto native void LootToggleVolumeEditing(bool mode);
//! "Re-Trace Group Points"
proto native void LootRetraceGroupPoints();
//! "Export Group >>"
proto native void LootExportGroup();
//! "Export All Groups >>>>" / GetCEApi.ExportProxyProto();
proto native void LootExportAllGroups();
//! "<<< Export Map" / GetCEApi.ExportProxyData(vector.Zero, 0);
proto native void LootExportMap();
//! "<<< Export Clusters" / GetCEApi().ExportClusterData()
proto native void LootExportClusters();
//}
// "Loot Tool"
//{
//! "Deplete Lifetime"
proto native void LootDepleteLifetime();
//! "Set Damage = 1.0"
proto native void LootSetDamageToOne();
//! "Damage + Deplete"
proto native void LootDepleteAndDamage();
//}
// "Infected"
//{
//! "Infected Vis"
proto native void InfectedToggleVisualisation(bool mode);
//! "Infected Zone Info"
proto native void InfectedToggleZoneInfo(bool mode);
//! "Infected Spawn"
proto native void InfectedSpawn();
//! "Reset Cleanup"
proto native void InfectedResetCleanup();
//}
// "Animal"
//{
//! "Animal Vis"
proto native void AnimalToggleVisualisation(bool mode);
//! "Animal Spawn"
proto native void AnimalSpawn();
//! "Ambient Spawn"
proto native void AnimalAmbientSpawn();
//}
//! "Vehicle&Wreck Vis"
proto native void ToggleVehicleAndWreckVisualisation(bool mode);
//! "Loot Vis"
proto native void ToggleLootVisualisation(bool mode);
//! "Cluster Vis"
proto native void ToggleClusterVisualisation(bool mode);
//! "Dynamic Events Status"
proto native void ToggleDynamicEventStatus(bool mode);
//! "Dynamic Events Vis"
proto native void ToggleDynamicEventVisualisation(bool mode);
//! "Dynamic Events Spawn"
proto native void DynamicEventSpawn();
//! "Export Dyn Event >>"
proto native void DynamicEventExport();
//! "Overall Stats"
proto native void ToggleOverallStats(bool mode);
//@}
/** \name DEPRECATED/LEGACY
These don't do anything anymore but are left for backwards compatibility
*/
//@{
proto native void PlatformStatTest();
proto native void LootToggleProxyEditing(bool mode);
proto native void OnUpdate();
//@}
};
/**
\brief Get the CE API
\warning Only exists when the game has CE enabled
\note This means that this will work on anything which is running a mission with an initialized Hive
\note Client does not have Hive when connected to a server, only the server does if it was set up in the init.c
*/
proto native CEApi GetCEApi();
// -------------------------------------------------------------------------
class CEItemProfile
{
private void CEItemProfile() {}
private void ~CEItemProfile() {}
proto native int GetNominal(); // nominal - how many items should be aproximately in map
proto native int GetMin(); // min - minimal count should be available in map
proto native float GetQuantityMin(); // min quantity (0.0 - 1.0) (like ammobox - this determine how many bullets are there, or water bottle)
proto native float GetQuantityMax(); // max quantity (0.0 - 1.0) (like ammobox - this determine how many bullets are there, or water bottle)
proto native float GetQuantity(); // random quantity (0.0 - 1.0)
proto native float GetLifetime(); // maximum lifetime in (seconds) - what is the idle before item abandoned at ground gets deleted
proto native float GetRestock(); // restock is oposite of lifetime - idle before item is allowed to respawn when required
proto native int GetCost(); // cost of item determines its 'value' for players (this serve as priority during respawn and cleanup operation)
proto native int GetUsageFlags(); // area usage flags (each bit has assigned group - which as part of map overlay effectively affects spawning)
proto native int GetValueFlags(); // area value flags (each bit has assigned group - which as part of map overlay effectively affects spawning)
};
|