Up to Main Index Up to Journal for February, 2020 JOURNAL FOR MONDAY 24TH FEBRUARY, 2020 ______________________________________________________________________________ SUBJECT: Far from healthy… DATE: Mon 24 Feb 20:38:23 GMT 2020 For the last week or so I’ve had the flu from hell, not helped by the fact I can’t take any ‘remedies’ to help alleviate the symptoms :( It’s made coding difficult with not being able to think straight. Ironically I now have a working Health attribute with regeneration of health points :) At the moment the code is a little unfinished and comes with one or two caveats. The Health attribute only works properly for players and not mobiles. You also can’t kill another player yet. For now a player will get 30 health points and regenerate health points at a rate of 2 every 10 seconds. This is currently coded into frontend/login.go which also automatically upgrades players when they log in. I plan on replacing all of the hard coding with a *.wrj player template that is easily editable. In the future it will be possible to have templates for different player races, classes and professions. For now if you want to modify the maximum health points or regeneration you can login and logout to upgrade the player, then edit the player file directly and login again. The format of Health in the player file is: Health: CURRENT→30 FREQUENCY→10S MAXIMUM→30 REGENERATES→5 The CURRENT and MAXIMUM values are integers representing the current and maximum health points of the player. FREQUENCY is a duration specifying how often health points are regained, while REGENERATES is an integer that specifies how many health points are regenerated. In this example the CURRENT health points are increased by 5 every 10 seconds until CURRENT reaches MAXIMUM. If a player takes damage they automatically start regenerating health points. In the player file CURRENT, MAXIMUM, FREQUENCY and REGENERATES may be abbreviated as CUR, MAX, FREQ and REGENS. To display the player’s current and maximum a new ‘/PROMPT’ command has been added. This can be used to check the current prompt mode or set the prompt to one of ‘none’, ‘brief’, ‘short’ and ‘long’: none: brief: > short: H:30/30> long: Health: 30/30 > If a prompt mode is not specified then ‘/PROMPT’ reports the current mode. The current prompt mode is not saved with the player data yet. A new ‘HIT’ command has been added for testing. You can hit another player for 5 health points of damage. If a player is low on health points the hitting player will get the message ‘<player> already seems pretty beaten up.’ and the attacked player will not be killed. You may be wondering why a player can’t be killed yet. It’s too complicated for my cotton wool filled brain at the moment. What I need to happen is for the HIT command to issue a QUIT command for the player that dies. Each player has a goroutine and I need the QUIT command to be issued by one player and executed by a different player. So far all I’ve managed to achieve are some nasty data races and deadlocks. I’m sure once I can think straight again I’ll come up with a solution. I’m currently thinking of having a generic way of being able to puppet other players. It’s not my best code and I’m still working on improvements. However, people have been asking for an update for ages now. If you want to have a play and do some testing the changes for the new Health attribute, HIT command and /PROMPT command are on the public dev branch. If you find any bugs or have an idea or comment, please feel free to drop me an email: diddymus@wolfmud.org -- Diddymus Up to Main Index Up to Journal for February, 2020