Module ORGM.Server.Spawn

Spawning Functions.

Info:

  • Copyright: 2018 File: server/1LoadOrder/ORGMServerSpawn.lua
  • Release: v3.09
  • Author: Fenris_Wolf

Functions

generateSerialNumber (item) Generates a serial number for the item.
attach (item) Attaches random components on a newly spawned firearm.
reloadable (container, itemType, ammoType, chance, max, isLoaded) Attempts to spawns reloadable weapon or magazine.
firearm (container, gunType, ammoType, chance, max, isLoaded) A wrapper function for Spawn.reloadable.
magazine (container, gunType, ammoType, chance, max, isLoaded) A wrapper function for Spawn.reloadable
item (container, itemType, chance, max) Generic spawn function for non-reloadable items (ie: ammo or repair stuff).
ammo (container, ammoType, chance, max) Attempts to spawn loose ammo in the container.
ammoBox (container, ammoType, chance, max) Attempts to spawn ammo boxes in the container.
ammoCan (container, ammoType, chance, max) Attempts to spawn ammo canisters in the container.
maintance (container, chance, max) Attempts to spawns a random maintance item.
component (container, chance, max) Attempts to spawns a firearm component.
select (civilian, police, military) Chooses a gun from the rarity tables and appropriate ammo type.
addToCorpse (container) Generic spawn function for corpses.
addToCivRoom (container) Generic spawn function for Civilian rooms.
fillContainer (roomName, containerType, container) Triggered by the OnFillContainer Event.


Functions

Methods
generateSerialNumber (item)
Generates a serial number for the item.

Parameters:

  • item InventoryItem
attach (item)
Attaches random components on a newly spawned firearm.

Parameters:

  • item HandWeapon
reloadable (container, itemType, ammoType, chance, max, isLoaded)
Attempts to spawns reloadable weapon or magazine.

It called by Spawn.firearm and Spawn.magazine.

Parameters:

  • container ItemContainer
  • itemType string name of the gun or magazine without the ORGM. prefix.
  • ammoType string ammo name to load into the gun if isLoaded = true.
  • chance float % chance to spawn the item.
  • max int max number of items to spawn. A random # is chosen between 1 and max
  • isLoaded bool if true the gun/magazine is loaded with ammoType

Returns:

    bool true if the reloadable spawned
firearm (container, gunType, ammoType, chance, max, isLoaded)
A wrapper function for Spawn.reloadable.

Parameters:

  • container ItemContainer
  • gunType string name of the gun without the ORGM. prefix.
  • ammoType string ammo name to load into the gun if isLoaded = true.
  • chance float % chance to spawn the item.
  • max int max number of items to spawn. A random # is chosen between 1 and max
  • isLoaded bool if true the gun/magazine is loaded with ammoType

Returns:

    bool true if the reloadable spawned
magazine (container, gunType, ammoType, chance, max, isLoaded)
A wrapper function for Spawn.reloadable

Parameters:

  • container ItemContainer
  • gunType string name of the gun to spawn magazines for without the ORGM. prefix.
  • ammoType string ammo name to load into the gun if isLoaded = true.
  • chance float % chance to spawn the item.
  • max int max number of items to spawn. A random # is chosen between 1 and max
  • isLoaded bool if true the gun/magazine is loaded with ammoType
item (container, itemType, chance, max)
Generic spawn function for non-reloadable items (ie: ammo or repair stuff).

This does not factor in Sandbox Loot Rarity or ORGM Spawn Settings. It is advised you use one of the wrapper functions to spawn items.

Note the itemType argument must have the module prefix, unlike the wrapper functions.

Parameters:

  • container ItemContainer
  • itemType string
  • chance float to spawn the item.
  • max int between 1 and max number of items may spawn.

Returns:

    table list of spawned InventoryItem objects
ammo (container, ammoType, chance, max)
Attempts to spawn loose ammo in the container.

Wrapper function for Spawn.item, modifying the chance argument by Sandbox Weapon Loot and ORGM Ammo Spawn Settings.

The ammoType argument must not contain the moduleName prefix

Parameters:

  • container ItemContainer
  • ammoType nil or string name of the ammo, randomly chosen if nil.
  • chance float base % chance to spawn the item.
  • max int between 1 and max number of items may spawn.

Returns:

    table list of spawned InventoryItem objects
ammoBox (container, ammoType, chance, max)
Attempts to spawn ammo boxes in the container.

Wrapper function for Spawn.item, modifying the chance argument by Sandbox Weapon Loot and ORGM Ammo Spawn Settings.

The ammoType argument must not contain the moduleName prefix, or _Box suffex.

Parameters:

  • container ItemContainer
  • ammoType nil or string name of the ammo, randomly chosen if nil.
  • chance float base % chance to spawn the item.
  • max int between 1 and max number of items may spawn.

Returns:

    table list of spawned InventoryItem objects
ammoCan (container, ammoType, chance, max)
Attempts to spawn ammo canisters in the container.

Wrapper function for Spawn.item, modifying the chance argument by Sandbox Weapon Loot and ORGM Ammo Spawn Settings.

The ammoType argument must not contain the moduleName prefix, or _Can suffex.

Parameters:

  • container ItemContainer
  • ammoType nil or string name of the ammo, randomly chosen if nil.
  • chance float base % chance to spawn the item.
  • max int between 1 and max number of items may spawn.

Returns:

    table list of spawned InventoryItem objects
maintance (container, chance, max)
Attempts to spawns a random maintance item.

Wrapper function for Spawn.item, modifying the chance argument by Sandbox Weapon Loot and ORGM Repair Kit Spawn Settings.

Parameters:

  • container ItemContainer
  • chance float base % chance to spawn the item.
  • max int between 1 and max number of items may spawn.

Returns:

    table list of spawned InventoryItem objects
component (container, chance, max)
Attempts to spawns a firearm component.

Wrapper function for Spawn.item, modifying the chance argument by Sandbox Weapon Loot and ORGM Component Spawn Settings.

Parameters:

  • container ItemContainer
  • chance float base % chance to spawn the item.
  • max int between 1 and max number of items may spawn.

Returns:

    table list of spawned InventoryItem objects
select (civilian, police, military)
Chooses a gun from the rarity tables and appropriate ammo type.

Parameters:

  • civilian int chance of using the civilian table (weight value)
  • police int chance of using the police table (weight value)
  • military int chance of using the military table (weight value)

Returns:

    table table with 2 keys: .gun and .ammo

See also:

addToCorpse (container)
Generic spawn function for corpses.

Attempts to spawn items on the corpse.

Parameters:

  • container ItemContainer
addToCivRoom (container)
Generic spawn function for Civilian rooms.

Attempts to spawn items in the room.

Parameters:

  • container ItemContainer
fillContainer (roomName, containerType, container)
Triggered by the OnFillContainer Event.

The bulk of the other functions in the spawning system are directly or indirectly called from this.

Parameters:

  • roomName
  • containerType
  • container pull functions into local namespace
generated by LDoc 1.4.3 Last updated 2019-04-11 18:37:45