User Tools

Site Tools


script:module:app

App (Module)

Module that wraps the native App class. Derived classes like ClientApp may also augment the module with their variables and functions.

Functions

consolePlayer ( )

Returns an object representing the console player (App.Player).

gamePlugin ( )

Returns the identifier of the currently loaded game plugin. The return value is text, for instance for the Doom game plugin:

"doom"

getInteger ( id : Number )

Query the value of an internal engine variable. The id is one of the constants in the App module, such as App.NETGAME.

quit ( )

setInteger ( id : Number, value : Number )

Sets the value of an internal engine variable. The id is one of the constants in the App module, such as App.NETGAME. Note that some values cannot be changed, or are reset internally by the engine.

Variables

audienceForGameChange

An array of functions that will be called whenever the game changes. Note that this is also called when the game is unloaded. The ID of the loaded game mode is provided as an argument to the functions.

def gameHasChanged(newGame)
    print "Game is now:", newGame
end
App.audienceForGameChange += [gameHasChanged]

App.Player

Base class for players in the game.

armor ( )

(Availability: Not available in Hexen.)

Returns the current armor points of the player.

armorType ( )

(Availability: Not available in Hexen.)

Returns the current armor type (0, 1, or 2) of the player.

giveAmmo ( type : Number, amount : Number )

Gives the player ammo of a given type. The type is one of the internal ammo type IDs defined in doomdef.h or h2def.h.

giveArmor ( type : Number, points : Number )

Increases the player's armor points and changes the armor type.

giveBackpack ( )

(Availability: Not available in Hexen.)

Increases the player's max ammo capacity.

givePower ( type : Number )

Gives the player a power-up.

The values for type depend on the game (see enum powertype_t). For Heretic, the following values are defined:

  • App.Player.PT_ALLMAP
  • App.Player.PT_FLIGHT
  • App.Player.PT_HEALTH2
  • App.Player.PT_INFRARED
  • App.Player.PT_INVISIBILITY
  • App.Player.PT_INVULNERABILITY
  • App.Player.PT_SHIELD
  • App.Player.PT_WEAPONLEVEL2

health ( )

Returns the current health points of the player.

id ( )

Returns the ID/console number of the player. In a single-player game, this is always zero.

power ( type : Number )

Returns one of the power-up counters of the player. The returned value is the number of 35 Hz tics that the power-up is in effect. It counts downward over time. If the returned value is positive, the corresponding power-up is currently active.

The values for type depend on the game (see enum powertype_t).

setFlameCount ( tics : Number )

(Availability: Heretic.)

Sets the maximum duration of the powered up Phoenix Rod flame thrower. The default is 350 tics (10 seconds). After this duration, ammo will be depleted and the player must start a new attack.

This behavior is defined by the State definitions in Heretic's objects.ded.

setLocalQuake ( intensity : Number, duration : Number = 0 )

(Availability: Heretic, Hexen.)

Starts or stops the local earthquake effect where a player's camera is being randomly shaken.

Both the intensity and duration are integers. The value of intensity determines the strength of the shaking; for example: 1 is the minimum, 10 is very strong. Duration determines how long the shaking will go on (in tics; 35 is one second). The duration is zero by default, which means the earthquake will continue indefinitely.

To stop the earthquake, set intensity to zero.

setHealth ( hp : Number )

Changes player health to hp without checking restrictions. The value can be set to any number, even higher than the defined player maximum health. Setting hp to zero or a negative value kills the player, even if they have invulnerability.

shotAmmo ( )

Deplete one round of ammo according to the “per shot” ammo of the player's current weapon.

thing ( )

Returns the player mobj as a World.Thing object.

script/module/app.txt · Last modified: 2020-11-26 06:24 by skyjake