Difference between revisions of "DCS singleton world"

From DCS World Wiki - Hoggitworld.com
 
(7 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
|funcs= {{listOfWorldFuncs}}
 
|funcs= {{listOfWorldFuncs}}
  
|enums= The event enumerator defines all of the types of events that can occur.
+
|enums=  
 +
 
 +
The event enumerator defines all of the types of events that can occur.
 +
 
 +
{{DCS_enum_events}}
  
world.event = {
 
  S_EVENT_INVALID = 0,
 
  S_EVENT_SHOT = 1,
 
  S_EVENT_HIT = 2,
 
  S_EVENT_TAKEOFF = 3,
 
  S_EVENT_LAND = 4,
 
  S_EVENT_CRASH = 5,
 
  S_EVENT_EJECTION = 6,
 
  S_EVENT_REFUELING = 7,
 
  S_EVENT_DEAD = 8,
 
  S_EVENT_PILOT_DEAD = 9,
 
  S_EVENT_BASE_CAPTURED = 10,
 
  S_EVENT_MISSION_START = 11,
 
  S_EVENT_MISSION_END = 12,
 
  S_EVENT_TOOK_CONTROL = 13,
 
  S_EVENT_REFUELING_STOP = 14,
 
  S_EVENT_BIRTH = 15,
 
  S_EVENT_HUMAN_FAILURE = 16,
 
  S_EVENT_DETAILED_FAILURE = 17,
 
  S_EVENT_ENGINE_STARTUP = 18,
 
  S_EVENT_ENGINE_SHUTDOWN = 19,
 
  S_EVENT_PLAYER_ENTER_UNIT = 20,
 
  S_EVENT_PLAYER_LEAVE_UNIT = 21,
 
  S_EVENT_PLAYER_COMMENT = 22,
 
  S_EVENT_SHOOTING_START = 23,
 
  S_EVENT_SHOOTING_END = 24,
 
  S_EVENT_MARK_ADDED  = 25,
 
  S_EVENT_MARK_CHANGE = 26,
 
  S_EVENT_MARK_REMOVED = 27,
 
  S_EVENT_KILL = 28,
 
  S_EVENT_SCORE = 29,
 
  S_EVENT_UNIT_LOST = 30,
 
  S_EVENT_LANDING_AFTER_EJECTION = 31,
 
  S_EVENT_PARATROOPER_LENDING = 32,
 
  S_EVENT_DISCARD_CHAIR_AFTER_EJECTION = 33,
 
  S_EVENT_WEAPON_ADD = 34,
 
  S_EVENT_TRIGGER_ZONE = 35,
 
  S_EVENT_LANDING_QUALITY_MARK = 36,
 
  S_EVENT_BDA = 37,
 
  S_EVENT_AI_ABORT_MISSION = 38,
 
  S_EVENT_DAYNIGHT = 39,
 
  S_EVENT_FLIGHT_TIME = 40,
 
  S_EVENT_PLAYER_SELF_KILL_PILOT = 41,
 
  S_EVENT_PLAYER_CAPTURE_AIRFIELD = 42,
 
  S_EVENT_EMERGENCY_LANDING = 43,
 
  S_EVENT_UNIT_CREATE_TASK = 44,
 
  S_EVENT_UNIT_DELETE_TASK = 45,
 
  S_EVENT_SIMULATION_START = 46,
 
  S_EVENT_WEAPON_REARM = 47,
 
  S_EVENT_WEAPON_DROP = 48,
 
  S_EVENT_MAX = 49,
 
}
 
  
 
The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with [[DCS_event_birth|birth]]
 
The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with [[DCS_event_birth|birth]]
Line 86: Line 38:
 
   PYRAMID
 
   PYRAMID
 
  }
 
  }
 +
{{listOfVolumes}}
 +
  
 
|notes=  
 
|notes=  
Line 92: Line 46:
  
 
2.7.1? - 2.7.12 added events 38 through 45.
 
2.7.1? - 2.7.12 added events 38 through 45.
 +
 +
2.8.0 added events 46-48.
 +
 +
2.9.0 added 51-56
 +
 +
2.9.6 Moved and renamed some events, added other events to max list at 61
  
 
}}
 
}}
 
[[Category:Game Patch 1.2.0|world singleton]]
 
[[Category:Game Patch 1.2.0|world singleton]]

Latest revision as of 23:23, 22 July 2024


Singleton: world Added with: 1.2.0
Description: The world singleton contains functions centered around two different but extremely useful functions.

1. Events and event handlers are all governed within world.

Event Types: shot, hit, takeoff, land, crash, ejection, refueling, dead, pilot_dead, base_captured, mission_start, mission_end, took_control, refueling_stop, birth, human_failure, detailed_failure, engine_startup, engine_shutdown, player_enter_unit, player_leave_unit, player_comment, shooting_start, shooting_end, mark_added, mark_change, mark_remove, kill, score, unit_lost, landing_after_ejection, discard_chair_after_ejection, weapon_add, landing_quality_mark, ai_abort_mission, weapon_drop, runway_takeoff, runway_touch,

