{"action":"created","issue":{"url":"https://api.github.com/repos/KeenSoftwareHouse/SpaceEngineers/issues/314","labels_url":"https://api.github.com/repos/KeenSoftwareHouse/SpaceEngineers/issues/314/labels{/name}","comments_url":"https://api.github.com/repos/KeenSoftwareHouse/SpaceEngineers/issues/314/comments","events_url":"https://api.github.com/repos/KeenSoftwareHouse/SpaceEngineers/issues/314/events","html_url":"https://github.com/KeenSoftwareHouse/SpaceEngineers/pull/314","id":91465656,"number":314,"title":"Damage Routing System.  Track, mitigate, amplify, and nullify damage to all things in game.","user":{"login":"Tyrsis","id":8304731,"avatar_url":"https://avatars.githubusercontent.com/u/8304731?v=3","gravatar_id":"","url":"https://api.github.com/users/Tyrsis","html_url":"https://github.com/Tyrsis","followers_url":"https://api.github.com/users/Tyrsis/followers","following_url":"https://api.github.com/users/Tyrsis/following{/other_user}","gists_url":"https://api.github.com/users/Tyrsis/gists{/gist_id}","starred_url":"https://api.github.com/users/Tyrsis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tyrsis/subscriptions","organizations_url":"https://api.github.com/users/Tyrsis/orgs","repos_url":"https://api.github.com/users/Tyrsis/repos","events_url":"https://api.github.com/users/Tyrsis/events{/privacy}","received_events_url":"https://api.github.com/users/Tyrsis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/KeenSoftwareHouse/SpaceEngineers/labels/needs%20branch%20update","name":"needs branch update","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-06-27T13:42:05Z","updated_at":"2015-07-10T02:59:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/KeenSoftwareHouse/SpaceEngineers/pulls/314","html_url":"https://github.com/KeenSoftwareHouse/SpaceEngineers/pull/314","diff_url":"https://github.com/KeenSoftwareHouse/SpaceEngineers/pull/314.diff","patch_url":"https://github.com/KeenSoftwareHouse/SpaceEngineers/pull/314.patch"},"body":"This adds the ability to hook into damage that is done on objects in game, and observe or modify it.  This also allows you to track if objects are destroyed.\r\n\r\nAdded a new game system called MyDamageSystem internally in Sandbox.Game.  This can be used internally if new objects are added and damage is done.\r\n\r\nFor mods, added IMyDamageSystem to IMySession.  This allows mods to hook into damage and modify it via:\r\n\r\nMyAPIGateway.Session.DamageSystem.RegisterDestroyHandler(int, delegate);\r\nMyAPIGateway.Session.DamageSystem.RegisterBeforeDamageHandler(int, delegate);\r\nMyAPIGateway.Session.DamageSystem.RegisterAfterDamageHandler(int, delegate);\r\n\r\nDestroy, and AfterDamage delegates are for information purposes.  BeforeDamage delegate allows you to modify damage before it's applied.  This allows you to mitigate, amplify, or nullify damage (including deformation).\r\n\r\nEach function allows a priority.  The handlers with a lower priority handle damage first.\r\n\r\nTest Map and Test Mod:\r\nMOD: http://steamcommunity.com/sharedfiles/filedetails/?id=470287428\r\nMAP: http://steamcommunity.com/sharedfiles/filedetails/?id=474190531\r\n\r\nThe mod basically outputs damage to chat and to a log.  It also puts a notification on your screen when something is destroyed.\r\n\r\nYou can also colour blocks to nullify, mitigate, and amplify damage as follows:\r\nColor block 360, 0, 0 to amplify damage by 2\r\nColor block 0, -100, 0 to mitigate damage by half\r\nColor block 0, 0, -100 to nullify damage and make it invincible\r\n\r\nThis shows how easy it is to modify how damage is done in a very simple way. "},"comment":{"url":"https://api.github.com/repos/KeenSoftwareHouse/SpaceEngineers/issues/comments/120209496","html_url":"https://github.com/KeenSoftwareHouse/SpaceEngineers/pull/314#issuecomment-120209496","issue_url":"https://api.github.com/repos/KeenSoftwareHouse/SpaceEngineers/issues/314","id":120209496,"user":{"login":"Tyrsis","id":8304731,"avatar_url":"https://avatars.githubusercontent.com/u/8304731?v=3","gravatar_id":"","url":"https://api.github.com/users/Tyrsis","html_url":"https://github.com/Tyrsis","followers_url":"https://api.github.com/users/Tyrsis/followers","following_url":"https://api.github.com/users/Tyrsis/following{/other_user}","gists_url":"https://api.github.com/users/Tyrsis/gists{/gist_id}","starred_url":"https://api.github.com/users/Tyrsis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tyrsis/subscriptions","organizations_url":"https://api.github.com/users/Tyrsis/orgs","repos_url":"https://api.github.com/users/Tyrsis/repos","events_url":"https://api.github.com/users/Tyrsis/events{/privacy}","received_events_url":"https://api.github.com/users/Tyrsis/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T02:59:59Z","updated_at":"2015-07-10T02:59:59Z","body":"This needed more than a branch update :P\r\n\r\nThis should work now, but please note I had to modify MyEntityStat slightly to pass along information required since it appears now an entity state script (???) control the health stat.  It may not be ideal though, but I tried to modify as little as I could.  \r\n\r\nStat modifications will sometimes require information to be attached to them (why they were modified and by what modified them).  Especially when it comes to health.  Right now it's passed as an object, but perhaps some sort of standard way in MyEntityStat should be created.  For now I pass it along with modifying the value.  This in turn gets passed back when the script kills the character."}}