VoidExpanse/scope-generator

From AtomicTorchWiki
Revision as of 06:35, 13 February 2014 by Damonwall (talk | contribs)


Scope generator

Used for generation items, objects, systems in game, and also for getting some specific info about them.

Visibility: Global.

List of functions

AddAsteroid
Arguments Returns Example
  • int: system_id
  • double: coord_x
  • double: coord_y
  • string: type - xml id of asteroid
  • double: scale
  • double: resQ - resouces modifier
  • object: rotation
  • object: rotationSpeed

int: identifier of created object

var id = generator.AddAsteroid(1,100,100,"Asteroid01",1, 0, {x:0,y:0,z:0}, {x:0,y:0,z:0});
Description

Adds asteroid with specified parameters into game world. Asteroid contents (extractable resources), asteroid's look and other parameters can be modified only in .xml file, which is specified in this function by parameter "type".


AddBase
Arguments Returns Example
  • int: system_id
  • double: coord_x
  • double: coord_y
  • string: type - xml id of base
  • string: name
  • (optional) object: tags

int: identifier of created object

var id = generator.AddBase(1, 100, 100, "Base01", "Station Horizon", {class: "order"});
Description

Adds space station to game world.


AddItem
Arguments Returns Example
  • int: object_id
  • string: item_xml_id
  • int: quantity

object:

  • quantity - quantity was actually added
  • type - can be "item" or "resource"
var obj = generator.AddItem(1, "SomeItem", 5);
Description

Adds item to some object's inventory. In VoidExpanse not all objects do have inventory, so this function must be applied only to those, which have it, such as ships, space stations, containers.


AddContainer
Arguments Returns Example
  • int: system_id
  • double: coord_x
  • double: coord_y
  • string: xml_type
  • string: droplist
  • (optional) object: tags

int: identifier of object created

var id = generator.AddContainer(1, 0, 0, "Container01", "DropList01");
Description

Adds a floating container to game world. By default container is empty. Also containers, which has no contents, are unstable (self-destroyed as soon as someone will look at it's contents), so it's better not to create empty containers. Content can be added with generator.AddItem function.


AddDecoration
Arguments Returns Example
  • int: system_id
  • string: item_xml_id
  • vector2: position
  • double: depth
  • vector2: rotation
  • vector2: rotation_speed,
  • double: scale

int: ID of created object

var id = generator.AddDecoration(1, "Decoration01", {x:0,y:0}, 100, {x:5, y:5}, {x:5, y:5}, 2);
Description

Adds a decoration to game world. Decoration is a non-interactive object, which is used as a... decoration.


AddJumpgate
Arguments Returns Example
  • int: system_id
  • int: system_to
  • double: coord_x
  • double: coord_y
  • double: angle
  • string: xml_type
  • (optional) object: tags

int: ID of created object

var id = generator.AddJumpgate(1, 2, 100, 100, 20, "Jumpgate01", {sometag: "sometag"});
Description

Adds a jumpgate - an object, which allows ships to travel between systems. Every jumpgate must be paired with another one, for example, if in system A theres a jumpgate, that leads to system B, then in system B must be a jumpgate, that leads to system A.


AddNPCShipToSystem
Arguments Returns Example
  • string: npc_name
  • string: behavior - AI-script ("brains")
  • int: level
  • string: xml_type - npc xml type
  • int: system_id
  • double: coord_x
  • double: coord_y
  • (optional) object: tags

int: ID of created object

var id = generator.AddNPCShipToSystem("Pirate",
	"PirateAI", 100, "PirateNpc01",
	1, 105, 223, 
	{class: "pirate", uniq_id: "boss"});
Description

Adds an npc ship into game. NPC's avatar and faction are set through another functions - generator.SetNPCAvatar and relations.SetShipFaction


OverrideDropList
Arguments Returns Example
  • int: ship_id
  • array: droplists - strings array of droplists

void

generator.OverrideDropList(23303, ["DropList01", "DropList02"]);
Description

Adds specified droplists to npc's droplists list.


AddPlanet
Arguments Returns Example
  • int: system_id
  • double: coord_x
  • double: coord_y
  • string: name
  • int: seed

int: ID of created object

var id = generator.AddPlanet(1, 0, 0, "Earth", 123);
Description

Adds planet to game world. Planet's look is driven by seed, based on which planet's look will be defined by random generator. If you want a particular planet, you should either use seed with defined results (by our tool - SeedGenerator), or use another function - AddPlanetWithType.


AddPlanetWithType
Arguments Returns Example
  • int: system_id
  • double: coord_x
  • double: coord_y
  • string: name
  • int: seed
  • string: planet_config_type

int: ID of created object

var id = generator.AddPlanetWithType(1, 0, 0, "Earth", 123, "EarthTypePlanet");
Description

Adds planet to game world. Planet's look is driven partially be seed, but mostly by the specified type.


AddSpaceObject
Arguments Returns Example
  • int: system_id
  • double: coord_x
  • double: coord_y
  • string: xml_type_id
  • object: tags

int: ID of created object

var id = generator.AddSpaceObject(1, 0, 0, "Debris01", {class: "mine"})
Description

Adds a space object to game world. Space objects are interactive object. They cannot be destroyed, but they are interactive and collision-enabled. For example, spacemines are created with space objects.


AddSpaceObject
Arguments Returns Example
  • int: system_id
  • double: coord_x
  • double: coord_y
  • string: xml_type_id
  • object: tags

int: ID of created object

var id = generator.AddSpaceObject(1, 0, 0, "Debris01", {class: "mine"})
Description

Adds a space object to game world. Space objects are interactive object. They cannot be destroyed, but they are interactive and collision-enabled. For example, spacemines are created with space objects. As xml_type_id you can use keyword "random" - then