2. A number of functions to get information about the game world.

Functions: addEventHandler, removeEventHandler, getPlayer, getAirbases, searchObjects, getMarkPanels, removeJunk
Enumerators and Other Data: The event enumerator defines all of the types of events that can occur.
 world.event = {
   S_EVENT_INVALID = 0,
   S_EVENT_SHOT = 1,
   S_EVENT_HIT = 2,
   S_EVENT_TAKEOFF = 3,
   S_EVENT_LAND = 4,
   S_EVENT_CRASH = 5,
   S_EVENT_EJECTION = 6,
   S_EVENT_REFUELING = 7,
   S_EVENT_DEAD = 8,
   S_EVENT_PILOT_DEAD = 9,
   S_EVENT_BASE_CAPTURED = 10,
   S_EVENT_MISSION_START = 11,
   S_EVENT_MISSION_END = 12,
   S_EVENT_TOOK_CONTROL = 13,
   S_EVENT_REFUELING_STOP = 14,
   S_EVENT_BIRTH = 15,
   S_EVENT_HUMAN_FAILURE = 16,
   S_EVENT_DETAILED_FAILURE = 17,
   S_EVENT_ENGINE_STARTUP = 18,
   S_EVENT_ENGINE_SHUTDOWN = 19,
   S_EVENT_PLAYER_ENTER_UNIT = 20,
   S_EVENT_PLAYER_LEAVE_UNIT = 21,
   S_EVENT_PLAYER_COMMENT = 22,
   S_EVENT_SHOOTING_START = 23,
   S_EVENT_SHOOTING_END = 24,
   S_EVENT_MARK_ADDED  = 25, 
   S_EVENT_MARK_CHANGE = 26,
   S_EVENT_MARK_REMOVED = 27,
   S_EVENT_KILL = 28,
   S_EVENT_SCORE = 29,
   S_EVENT_UNIT_LOST = 30,
   S_EVENT_LANDING_AFTER_EJECTION = 31,
   S_EVENT_PARATROOPER_LENDING = 32,
   S_EVENT_DISCARD_CHAIR_AFTER_EJECTION = 33, 
   S_EVENT_WEAPON_ADD = 34,
   S_EVENT_TRIGGER_ZONE = 35,
   S_EVENT_LANDING_QUALITY_MARK = 36,
   S_EVENT_BDA = 37, 
   S_EVENT_AI_ABORT_MISSION = 38, 
   S_EVENT_DAYNIGHT = 39, 
   S_EVENT_FLIGHT_TIME = 40, 
   S_EVENT_PLAYER_SELF_KILL_PILOT = 41, 
   S_EVENT_PLAYER_CAPTURE_AIRFIELD = 42, 
   S_EVENT_EMERGENCY_LANDING = 43,
   S_EVENT_UNIT_CREATE_TASK = 44,
   S_EVENT_UNIT_DELETE_TASK = 45,
   S_EVENT_SIMULATION_START = 46,
   S_EVENT_WEAPON_REARM = 47,
   S_EVENT_WEAPON_DROP = 48,
   S_EVENT_UNIT_TASK_COMPLETE = 49,
   S_EVENT_UNIT_TASK_STAGE = 50,
   S_EVENT_MAC_EXTRA_SCORE= 51, 
   S_EVENT_MISSION_RESTART= 52,
   S_EVENT_MISSION_WINNER = 53,
   S_EVENT_RUNWAY_TAKEOFF= 54, 
   S_EVENT_RUNWAY_TOUCH= 55, 
   S_EVENT_MAC_LMS_RESTART= 56,
   S_EVENT_SIMULATION_FREEZE = 57, 
   S_EVENT_SIMULATION_UNFREEZE = 58, 
   S_EVENT_HUMAN_AIRCRAFT_REPAIR_START = 59, 
   S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH = 60,   
   S_EVENT_MAX = 61,
 }


The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth

world.BirthPlace = {
  wsBirthPlace_Air,
  wsBirthPlace_RunWay,
  wsBirthPlace_Park,
  wsBirthPlace_Heliport_Hot,
  wsBirthPlace_Heliport_Cold,
}

The volumeType enumerator defines the types of 3d geometery used within the world.searchObjects function

world.VolumeType = {
  SEGMENT,
  BOX,
  SPHERE,
  PYRAMID
}

Volumes: segment, box, sphere, pyramid

Notes: 2.5.5 Inserted S_EVENT_DETAILED_FAILURE into id 17.

2.5.6 Added S_EVENT_KILL, S_EVENT_SCORE , S_EVENT_UNIT_LOST , S_EVENT_LANDING_AFTER_EJECTION , -- Redacted for now. And changed S_EVENT_MAX to 33,

2.7.1? - 2.7.12 added events 38 through 45.

2.8.0 added events 46-48.

2.9.0 added 51-56

2.9.6 Moved and renamed some events, added other events to max list at 61