{"action":"created","comment":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/22551417","id":22551417,"diff_hunk":"@@ -0,0 +1,105 @@\n+#region Copyright & License Information\n+/*\n+* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)\n+* This file is part of OpenRA, which is free software. It is made\n+* available to you under the terms of the GNU General Public License\n+* as published by the Free Software Foundation. For more information,\n+* see COPYING.\n+*/\n+#endregion\n+\n+using System;\n+using OpenRA.Mods.Common.Traits;\n+using OpenRA.Traits;\n+\n+namespace OpenRA.Mods.D2k.Traits\n+{\n+\tclass SandwormInfo : WandersInfo\n+\t{\n+\t\tpublic const string IdleSequenceName = \"idle\";\n+\t\tpublic const int TargetRescanIntervalInTicks = 5;\n+\n+\t\tpublic override object Create(ActorInitializer init) { return new Sandworm(init.Self, this); }\n+\t}\n+\n+\tclass Sandworm : Wanders, ITick, INotifyBecomingIdle\n+\t{\n+\t\treadonly Lazy<IMove> move;\n+\t\treadonly Lazy<RenderUnit> renderUnit;\n+\t\treadonly Lazy<AttackBase> attackTrait;\n+\n+\t\tint targetCountdown;\n+\t\tuint currentTargetActorId;\n+\n+\t\tpublic Sandworm(Actor self, SandwormInfo info)\n+\t\t\t: base(self, info)\n+\t\t{\n+\t\t\tmove = Exts.Lazy(self.Trait<IMove>);\n+\t\t\trenderUnit = Exts.Lazy(self.Trait<RenderUnit>);\n+\t\t\tattackTrait = Exts.Lazy(self.Trait<AttackBase>);\n+\t\t}\n+\n+\t\tpublic new void OnBecomingIdle(Actor self)\n+\t\t{\n+\t\t\tif (renderUnit.Value.DefaultAnimation.CurrentSequence.Name != SandwormInfo.IdleSequenceName)\n+\t\t\t\trenderUnit.Value.DefaultAnimation.ReplaceAnim(\"idle\");\n+\n+\t\t\tbase.OnBecomingIdle(self);\n+\t\t}\n+\n+\t\tpublic override void DoAction(Actor self, CPos targetCell)\n+\t\t{\n+\t\t\tself.QueueActivity(move.Value.MoveWithinRange(Target.FromCell(self.World, targetCell, SubCell.Any), WRange.FromCells(1)));\n+\t\t}\n+\n+\t\tpublic void Tick(Actor self)\n+\t\t{\n+\t\t\tif (--targetCountdown > 0)\n+\t\t\t\treturn;\n+\n+\t\t\ttargetCountdown = SandwormInfo.TargetRescanIntervalInTicks;\n+\n+\t\t\tvar food = self.World.ActorsWithTrait<WormFood>();\n+\t\t\tvar desiredPair = new TraitPair<WormFood>();\n+\t\t\tvar maxStrength = 0.0;\n+\n+\t\t\tforeach (var traitPair in food)\n+\t\t\t{\n+\t\t\t\tif (!traitPair.Actor.IsInWorld)\n+\t\t\t\t\tcontinue;\n+\n+\t\t\t\tif (traitPair.Trait.CurrentNoise <= 0)\n+\t\t\t\t\tcontinue;\n+\n+\t\t\t\tvar distance = (self.Location - traitPair.Actor.Location).Length;\n+\t\t\t\tvar strength = traitPair.Trait.CurrentNoise - traitPair.Trait.NoiseAttenuation * distance;\n+\n+\t\t\t\tif (maxStrength >= strength)\n+\t\t\t\t\tcontinue;\n+\n+\t\t\t\tmaxStrength = strength;\n+\t\t\t\tdesiredPair = traitPair;\n+\t\t\t}\n+\n+\t\t\t// No target was found\n+\t\t\tif (maxStrength == 0.0)\n+\t\t\t{\n+\t\t\t\tcurrentTargetActorId = 0;\n+\t\t\t\treturn;\n+\t\t\t}\n+\n+\t\t\tGame.Debug(\"(Sandworm {0}) is attacking actor ({1} {2}).\", self.ActorID, desiredPair.Actor.Info.Name, desiredPair.Actor.ActorID);\n+\t\t\tvar dist = (self.Location - desiredPair.Actor.Location).Length;\n+\t\t\tvar str = desiredPair.Trait.CurrentNoise - desiredPair.Trait.NoiseAttenuation * dist;\n+\t\t\tGame.Debug(\"Target Noise level is {0}. Distance is {1}, noise strength is {2}.\", desiredPair.Trait.CurrentNoise, dist, str);","path":"OpenRA.Mods.D2k/Traits/Sandworm.cs","position":94,"original_position":94,"commit_id":"3877d07de00178a10fca70b7153df4b704aedf30","original_commit_id":"3877d07de00178a10fca70b7153df4b704aedf30","user":{"login":"penev92","id":7137365,"avatar_url":"https://avatars.githubusercontent.com/u/7137365?v=3","gravatar_id":"","url":"https://api.github.com/users/penev92","html_url":"https://github.com/penev92","followers_url":"https://api.github.com/users/penev92/followers","following_url":"https://api.github.com/users/penev92/following{/other_user}","gists_url":"https://api.github.com/users/penev92/gists{/gist_id}","starred_url":"https://api.github.com/users/penev92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/penev92/subscriptions","organizations_url":"https://api.github.com/users/penev92/orgs","repos_url":"https://api.github.com/users/penev92/repos","events_url":"https://api.github.com/users/penev92/events{/privacy}","received_events_url":"https://api.github.com/users/penev92/received_events","type":"User","site_admin":false},"body":"Definitely. They are there because someone (I think it was @pchote) told me to drop some debug messages so the reviewers can see what's going on.","created_at":"2015-01-06T20:57:23Z","updated_at":"2015-01-06T20:57:23Z","html_url":"https://github.com/OpenRA/OpenRA/pull/7278#discussion_r22551417","pull_request_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/7278","_links":{"self":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/22551417"},"html":{"href":"https://github.com/OpenRA/OpenRA/pull/7278#discussion_r22551417"},"pull_request":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/7278"}}},"pull_request":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/7278","id":26829575,"html_url":"https://github.com/OpenRA/OpenRA/pull/7278","diff_url":"https://github.com/OpenRA/OpenRA/pull/7278.diff","patch_url":"https://github.com/OpenRA/OpenRA/pull/7278.patch","issue_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/7278","number":7278,"state":"open","locked":false,"title":"Enhance Sandworm behaviour","user":{"login":"penev92","id":7137365,"avatar_url":"https://avatars.githubusercontent.com/u/7137365?v=3","gravatar_id":"","url":"https://api.github.com/users/penev92","html_url":"https://github.com/penev92","followers_url":"https://api.github.com/users/penev92/followers","following_url":"https://api.github.com/users/penev92/following{/other_user}","gists_url":"https://api.github.com/users/penev92/gists{/gist_id}","starred_url":"https://api.github.com/users/penev92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/penev92/subscriptions","organizations_url":"https://api.github.com/users/penev92/orgs","repos_url":"https://api.github.com/users/penev92/repos","events_url":"https://api.github.com/users/penev92/events{/privacy}","received_events_url":"https://api.github.com/users/penev92/received_events","type":"User","site_admin":false},"body":"I took some time before filing the PR to split the work into (mostly) self-contained work items, each in its own commit. The commit messages should reflect what happens where.\r\n\r\nAs a side effect, worms should have no more problems with targets moving out of range during the attack, reaching solid ground or being picked up by a carryall.\r\n\r\nP.S.: I intentionally didn't make any of the discussed changes for making worms \"less aggressive\", because these are behavior/logic changes, and those will be balancing changes. I will file a follow-up PR for them once this is done.","created_at":"2015-01-05T15:21:06Z","updated_at":"2015-01-06T20:57:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3bc5e936145175e3bafcd1d5b9ccc9c4cfbed7f1","assignee":null,"milestone":{"url":"https://api.github.com/repos/OpenRA/OpenRA/milestones/12","labels_url":"https://api.github.com/repos/OpenRA/OpenRA/milestones/12/labels","id":844833,"number":12,"title":"Next release","description":"","creator":{"login":"obrakmann","id":4331210,"avatar_url":"https://avatars.githubusercontent.com/u/4331210?v=3","gravatar_id":"","url":"https://api.github.com/users/obrakmann","html_url":"https://github.com/obrakmann","followers_url":"https://api.github.com/users/obrakmann/followers","following_url":"https://api.github.com/users/obrakmann/following{/other_user}","gists_url":"https://api.github.com/users/obrakmann/gists{/gist_id}","starred_url":"https://api.github.com/users/obrakmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obrakmann/subscriptions","organizations_url":"https://api.github.com/users/obrakmann/orgs","repos_url":"https://api.github.com/users/obrakmann/repos","events_url":"https://api.github.com/users/obrakmann/events{/privacy}","received_events_url":"https://api.github.com/users/obrakmann/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":16,"state":"open","created_at":"2014-10-29T09:04:03Z","updated_at":"2015-01-06T19:58:31Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/7278/commits","review_comments_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/7278/comments","review_comment_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/{number}","comments_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/7278/comments","statuses_url":"https://api.github.com/repos/OpenRA/OpenRA/statuses/3877d07de00178a10fca70b7153df4b704aedf30","head":{"label":"penev92:bleed_sandworm","ref":"bleed_sandworm","sha":"3877d07de00178a10fca70b7153df4b704aedf30","user":{"login":"penev92","id":7137365,"avatar_url":"https://avatars.githubusercontent.com/u/7137365?v=3","gravatar_id":"","url":"https://api.github.com/users/penev92","html_url":"https://github.com/penev92","followers_url":"https://api.github.com/users/penev92/followers","following_url":"https://api.github.com/users/penev92/following{/other_user}","gists_url":"https://api.github.com/users/penev92/gists{/gist_id}","starred_url":"https://api.github.com/users/penev92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/penev92/subscriptions","organizations_url":"https://api.github.com/users/penev92/orgs","repos_url":"https://api.github.com/users/penev92/repos","events_url":"https://api.github.com/users/penev92/events{/privacy}","received_events_url":"https://api.github.com/users/penev92/received_events","type":"User","site_admin":false},"repo":{"id":24796059,"name":"OpenRA","full_name":"penev92/OpenRA","owner":{"login":"penev92","id":7137365,"avatar_url":"https://avatars.githubusercontent.com/u/7137365?v=3","gravatar_id":"","url":"https://api.github.com/users/penev92","html_url":"https://github.com/penev92","followers_url":"https://api.github.com/users/penev92/followers","following_url":"https://api.github.com/users/penev92/following{/other_user}","gists_url":"https://api.github.com/users/penev92/gists{/gist_id}","starred_url":"https://api.github.com/users/penev92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/penev92/subscriptions","organizations_url":"https://api.github.com/users/penev92/orgs","repos_url":"https://api.github.com/users/penev92/repos","events_url":"https://api.github.com/users/penev92/events{/privacy}","received_events_url":"https://api.github.com/users/penev92/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/penev92/OpenRA","description":"An open-source implementation of the Command & Conquer: Red Alert engine using .NET/Mono and OpenGL. Runs on Windows, Linux and Mac OS X.","fork":true,"url":"https://api.github.com/repos/penev92/OpenRA","forks_url":"https://api.github.com/repos/penev92/OpenRA/forks","keys_url":"https://api.github.com/repos/penev92/OpenRA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/penev92/OpenRA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/penev92/OpenRA/teams","hooks_url":"https://api.github.com/repos/penev92/OpenRA/hooks","issue_events_url":"https://api.github.com/repos/penev92/OpenRA/issues/events{/number}","events_url":"https://api.github.com/repos/penev92/OpenRA/events","assignees_url":"https://api.github.com/repos/penev92/OpenRA/assignees{/user}","branches_url":"https://api.github.com/repos/penev92/OpenRA/branches{/branch}","tags_url":"https://api.github.com/repos/penev92/OpenRA/tags","blobs_url":"https://api.github.com/repos/penev92/OpenRA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/penev92/OpenRA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/penev92/OpenRA/git/refs{/sha}","trees_url":"https://api.github.com/repos/penev92/OpenRA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/penev92/OpenRA/statuses/{sha}","languages_url":"https://api.github.com/repos/penev92/OpenRA/languages","stargazers_url":"https://api.github.com/repos/penev92/OpenRA/stargazers","contributors_url":"https://api.github.com/repos/penev92/OpenRA/contributors","subscribers_url":"https://api.github.com/repos/penev92/OpenRA/subscribers","subscription_url":"https://api.github.com/repos/penev92/OpenRA/subscription","commits_url":"https://api.github.com/repos/penev92/OpenRA/commits{/sha}","git_commits_url":"https://api.github.com/repos/penev92/OpenRA/git/commits{/sha}","comments_url":"https://api.github.com/repos/penev92/OpenRA/comments{/number}","issue_comment_url":"https://api.github.com/repos/penev92/OpenRA/issues/comments/{number}","contents_url":"https://api.github.com/repos/penev92/OpenRA/contents/{+path}","compare_url":"https://api.github.com/repos/penev92/OpenRA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/penev92/OpenRA/merges","archive_url":"https://api.github.com/repos/penev92/OpenRA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/penev92/OpenRA/downloads","issues_url":"https://api.github.com/repos/penev92/OpenRA/issues{/number}","pulls_url":"https://api.github.com/repos/penev92/OpenRA/pulls{/number}","milestones_url":"https://api.github.com/repos/penev92/OpenRA/milestones{/number}","notifications_url":"https://api.github.com/repos/penev92/OpenRA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/penev92/OpenRA/labels{/name}","releases_url":"https://api.github.com/repos/penev92/OpenRA/releases{/id}","created_at":"2014-10-04T17:27:45Z","updated_at":"2014-10-05T20:15:38Z","pushed_at":"2015-01-06T20:08:15Z","git_url":"git://github.com/penev92/OpenRA.git","ssh_url":"git@github.com:penev92/OpenRA.git","clone_url":"https://github.com/penev92/OpenRA.git","svn_url":"https://github.com/penev92/OpenRA","homepage":"http://www.openra.net","size":80300,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"bleed"}},"base":{"label":"OpenRA:bleed","ref":"bleed","sha":"e353fe52631ed139483afb871b43f8c6fe8d9aea","user":{"login":"OpenRA","id":409046,"avatar_url":"https://avatars.githubusercontent.com/u/409046?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenRA","html_url":"https://github.com/OpenRA","followers_url":"https://api.github.com/users/OpenRA/followers","following_url":"https://api.github.com/users/OpenRA/following{/other_user}","gists_url":"https://api.github.com/users/OpenRA/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRA/subscriptions","organizations_url":"https://api.github.com/users/OpenRA/orgs","repos_url":"https://api.github.com/users/OpenRA/repos","events_url":"https://api.github.com/users/OpenRA/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRA/received_events","type":"Organization","site_admin":false},"repo":{"id":959908,"name":"OpenRA","full_name":"OpenRA/OpenRA","owner":{"login":"OpenRA","id":409046,"avatar_url":"https://avatars.githubusercontent.com/u/409046?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenRA","html_url":"https://github.com/OpenRA","followers_url":"https://api.github.com/users/OpenRA/followers","following_url":"https://api.github.com/users/OpenRA/following{/other_user}","gists_url":"https://api.github.com/users/OpenRA/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRA/subscriptions","organizations_url":"https://api.github.com/users/OpenRA/orgs","repos_url":"https://api.github.com/users/OpenRA/repos","events_url":"https://api.github.com/users/OpenRA/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenRA/OpenRA","description":"An open-source implementation of the Command & Conquer: Red Alert engine using .NET/Mono and OpenGL. Runs on Windows, Linux and Mac OS X.","fork":false,"url":"https://api.github.com/repos/OpenRA/OpenRA","forks_url":"https://api.github.com/repos/OpenRA/OpenRA/forks","keys_url":"https://api.github.com/repos/OpenRA/OpenRA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenRA/OpenRA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenRA/OpenRA/teams","hooks_url":"https://api.github.com/repos/OpenRA/OpenRA/hooks","issue_events_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/events{/number}","events_url":"https://api.github.com/repos/OpenRA/OpenRA/events","assignees_url":"https://api.github.com/repos/OpenRA/OpenRA/assignees{/user}","branches_url":"https://api.github.com/repos/OpenRA/OpenRA/branches{/branch}","tags_url":"https://api.github.com/repos/OpenRA/OpenRA/tags","blobs_url":"https://api.github.com/repos/OpenRA/OpenRA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenRA/OpenRA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenRA/OpenRA/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenRA/OpenRA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenRA/OpenRA/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenRA/OpenRA/languages","stargazers_url":"https://api.github.com/repos/OpenRA/OpenRA/stargazers","contributors_url":"https://api.github.com/repos/OpenRA/OpenRA/contributors","subscribers_url":"https://api.github.com/repos/OpenRA/OpenRA/subscribers","subscription_url":"https://api.github.com/repos/OpenRA/OpenRA/subscription","commits_url":"https://api.github.com/repos/OpenRA/OpenRA/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenRA/OpenRA/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenRA/OpenRA/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/comments/{number}","contents_url":"https://api.github.com/repos/OpenRA/OpenRA/contents/{+path}","compare_url":"https://api.github.com/repos/OpenRA/OpenRA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenRA/OpenRA/merges","archive_url":"https://api.github.com/repos/OpenRA/OpenRA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenRA/OpenRA/downloads","issues_url":"https://api.github.com/repos/OpenRA/OpenRA/issues{/number}","pulls_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenRA/OpenRA/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenRA/OpenRA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenRA/OpenRA/labels{/name}","releases_url":"https://api.github.com/repos/OpenRA/OpenRA/releases{/id}","created_at":"2010-10-04T07:38:05Z","updated_at":"2015-01-06T20:05:37Z","pushed_at":"2015-01-06T20:05:36Z","git_url":"git://github.com/OpenRA/OpenRA.git","ssh_url":"git@github.com:OpenRA/OpenRA.git","clone_url":"https://github.com/OpenRA/OpenRA.git","svn_url":"https://github.com/OpenRA/OpenRA","homepage":"http://www.openra.net","size":149154,"stargazers_count":1620,"watchers_count":1620,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":552,"mirror_url":null,"open_issues_count":690,"forks":552,"open_issues":690,"watchers":1620,"default_branch":"bleed"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/7278"},"html":{"href":"https://github.com/OpenRA/OpenRA/pull/7278"},"issue":{"href":"https://api.github.com/repos/OpenRA/OpenRA/issues/7278"},"comments":{"href":"https://api.github.com/repos/OpenRA/OpenRA/issues/7278/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/7278/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/7278/commits"},"statuses":{"href":"https://api.github.com/repos/OpenRA/OpenRA/statuses/3877d07de00178a10fca70b7153df4b704aedf30"}}}}