The biggest change was mostly internal. I re-did a lot of HUD stuff to make it easier to create custom HUD screens that look and function like the other ones. By creating an object that extends /HudBox, you get access to some procs that are useful for creating panels and list boxes. There's an example in demo\custom-hud.dm. In about 30 lines of code it creates a window containing a list of your abilities. You can use the arrow keys to move a cursor around and the space bar to make a selection.
Note: This version requires the latest version of the HUD Groups library, which was also posted this morning. I also updated the Pixel Movement library but I don't think anything here relies on that update.
Here is the full list of changes:
- Added the info bar which is shown at the top of the screen. Added the Constants.KEY_INFO_BAR var, which is "h" by default, that sets focus to the info bar. While it has focus you can use the Delete key to remove messages and the arrow keys to cycle through them. The Esc and H keys set focus back to the player.
- You can use the mob.info_bar.add_message() proc to show a text string in the info bar. You can use the info_bar's remove_message() proc to remove a message. There are examples of this in demo\help.dm.
- Added health and mana regeneration. The mob.health_regen() and mob.mana_regen() procs are called periodically when the mob is below their maximum value. By default these procs do nothing but you can override them to call gain_health() and gain() mana. The sample game has an example of this. Note: the regen procs are only called if you're below your max health/mana value.
- Added the Constants.REGEN_TICK_LENGTH variable which is the number of frames between calls to health_regen() and mana_regen(). It's default value is 40 so these procs are called once per second.
- Increased the mana cost of Fireball in the sample game so you can notice mana regeneration more easily.
- Increased the default layer of objects created with the atom.effect() proc to be the atom's layer + 10 because there were still some layering issues with these objects and equipment overlays.
- Added the "attached" named parameter to the atom.effect() proc. If you call mob.effect("something", attached = 1), the object will follow the player as they move.
- Changed the Quest.complete() proc to be called "is_complete" instead.
- Added the Quest.acquired(), removed(), and completed() procs. acquired() is called when you receive a quest, removed() is called when you abandon or complete a quest, and completed() is called when you complete a quest. By default these don't do anything but they let you add custom behavior to getting or losing quests.
- Added demo\help.dm which shows some ways to use the info bar to create context-sensitive help messages to a game.
- Added the mob.number_prompt() proc which is similar to text_prompt() except you can only type digits.
- Changed the way text and number prompts are handled internally, but this doesn't change how they're used.
- Added the show_caption var to the HealthMeter and ManaMeter objects. When this is set to 1 it'll cause the stat's value and maximum to be displayed to the right of the meter. It is zero by default but the sample game includes code in demo\mobs.dm to set it to 1 for both meters.
- Added the ability to drop items on the map. When you call mob.drop_item(item), the item will be placed on the map. It'll be displayed using its map_icon and map_state vars.
- Previously, mob.drop_item(item) would set the item's loc to null and cause the item to be deleted. If you want to simply remove the item from their inventory and delete it, you can call mob.remove_item(item). This will set the item's loc to null.
- Added the item.pickup var whose value can be item.WALK_OVER or item.INTERACT. This determines how the item is picked up - by walking over the item or by interacting (pressing the space bar). The default value is INTERACT.
- Pressing D in the inventory screen makes you drop an item. Pressing the Delete key removes the item and deletes it entirely.
- Made the ability menu able to show multiple columns in case the player has many abilities to choose from. The height of each column is determined by the AbilityMenu/size var which is 8 by default, but is set to 4 in the sample game so you'll see multiple columns there.
- Added the AbilityMenu/show_ability() proc which takes an Ability object as a parameter and returns 0 or 1 to determine if the ability should be listed. This way you can limit what abilities are shown when the player is customizing their key bindings (ex: you can hide their crafting abilities from that menu and provide a separate interface to access them).
- Added an outline to the item description text in the inventory screen to make it more readable when the caption is over top of a bright item.
- Changed some things about on-screen interfaces. The HudBox object which many interface elements extend now contains the box() proc which is used to create the background of each window instead of creating the box using parameters passed to the New() proc.
- Added the party.size_limit var which limits the number of players that can be in a party. The default is zero, which means there is no limit.
- Added the party.invite_player(mob) proc which is used to invite players. This proc enforces the size limit. You can still call the mob's invite_player() proc since it calls the party.invite_player proc.
- Added the HudGroup.focus() and close() procs. By default these do nothing but they're commonly defined procs that might come in handy for defining the behavior that should happen when interfaces are opened and closed.
- Added the HudBox.panel() proc which creates an on-screen panel. These panels look like the backgrounds of the mob selection menu, inventory screen, prompt boxes, and other interface elements.
- Added the HudBox.box() proc which has the same effect as the panel() proc but panel() creates the box as a child HudObject and box() creates it by adding objects to the current HudGroup.
- Added the HudBox.list_box() proc which create an on-screen list box that can be used to display a list of objects. The list_box returns a type of HudGroup object. To use the list box you have to pass keystrokes to it. See demo\custom-hud.dm for an example.
- Updated the current HUD interface elements to make use of the new vars and procs.