VoidExpanse/events

From AtomicTorchWiki
Jump to: navigation, search


Warning.png This article is a draft and may contain incomplete or even incorrect information. You can help by expanding it.

Events

Events in scripts are governed by scope actions. You can create your own events, or you can subscribe to events created by other modders, but all scripting system is based on built-in events, which are the following:

"OnEnterFrame"

input:

  • double: multiplier - time in seconds passed since last frame

Called every frame on server. NOTE: Can be manipulated with scope-script - to make it work not every frame, but every timer interval or definite frames per second.

"OnChatReceive"

input:

  • string: from
  • string: text

Called when some player send chat message.

"OnCalculateInventoryCache"

input:

  • string: player_name
  • double: seconds_multiplier
  • int: ship_id
  • int: level

Called when it's time to recalculate equipment - for example, when player installs new hull or weapon.


"OnCalculateSkillsCache"

input:

  • string: player_name
  • double: seconds_multiplier
  • int: ship_id
  • int: level

Called when it's time to recalculate skills cache - usually when player takes new skill, or advances in an old one.


"OnCalculateBuffsCache"

input:

  • string: player_name
  • double: seconds_multiplier
  • int: ship_id
  • int: level

Called when active effects (buffs) are changed - for example, effect of consumable item is worn off.

"OnCalculateShipParameters"

input:

  • string: player_name
  • double: seconds_multiplier
  • int: ship_id
  • int: level

Called if any of other caches has been changed. Recalculation of final ship's cache.

"OnCollision"

input:

  • double: collision_point_x
  • double: collision_point_y
  • double: impulse
  • int: object_id_1
  • int: object_id_2
  • string: object_type_1
  • string: object_type_2
  • double: vector_x
  • double: vector_y

Called when some objects collided.

"OnHit"

input:

  • int: caster_id
  • double: collision_point_x
  • double: collision_point_y
  • int: object_id
  • string: object_type
  • string: projectile_id
  • string: projectile_type //bullet, ray
  • double: vector_x
  • double: vector_y
  • string: weapon_id
  • double: distance
  • double: projectile_distance
  • double: projectile_max_distance
  • double: multiplier

Called every time one ship hits with weapon another one.

"OnRayHitProjectile" not implemented yet

"OnUpdateShipParameters"

input:

  • string: player_name
  • double: seconds_multiplier
  • int: ship_id
  • int: level

Called 5 times per second. Used for regeneration, fuel and energy consumption calculations etc.

"OnMaximizeShipValues"

input:

  • string: player_name
  • double: seconds_multiplier
  • int: ship_id
  • int: level

Called every time ship values are maximized (on space station for example).

"OnBaseGenerateStock"

input:

  • int: station_id

Called every time stock on station is needed to be refreshed.

"OnStarSystemUpdate"

input:

  • int: system_id
  • bool: populated

Called once per specified amount of time (which is set by special function in game scope). Called for populated systems and non-populated.

"OnCalculateNpcLeveledCache"

input:

  • string: player_name
  • double: seconds_multiplier
  • int: ship_id
  • int: level

Called when NPC is created. As soon as npc doesn't have any real equipment, their equipment cache is calculated based on it's level, and it should be done in this function.

"OnShipTryToEnterJumpgate"

input:

  • int: current_system_id
  • int: destination_system_id
  • int: jumpgate_id
  • int: ship_id

Called when player's ship is trying to enter jumpgate. NOTE! This event has a return value. Handler may not return anything, but if it'll return object with field {allow: false}, ship will not pass through jumpgate. With field "message" : {message: "Use the force, Luke!"} you can control notification, which client will see in his notification area. As soon as any on handlers will return {allow:false}, chain of calls breaks, and other subscribers won't get the event.

"OnShipKilled"

input:

  • int: caster_id
  • double: collision_point_x
  • double: collision_point_y
  • int: object_id
  • string: object_type
  • string: projectile_id
  • string: projectile_type //bullet, ray
  • double: vector_x
  • double: vector_y
  • string: weapon_id
  • double: distance
  • double: projectile_distance
  • double: projectile_max_distance
  • double: multiplier

Called every time ship is killed by other ship.

"OnShipDestroyed"

input:

  • int: ship_id

Called every time ship is destroyed.

"OnShipWarps"

input:

  • int: ship_id

Called every time ship warps. NOTE! This event has a return value. Handler may not return anything, but if it'll return object with field {allow: false}, ship will not pass through jumpgate. With field "message" : {message: "Use the force, Luke!"} you can control notification, which client will see in his notification area. As soon as any on handlers will return {allow:false}, chain of calls breaks, and other subscribers won't get the event.

"OnPlayerEntersGame"

input:

  • string: name

Called every time player enters the game

"OnPlayerEntersSystem"

input:

  • string: name
  • int: system_id

Called every time player enters system


VoidExpanse Modding (Edit template)

Using mods: Installing and using mods

Overview articles: Modding (main article), Package files structure

Topic specific articles: Assets modding, Content Modding, Scripting overview, Scripting API, Scripting Events system, Localization

Detailed scripting articles: Internal scripts, Global scripts, object scripts, Device scripts, Consumable scripting

Tools: VE Physics Adjuster, VE Mod Uploader (Steam), AT Localization Utility