User:MIDIMan/Ringslinger Revolution/Functions
This is a comprehensive list of all functions that can be utilized in Ringslinger Revolution, excluding those that are part of the PSprites system.
Please note that all functions must be called under the RSR namespace. For example, to run the GamemodeActive() function, it must be written as RSR.GamemodeActive() for it to actually run.
Base
| Function | Return value(s) | Description |
|---|---|---|
GamemodeActive()
|
boolean | Returns true if the current gametype uses RSR logic, or if the current map’s level header has the Lua.RingslingerRev parameter; otherwise returns false.
|
AddGametype(INT16 gameType)
|
nil | Creates an entry in the RSR.RSR_GAMETYPES table for the given gametype. This makes the specified gametype use RSR’s gameplay and HUD logic.
|
AddEnum(string prefix, string name, [boolean startAtZero])
|
nil | Creates an enum in the RSR namespace with the given prefix and name and sets it to a number. For example, Passing in WEAPON as the prefix, and MEGA as the name will create a variable with the name WEAPON_MEGA in the RSR namespace. This will also create a variable with the prefix WEAPON and the suffix MAX. This is automatically incremented by 1 every time the function is called with the same prefix. If startAtZero is set to true, the first enum will be set to 0 instead of 1.
|
Explode(mobj_t mo, [fixed_t bombDist, [fixed_t thrustDist, [INT32 bombDamage, [fixed_t fullDist, [INT32 thrustDamage, [boolean aimThrust]]]]]])
|
nil | Deals splash damage from the center of an Object with a given radius.
|
GetArmageddonDamage(angle_t angle, angle_t destAngle, angle_t maxTurn)
|
angle_t | Returns the damage dealt from a detonated Armageddon Shield, based on the distance between the two Objects given. The target is the Object being damaged, and the inflictor is the Object dealing the damage.
|
AngleTowardsAngle(angle_t angle, angle_t destAngle, angle_t maxTurn)
|
angle_t | Returns a new angle in between angle and destAngle using maxTurn. maxTurn determines the maximum turning angle between angle and destAngle.
|
MoveMissile(mobj_t missile, angle_t angle, angle_t slope, [fixed_t speed])
|
nil | Moves a missile in the direction of the given angle and slope (pitch). speed determines the missile's speed, automatically accounting for scale. Default is the missile's Speed Object type property.
|
ColorTeamMissile(mobj_t missile, player_t player)
|
nil | In team gametypes, this changes missile’s translation to match the player’s team color (“RSRTeamRed” if the player is in the red team, or “RSRTeamBlue” if the player is in the blue team). In any other gametype, this will do nothing.
|
SpawnPlayerMissile(mobj_t source, int missileType, [angle_t angle, [angle_t slope, [mobj_t reflected, [fixed_t speed, [int sound, boolean noPlayerSound]]]]]])
|
mobj_t
|
Similar to P_SPMAngle, except this function makes the spawned missile’s speed scale with the source’s momentum.
|
SpawnReflectedMissile(mobj_t source, mobj_t missile)
|
nil | Spawns a reflected missile using if the missile's rsrForceReflected variable is false.
|
CheckFriendlyFire([player_t player, [player_t player2]])
|
boolean | Returns true if the friendlyfire console variable is on or the current gametype has the GTR_FRIENDLYFIRE rule. Returns false if two players are given and either of them are a 2-player bot (BOT_2PAI or BOT_2PHUMAN).
|
PlayersAreTeammates(player_t player, player_t player2)
|
boolean | Returns true if player and player2 are teammates. There are three factors that determine this:
|
PlayerHasPurpleDebuff(player_t player)
|
boolean | Returns true it the player has the "Purple Debuff". There are two factors to determine this:
|
PlayerHasEmerald(player_t player, int emerald)
|
boolean | Returns true if the player has the given emerald in their inventory (uses EMERALDn constants, where n is the number of the emerald).
|
PlayersCanTurnSuper()
|
boolean | Returns true if the current map and/or gametype allows players to turn super. |
PlayersCanUseAltfires()
|
boolean | Returns true if the current map and/or gametype allows players to use their weapons' alternate firemodes. |
PlayerHasAllEmeralds()
|
booleans | Returns true if the player has all the Emeralds.
|
WavesGamemodeActive()
|
boolean | Returns true if the current map uses the “Waves” gamemode. |
Enemy
| Function | Return value(s) | Description |
|---|---|---|
EnemySetBlink(mobj_t mo, tic_t timer)
|
nil | Sets the enemy’s rsrEnemyBlink variable and adds it to the enemy thinker list, ENEMY_THINKERS.
|
GetEnemyHealthScale(int moType)
|
int | Gets the health scale of an enemy given its Object type. The enemy's health is calculated as the value returned by this function multiplied by the Object type's SpawnHealth property
|
AlertNearbyEnemies(mobj_t target, mobj_t source)
|
nil | Makes the target and any enemies within a radius of 1024*FRACUNIT face the source.
|
EnemyDecrementHealth(mobj_t target, [mobj_t source], int damage, int healthScale)
|
int, boolean | Reduces the target's rsrHealth value by the damage given. source is the source of the damage dealt to the target. healthScale determines how much health to reduce from the target's health variable (separate from rsrHealth). Returns two values:
|
EnemySetHealth(mobj_t target, mobj_t inflictor, mobj_t source, int damage, int damagetype)
|
nil | Wrapper for the previous four functions that sets the enemy's health based on the damage taken, the damage type, and who or what hurt the enemy. |
AddEnemyHooks(int enemyType)
|
nil | Adds the given Object type to the list of enemies and adds specialized ShouldDamage and TouchSpecial hooks to it.
This function is intended for adding custom enemy types, and as such should be called in an AddonLoaded hook. |
HUD
| Function | Return value(s) | Description |
|---|---|---|
HUDBossHealth(drawer v, player_t player)
|
nil | Draws the boss's health bar to the player's HUD. |
HUDEffects(drawer v, player_t player)
|
nil | Draws screen effects based on the player's powerups to their HUD. |
HUDEmeralds(drawer v, player_t player)
|
nil | Draws the player’s currently-held emeralds to their HUD. |
HUDCTFFlagRadarTarget(drawer v, player_t player, camera_t thiscam, mobj_t target, [boolean useBlueFlag])
|
boolean | Draws a CTF flag icon on top of the given target. thiscam is the local player's camera. If useBlueFlag is true, the icon used will be the blue flag icon.
|
HUDCTFFlagRadar(drawer v, player_t player, camera_t thiscam)
|
nil | Draws the CTF flag radar (using HUDCTFFlagRadarTarget) to the player’s HUD.
|
HUDHypeMeter(drawer v, player_t player)
|
nil | Draws the player’s hype bar to their HUD. |
KillfeedGetMobjInfo(player_t victim, int moType, player_t attacker)
|
string, string | Returns the killfeed icon based on moType and attacker. Also returns an obituary from the moType's RSR.MOBJ_INFO entry based on how the victim was killed:
|
KillfeedPrint(string victimName, [string attackerName, [string inflictorPatch, [boolean infReflected, [boolean highlight, [int skincolor, [string obituary, [fixed_t distance, [table assistors]]]]]]]]
|
nil | Adds an entry to the killfeed and prints a death message to the console.
|
KillfeedGetDmgInfo(player_t victim, [mobj_t inflictor, [player_t attacker]], int damagetype)
|
string, string | Returns the killfeed icon based on damageType. Also returns an obituary from RSR.KILLFEED_DMG_INFO based on how the victim was killed:
|
KillfeedAdd(player_t victim, mobj_t inflictor, player_t attacker, int damagetype)
|
nil | Adds an entry to the killfeed. victim is the player who was killed, inflictor is the Object that killed the player, attacker is the source of the inflictor, and damagetype is the type of damage inflicted on the victim.
|
HUDKillfeed(drawer v)
|
nil | Draws the killfeed to the player’s HUD. |
HUDPowerups(drawer v, player_t player)
|
nil | Draws the player’s active powerups to their HUD. |
HUDPSprites(drawer v, player_t player, camera_t thiscam)
|
nil | Draws the player’s PSprites to their HUD. |
HUDScreenFade(drawer v, player_t player)
|
nil | Draws the player’s screen fader to their HUD. |
HUDTime(drawer v, player_t player)
|
nil | Draws the in-game time to the player’s HUD. |
HUDWeaponBar(drawer v, player_t player)
|
nil | Draws the player’s weapon bar to their HUD. |
HUDWavesEnemyRadar(drawer v, player_t player)
|
nil | Draws the player’s enemy radar to their HUD when in a “Waves” map. |
HUDWaves(drawer v)
|
nil | Draws the wave start/completion/death messages to the HUD when in a “Waves” map. |
HUDHealth(drawer v, player_t player)
|
nil | Draws the player's health to their HUD. |
Items
| Function | Return value(s) | Description |
|---|---|---|
SpawnTeleportFog(mobj_t mo, fixed_t zOffset, int sound)
|
nil | Spawns a teleport fog EFX from mo. zOffset determines the vertical offset of the spawned teleport fog relative to mo (Default is 0), and is automatically adjusted to account for the Object’s scale and reverse gravity. sound determines what sound to play when the teleport fog is spawned (Default is sfx_rsrsp3).
|
BonusFade(player_t player)
|
nil | Makes the player's screen fade gold for 1/3rd of a second. |
SetItemFuse(mobj_t mo)
|
nil | Sets the item’s fuse according to the respawnitemtime console variable if it is set to respawn.
|
ItemFlingSpark(mobj_t mo, fixed_t zOffset, fixed_t sparkScale, tic_t sparkTics)
|
nil | Flings a super spark EFX from mo. zOffset determines the vertical offset of the spawned teleport fog relative to mo (Default is 0), and is automatically adjusted to account for the Object’s scale and reverse gravity. sparkScale determines the spark’s scale, and sparkTics determines how long the spark lasts before disappearing in tics.
|
GiveHealth(player_t player, int health, [boolean isBonus, [boolean lowMod]])
|
boolean | Gives health to the player, up to a limit of 100. If isBonus is true, the limit becomes 200 temporarily. If lowMod is true, the player gains an additional 8 health points if their health and armor combined are below RSR.CRIT_EHP. Returns false if isBonus is false and the player’s health is 100 or more.
|
GiveArmor(player_t player, int armor, [boolean isBonus, [boolean lowMod]])
|
boolean | Gives armor to the player, up to a limit of 100. If isBonus is true, the limit becomes 200 temporarily. If lowMod is true, the player gains an additional 8 armor points if their health and armor combined are below RSR.CRIT_EHP. Returns false if isBonus is false and the player’s armor is 100 or more.
|
GiveHype(player_t player, int hype)
|
boolean | Gives hype to the player, up to a limit of 3000. Returns false if the player’s hype is 3000 or more. |
GivePowerup(player_t player, int powerup, [int addTics, [int addPenalty]])
|
nil | Gives a powerup to the player. powerup is the powerup to give the player (uses POWERUP_* constants), addTics is the amount of tics to add to the powerup's timer if the player already has it, and addPenalty is the amount of tics to add to the powerup's time penalty if the player already has it.
|
AddPowerup(string name, table info)
|
nil | Adds a new powerup to RSR.
Format of Note: The name given to this function determines the name of the enum added. For example, passing in “damage” as a |
GetWeakOrStrongMonitor(mobj_t mo)
|
int | Returns a random weak or strong monitor Object type from RSR.MONITOR_RANDOMS based on the monitor Object given.
|
AddMonitorHooks(int monitorType)
|
nil | Adds the given Object type to the list of monitors and adds specialized MapThingSpawn, MobjThinker, MobjDeath, MobjFuse, and MobjRemoved hooks to it.
This function is intended for adding custom monitor types, and as such should be called in an AddonLoaded hook. |
EmeraldFlingSpark(mobj_t mo)
|
nil | Wrapper for RSR.ItemFlingSpark that flings a super spark EFX from mo (a collectible emerald).
|
Player
| Function | Return value(s) | Description |
|---|---|---|
PlayerSetChasecam(player_t player, boolean toggle)
|
nil | Sets the local player’s camera’s chase variable to toggle.
|
SpawnDamageSplatter(mobj_t target, int damage)
|
nil | Spawns a bunch of splatter particles from the target. Higher damage values spawn bigger and more particles. |
PlayerAddAttacker(player_t player, player_t attacker, int damage)
|
nil | Adds an entry to the player’s attackerInfo list. If the attacker is already in the list, the damage value is added on to the existing one. This also sets the player's attackerTimer to RSR.ATTACKER_TIMER_MAX.
|
PlayerReduceAttackerInfoDamage(player_t player, int healed)
|
nil | Reduces the damage each attacker dealt in the player's attackerInfo table, using the amount given by healed. The amount of damage healed depends on how many attackers there are: The more attackers there are, the less overall damage is healed.
|
GetInflictorDamage(mobj_t target, mobj_t inflictor, mobj_t source, int damage, int damagetype)
|
table | Returns a table of damage information based on the target and inflictor. source is the Object the inflictor came from, damage is the damage value before being recalculated, and damagetype is the type of damage taken (uses DMG_* constants). The damage information table contains the following variables:
|
PlayerDamageKnockback(mobj_t target, mobj_t inflictor, mobj_t source, int damage, int damagetype, fixed_t knockbackScale)
|
nil | Applies knockback to a target using the given parameters:
|
SetPlayerDeathFling(mobj_t target, mobj_t inflictor, mobj_t source, int damage, int damagetype)
|
nil | Flings the target in the direction they were going before they died. If the damagetype contains DMG_DEATHMASK, and the player wasn't killed by a command, the player get thrown upwards like normal SRB2.
|
PlayerHomingDamage(player_t player, int damage)
|
nil | Handles the player's damage while performing a homing attack via the Homing Thok or an Attraction Shield. |
PlayerArmorDamage(player_t player, mobj_t inflictor, int damage)
|
int, boolean, int, int | Handles the player's damage when the player has armor. inflictor is the Object that hurt the player, and damage is the amount of damage dealt to the player. Returns the following values:
|
PlayerShieldDamage(player_t player, [mobj_t inflictor], rsrmobjinfo_t infInfo, fixed_t knockbackScale, soundnum_t hurtSound, soundnum_t serverHurtSound)
|
fixed_t, int, int | Handles the player's damage when the player has a shield. inflictor is the Object that hurt the player, infInfo is the RSR.MOBJ_INFO entry for the inflictor's Object type, knockbackScale is the scale applied to the player's knockback value, hurtSound is the hurt sound to play for the local player, and serverHurtSound is the sound to play for the rest of the players on the server. Returns the following values:
|
PlayerDamageRewards(player_t player, mobj_t source, int damage, int damagetype)
|
nil | Gives rewards to the source for player damage if the source is another player. damage is the damage dealt to the player, and damagetype is the type of damage dealt (uses DMG_* constants).
|
PlayerDropItems(player_t player)
|
nil | Makes the player drop their weapons and emeralds.
|
PlayerReplenishPowerups(player_t player)
|
nil | Gives the player a time boost for their powerups and hype meter.
|
HasPowerup(player_t player, int powerup)
|
boolean, int | Returns true if the player has the given powerup (uses POWERUP_* constants); Otherwise returns false. Also returns the index in the player’s powerups array that the powerup was found (as a separate returned value).
|
SuperFlingSpark(mobj_t mo)
|
nil | Wrapper for ItemFlingSpark that flings a super spark EFX from mo (a super player). |
PlayerLookForEnemies(player_t player, [fixed_t maxDist, [boolean searchEnemies, [boolean searchSpectators, [boolean canHomeUpwards, [boolean homingThok]]]]])
|
mobj_t
|
Version of P_LookForEnemies that can look for other players.
|
PlayerHomingAttack(player_t player, player_t player2)
|
boolean | player faces player2 and moves towards it; needs to be repeatedly used to work properly. player’s movement speed will be 2/3 of their actionspd value when using the Homing Thok, or 45 fracunits when using an Attraction Shield.
|
SetScreenFade(player_t player, int color, int strength, tic_t tics)
|
nil | Makes the player’s screen fade using the given parameters:
|
SetEHPFlash(player_t player, int color, tic_t tics, tic_t frequency)
|
nil | Makes the player's health and armor text flash using the given parameters:
|
PSprites
For more information, see the PSprites page.
| Function | Return value(s) | Description |
|---|---|---|
CheckAmmo(player_t player, int ammoType, [int ammoAmount])
|
nil | Returns true if the player has enough ammo for the given ammoType (uses AMMO_* constants). ammoAmount determines the amount of ammo to check for; Default is 1.
|
DrawWeapon(player_t player, [int weapon, [boolean force]])
|
nil | Makes the player draw the given weapon if they can use weapons (uses WEAPON_* constants). If force is true, the player is forced to draw the weapon whether they can use it or not.
|
FireWeapon(player_t player)
|
nil | Makes the player fire their currently-held weapon. |
FireWeaponAlt(player_t player)
|
boolean | Makes the player use the altfire of their weapon. If they don’t have enough ammo for it, this plays a sound effect instead. Returns true if the altfire succeeded. |
CheckPendingWeapon(player_t player)
|
boolean | Used by A_WeaponReady to check if the player’s pendingWeapon is not -1. If so, then make the player draw the weapon.
|
SetPSpriteViewmodelFrame(string sprite, string frame, int viewmodelOrient, string newFrame)
|
nil | Adds an entry for the given newFrame to RSR.VIEWMODEL_FRAMES using the following parameters:
|
GetPSpriteViewmodelFrame(string sprite, string frame, int viewmodelOrient)
|
string | Returns a replacement frame from RSR.VIEWMODEL_FRAMES using the given parameters:
|
Weapon
| Function | Return value(s) | Description |
|---|---|---|
AddAmmo(string name, table info)
|
nil | Adds a new ammo type to RSR.
Format of Note: The name given to this function determines the name of the enum added. For example, passing in “sniper” as a |
AddWeapon(string name, table info)
|
nil | Adds a new weapon to RSR.
Note: The name given to this function determines the name of the enum added. For example, passing in “sniper” as a |
GetAmmoInfoFromWeapon(int weapon)
|
table or nil | Returns a table from AMMO_INFO for the given weapon (uses WEAPON_* constants). If there is no info for the weapon or the weapon doesn’t have an entry in WEAPON_INFO, this returns nil instead.
|
GetAmmoAmountFromWeapon(int weapon, [mobj_t pickup])
|
int | Returns the amount of ammo for the given weapon (uses WEAPON_* constants). If pickup is set to an weapon pickup Object, the ammo amount will change based on the pickup's rsrIsPanel and/or rsrAmmoAmount variables.
|
GiveAmmo(player_t player, int amount, int ammoType)
|
nil | Gives a specified amount of ammo to the player. ammoType determines what type of ammo is given to the player (uses AMMO_* constants).
|
TakeAmmo(player_t player, int amount, int ammoType, boolean ignoreInfinity)
|
nil | Takes a specified amount of ammo away from the player. ammoType determines what type of ammo is taken from the player (uses AMMO_* constants). If ignoreInfinity is true, ammo is forcefully taken away from the player even if they have the “infinity” powerup.
|
PlayLowAmmoSound(player_t player, [int weaponType, [boolean useAlt]])
|
nil | Plays the low ammo sound for the given weaponType. If set to nil, the weaponType will automatically be set to the player's readyWeapon. If useAlt is set to true, the weapon's altfire low ammo sound will be played instead.
|
TakeAmmoFromReadyWeapon(player_t player, int amount, boolean ignoreInfinity)
|
nil | Calls RSR.TakeAmmo using the player’s currently held weapon’s ammo type.
|
CanUseWeapons(player_t player)
|
boolean | Returns true if the player can use their weapons. The player can not use their weapons under the following conditions:
|
GiveWeapon(player_t player, int weapon, [int newAmount])
|
nil | Gives a specified weapon to the player (uses WEAPON_* constants). newAmount determines how much ammo for the weapon is given to the player; Default is the amount defined in AMMO_INFO for the weapon’s ammo type.
|
GetWeaponDelay(int weapon, boolean speed, boolean useAlt)
|
int | Returns the delay in tics for using a weapon after firing it.
|
SetWeaponDelay(player_t player, int weapon, [boolean speed, [boolean useAlt]])
|
nil | Sets the player’s weaponDelay and weaponDelayOrig variables using RSR.GetWeaponDelay.
|
ProjectileSpawn(mobj_t mo)
|
nil | MobjSpawn hook code for projectiles. Automatically sets the variables shadowscale, rsrProjectile, rsrGhostTimer, rsrSoundTimer, and rsrAlertTimer. See Userdata structures for more information.
|
ProjectileMoveCollide(mobj_t tmthing, mobj_t thing)
|
boolean or nil | MobjMoveCollide hook code for projectiles. This differs slightly from the vanilla projectile behavior by having projectiles go through teammates/friendly players. Otherwise, it acts about the same.
Note: Some projectiles override this function with the "ProjectileMoveCollide" hook (Charged Shot, Mass Scrambler, Bounce, Stickybomb, Rail) since they behave differently. |
ProjectileGhostTimer(mobj_t mo, boolean doSmoke)
|
nil | Runs the ghost spawn thinker for projectiles. Every time rsrTravelSound reaches 0, a ghost Object is spawned from the projectile and the timer is reset to 4. If doSmoke is true, a smoke Object is spawned from the projectile instead of a ghost Object.
|
ProjectileTravelSound(mobj_t mo, [int repeatTime, [int sound]])
|
nil | Runs the travel sound thinker for projectiles. Every time rsrSoundTimer reaches 0, the sound is played and the timer is reset to repeatTime.
|
ProjectileAlertSound(mobj_t mo, player_t player, [int repeatTime, [int sound]])
|
nil | Runs the alert sound thinker for projectiles on the player's end. Every time rsrAlertTimer reaches 0, the sound is played and the timer is reset to repeatTime.
|
WeaponTouchSpecial(mobj_t special, mobj_t toucher, int weaponType)
|
boolean or nil | TouchSpecial hook code for weapon pickups.
|