Modding:player API (0.9.9.7)
From DoomRL Wiki
This page is currently under construction.
You can also use the being API and thing API with the player, since it is also a being.
Player Interface | |
---|---|
void | set_affect(AffectID id, integer duration) |
integer | player:get_affect_time(AffectID id) |
void | player:remove_affect(AffectID id) |
boolean | player:is_affect(AffectID id) |
void | player:add_exp(integer xp) |
boolean | player:has_won() |
integer | player:get_trait() |
string | player:get_trait_hist() |
void | player:power_backpack() |
void | player:win() |
void | player:continue_game() |
void | player:choose_trait() |
void | player:level_up() |
void | player:exit(string [next]) |
void | player:exit(integer [next]) |
void | player:quick_weapon(ItemID id) |
void | player:set_inv_size(integer size) |
void | player:mortem_print(string line) |
void | player:remove_medals(table medallist) |
void | player:remove_award(AwardID award) |
void | player:set_award(AwardID award, integer level) |
boolean | player:has_award(AwardID award, integer level) |
integer | player:get_award(AwardID award) |
void | player:remove_medal(MedalID medal) |
void | player:add_medal(MedalID medal) |
boolean | player:has_medal(MedalID medal) |
void | player:remove_badge(BadgeID badge) |
void | player:add_badge(BadgeID badge) |
boolean | player:has_badge(BadgeID badge) |
void | player:remove_assembly(ModArrayID assembly) |
void | player:add_assembly(ModArrayID assembly) |
boolean | player:has_assembly(ModArrayID assembly) |
void | player:remove_found_item(ItemID item) |
void | player:add_found_item(ItemID item) |
boolean | player:has_found_item(ItemID item) |
void | player:add_history(string line) |
- set_affect(AffectID id, integer duration)
Adds the indicated affect to the player.
- id: The ID of the affect to add.
- duration: The number of actions to add the affect for. If the affect is already active, the duration is extended by this amount.
- player:get_affect_time(AffectID id) → integer
Gets the remaining duration of the indicated affect.
- id: The ID of the affect to get the duration for.
- Returns: The remaining duration of the affect.
- player:remove_affect(AffectID id)
Removes the indicated affect from the player.
- id: The ID of the affect to remove.
- player:is_affect(AffectID id) → boolean
Checks to see if the given affect is active on the player.
- id: The ID of the affect to check for.
- Returns: True if the affect is currently active on the player, False if not.
- player:add_exp(integer xp)
Gives the player extra experience points.
- xp: The amount of experience to add.
- player:has_won() → boolean
Indicates whether the player has won or not.
- Returns: True if the player has won the game, False if not.
- player:get_trait() → integer
integer player:get_trait ( integer trait ) Gets the current level of a given trait.
- trait: The trait to get the level for.
- Returns: The level of the trait.
- player:get_trait_hist() → string
Gets the history string for the player's traits ("Iro->Iro->HR").
- Returns: The history string.
- player:power_backpack()
Gives the player the BF_BACKPACK flag and re-packs the ammo items in the inventory.
- player:win()
Makes the player win the game and ends the game at the end of the turn.
- player:continue_game()
Stops the game from ending at the end of the turn.
- player:choose_trait()
Opens the trait menu and allows the player to pick a new trait.
- player:level_up()
Increments the player's level count, calls the level up hooks, opens the trait menu, and prints the appropriate messages.
- player:exit(string [next])
- player:exit(integer [next])
Leaves the current level and goes to the specified level.
- next: Optional. The string ID of the special level to go to, or the number of the level in the episode to exit to. If omitted, the default is to go to the next numbered level in the episode.
- player:quick_weapon(ItemID id)
Quick-swaps the equipped weapon with indicated weapon ID, if it is in the player's inventory.
- id: The id of the weapon to swap to.
- player:set_inv_size(integer size)
Sets the number of usable slots in the player's inventory.
- size: A number from 1 to MAX_INV_SIZE to set the number of available slots to.
- player:mortem_print(string line)
Writes a line of the mortem. Can only be used while printing the mortem.
- line: The text to write.
- player:remove_medals(table medallist)
Removes specified medals from the player's earned medals list.
- medallist: The list of medals to remove.
- player:remove_award(AwardID award)
Removes a custom award from the player's data.
- award: The award to remove.
- player:set_award(AwardID award, integer level)
Grants the indicated award to the player.
- award: The award to give.
- level: The quality level of the award to give.
- player:has_award(AwardID award, integer level) → boolean
Indicates if the player has earned the specified award.
- award: The award to check for.
- level: The minimum quality level of the award to check for.
- Returns: True if the player has at least the given level of the given award, False otherwise.
- player:get_award(AwardID award) → integer
Gets the quality level of a specified award.
- award: The award to look for.
- Returns: The current level of the award earned. 0 is returned if the award has not been earned at all.
- player:remove_medal(MedalID medal)
Removes a medal from the player's earned medals.
- medal: The medal to remove.
- player:add_medal(MedalID medal)
Grants a medal to the player.
- medal: The medal to give.
- player:has_medal(MedalID medal) → boolean
Checks if the player has a specified medal.
- medal: The medal to check for.
- Returns: True if the player has earned the medal, False if they have not.
- player:remove_badge(BadgeID badge)
Removes a badge from the player's earned badges.
- badge: The badge to remove.
- player:add_badge(BadgeID badge)
Grants a badge to the player.
- badge: The badge to add.
- player:has_badge(BadgeID badge) → boolean
Checks to see if the player has the specified badge.
- badge: The badge to check for.
- Returns: True if the player has earned the indicated badge, False if not.
- player:remove_assembly(ModArrayID assembly)
Removes an assembly from the list of created assemblies.
- assembly: The assembly to remove.
- player:add_assembly(ModArrayID assembly)
Adds an assembly to the list of created assemblies.
- assembly: The assembly to add.
- player:has_assembly(ModArrayID assembly) → boolean
Checks to see if the player has the specified assembly in the list of created assemblies.
- assembly: The assembly to check for.
- Returns: True if the assembly is in the list, False if it is not.
- player:remove_found_item(ItemID item)
Removes the indicated item from the list of found items.
- item: The item to remove.
- player:add_found_item(ItemID item)
Adds the indicated item to the list of found items.
- item: The item to add.
- player:has_found_item(ItemID item) → boolean
Checks to see if the player has the indicated item.
- item: The item to check for.
- Returns: True if the player has found the item, False if they have not.
- player:add_history(string line)
Adds a line to the history section of the mortem. Can be called anywhere prior to the end of printing the mortem.
- line: The line of text to add. Use "@1" in the string to insert the current depth.