The mob's team var is a set of bit flags. This lets you create different factions. Mobs A and B are hostile towards each other if A.team & B.team is zero (they have no common team bits set). If two mobs have just one team in common they won't attack each other. This lets you easily do things like this:
This makes goblins hostile to players and enemies. When the player completes a quest to win the favor of the goblins, you can set the player's team var to Constants.TEAM_PLAYERS | Constants.TEAM_GOBLINS and the goblin mobs won't attack them anymore (but will still attack enemies).
I also removed the global Combat var from the library. You have to define your own in your project. I also made the sample game define two types of Combat objects - PhysicalCombat and MagicCombat - which are used for dealing physical damage and magical damage. Physical attacks can be dodged, magical attacks can be resisted. It's similar but they use different stats. I also updated each ability in the sample game to use either of those combat objects.
I also updated the procs for playing sound effects and added sound effects to the sample game.
Here is the full list of changes:
- Fixed a movement bug. Previously you would continue moving if you held and arrow key while you died.
- Moved the enemy AI into the library to be the default ai() proc. Non-client mobs that don't override their ai() proc will wander, look for targets, and use their abilities to attack them.
- Added some vars to manage the default enemy AI. Check enemy-ai.dm for more details.
- Made the font of the chat input field match the rest of the interface.
- Removed the global Combat var. If you need to use it, define your own.
- Defined the PhysicalCombat object in the sample game which contains the rules for physical damage (dodging, critical hits, etc.).
- Added the MagicCombat object to the sample game which has slightly different rules than the PhysicalCombat object. It uses the mind stat for critical hits and the resistance stat for damage reduction.
- Added the mind and resistance stats which are used by the new MagicCombat object.
- Changed how teams work. The team var is now a bit mask. If two mobs have no matching bits set, they can attack each other. By default all mobs are on TEAM_PLAYERS and mobs of type /mob/enemy are only on the TEAM_ENEMIES team.
- Removed the TARGET_RANGE constant. If you want to change it, just override the default value of the mob's target_range var.
- Added the mob.ignore and unignore procs which can be used to ignore chat messages from certain players. Your ignore list stores each mob's ckey, but you can pass a ckey or mob reference to these procs.
- Made the player able to target non-enemies by holding down the shift key while pressing tab.
- Also added the ability to target a mob by clicking on their name in the chat log.
- Added the name display below targeted mobs.
- Made projectiles pass through friendly mobs.
- Updated the sound procs. There is now the atom.noise() proc and the mob.sound_effect() proc. The atom.noise() proc is for creating noises that nearby players can hear (ex: casting a spell). The mob.sound_effect() proc is for playing sound effects to a single player (ex: when they make a selection in a menu).
- Added sound effects to the sample game.
- Added the mob.rumble proc which makes the screen shake.