* You can use the Constants object to configure the number of characters a player can have and to determine if the game uses client-side savefiles or server-side (the default is server-side).
There are some things that don't get saved that probably should. Cooldowns, for example. The problem with cooldowns is that they're based off world.time. If you start up the game and use an ability after the game has been running for one minute, your cooldowns list will remember that you can't use the ability again until world.time = 610. This means if you close the game and start it up again, for the first 61 seconds you can't use that ability.
I could store the value of world.time when a character is saved and set the cooldown times based on that value when you load the character. The problem is that you might want cooldowns to be handled differently. If you have an ability with a 30 minute cooldown, does the cooldown expire if you close the game for 30 minutes? Does it expire if you switch characters for 30 minutes?
What I'm leaning towards is that cooldowns will not be saved at all. Anything like a cooldown that needs to be persisted will be done as a Condition object (which currently don't get persisted, but that'll change too). Most abilities will have short cooldowns (ex: 0-5 seconds), so it's not really buying the player much to log out and back in just to reset their cooldowns. Since Conditions are full objects it'll be easier for you to specify how you want their durations to work.
The next biggest change is the addition of equipment overlays. I added sword, armor, and helmet overlays. You just call mob.overlay(item) and pass if the item the player is equipping and it creates the equipment overlay. There's not much to this technically but it was a hassle to draw all of the overlay icons. In the next version I'll try to include some procs to generate overlays.
In this update I wanted to flesh out the interface a bit more. I did, though not exactly in the way I had planned. I wanted to improve the shopkeeper interface to let the player sell items and possibly add a bank the player can store items in. I didn't add these things, but I did add the ability to delete items (press the delete key while your inventory is open) and I added the title screen, character selection, and game menu interfaces.
I also made some improvements to chat. Now, clicking on a player's name will prompt you to send them a private message. In the next update I'll likely add the interface to make it possible to ignore and unignore players. The procs for these actions exist and the chat is written to honor your ignore list, there's just no interface to access these functions yet.
Here is the full list of changes:
- Made it so you can't use, equip, or unequip items when you're dead.
- Changed how attack animations are played. Instead of using flick(), it now just changes your icon_state for a specified amount of time.
- Added character saving and loading as the client.save() and client.load() procs. The load() proc simply populates the client's mobs list which you can then display to the user to let them select a character.
- Added a title screen and character selection menu.
- I had to change some things to support saving and loading:
- Instead of using mob/Login to initialize your mob, it now uses the mob's new_character() proc. This ways it's only called when you create a new character and not when you connect to one you loaded.
- Added the client.connect(mob/m) proc which connects the client to a mob. This triggers all of the actions that have to happen (setting client.mob, setting client.statobj, setting client.focus, calling init_hud(), etc.).
- Made a bunch of the mob's vars tmp vars so they don't get saved.
- Added the Constants.CLIENT_SIDE_SAVING variable which determines if savefiles are stored on the server or client. The default is to store files on the server. If you change to use client-side savefiles, be aware that you'll have to change when client.save() gets called. By default it's only called from client/Del() which does not allow for the savefile to be exported.
- Added the /missile object which is a child type of /projectile. The missile object is purely graphical. It passes through all objects and always hits the specified target, calling the hit() proc when it has reached its target. Its New() proc takes two parameters, the owner and the target.
- Updated the ShootArrow ability to use the new /missile object to create a graphical effect and deal damage when the projectile graphic hits the target.
- Added the ability to send private messages by starting your messages with a player's name followed by a colon.
- Removed the ability to target a player by clicking on their name. Clicking on a player's name now prompts you to send them a private message. Clicking on a player's name in the "Who's Online" output also does this.
- Changed how chat messages are colored. Instead of using color constants from the global Constants object, it now uses client/script to control the color. This is needed so the link's color doesn't change to the visited link color after you click on it.
- Added a game menu that is accessed by pressing escape while in the game. It contains some placeholder options and a working option to return to the title screen (which lets players change characters).
- Added the ability to delete characters at the character selection screen by pressing the delete key and selecting "Delete" at the confirmation prompt.
- Added the item.overlay_icon, overlay_state, and overlay_layer vars.
- Updated how overlays and equipment overlays are handled. You can now call the mob.overlay() proc and pass it an item. It'll create and return the /Overlay object to represent the item based on its overlay_icon/state/layer vars.
- Added the mob.remove(item) proc which removes an equipment overlay.
- Added the move_state var which is the movement portion of the player's icon state (ex: standing, moving, attacking, dead, etc.). Overlays created by passing the overlay() proc an item are automatically updated to always match the player's movement state.
- Updated the sample game to include equipment based overlays. The shield was changed to body armor which has an overlay. The sword also has an overlay. Also added a helmet which has an overlay.
- Updated the melee attack graphical effect to remove the sword part, now it's just the white slashing line (if you have a sword equipped, your overlay will be animated to show the sword slash).
- Made the character selection menu display overlays based on what items each character has equipped.
- Added the ability to delete items from the inventory screen by pressing the delete key.
- Fixed a glitch in the mob.drop_item() proc. Previously it wouldn't unequip an item before dropping it.