CleverRaven/Cataclysm-DDA — pull request #9545 by BevapDin (2014-10-14 16:09:43+00:00)
Title: Make disabling robots generic.

First a small bug:
- get a friendly turret,
- grab a shopping cart or similar vehicle,
- walk into the turret, answer no the "Deactivate the..." query.

The grabbed vehicle has moved, but the character hasn't. Now the vehicle is under the character, but the character does not known this. Moving away from the vehicle triggers a well known debug message.

I extracted the logic to disable a monster (turret) into a separate functions, which is called *before* any other movement, this fixes the bug above. It also makes the code to get ammo back from the turret generic to work with all kind of monsters and ammo.

The item type that a monster reverts to is now part of the monster definition. This allows mods to add new robot monsters that can be placed from items and revert to those items. This is also used in the event of an EMP.

----

Question: would it be good if the conversion monster to item and back also include the damage value of the item and the hp of the monster? That means using a damaged turret item creates a turret monster that has less than it's full HP. And converting such a wounded robot back into an item would yield a damaged item.

----

Another thing: making a manhack to follow your character (adding the "docile" effect) prints the message "The manhack ." ("The %s .") - this is from the first commit of that feature (1a060a2a6b492f1d28c57c772da046c560bbfc74). What does that message mean? It seems something is missing there.

----

Slightly related: the file names are confusing:

There is mtype.h (containing the class definition of `mtype`), but it's implemented in mtypedef.cpp - I suggest renaming that file to mtype.cpp.

There is mongroup.h (containing the class definition of `MonsterGroupManager` and others), but it's implemented in mongroupdef.cpp - I suggest renaming that file to mongroup.cpp or renaming both files to monstergroupmanger.{cpp,h} or monstergroup.{cpp,h} or renaming mongroup.h to mongroupdef.h or whatever.