{"action":"created","comment":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/93758616","pull_request_review_id":14293258,"id":93758616,"diff_hunk":"@@ -22,43 +22,52 @@ class AmbientSoundInfo : UpgradableTraitInfo\n \t\t[Desc(\"Interval between playing the sound (in ticks).\")]\n \t\tpublic readonly int Interval = 0;\n \n-\t\tpublic override object Create(ActorInitializer init) { return new AmbientSound(init.Self, this); }\n+\t\tpublic override object Create(ActorInitializer init) { return new AmbientSound(this); }\n \t}\n \n-\tclass AmbientSound : UpgradableTrait<AmbientSoundInfo>, ITick\n+\tclass AmbientSound : UpgradableTrait<AmbientSoundInfo>, ITick, INotifyRemovedFromWorld\n \t{\n \t\tISound currentSound;\n \t\tbool wasDisabled = true;\n \t\tint interval;\n+\t\tWPos cachedPosition;\n \n-\t\tpublic AmbientSound(Actor self, AmbientSoundInfo info)\n+\t\tpublic AmbientSound(AmbientSoundInfo info)\n \t\t\t: base(info)\n \t\t{\n \t\t\tinterval = info.Interval;\n \t\t}\n \n \t\tpublic void Tick(Actor self)\n \t\t{\n-\t\t\tif (IsTraitDisabled)\n+\t\t\tif (IsTraitDisabled || !self.IsInWorld)\n \t\t\t{\n-\t\t\t\tGame.Sound.StopSound(currentSound);\n-\t\t\t\tcurrentSound = null;\n-\t\t\t\twasDisabled = true;\n+\t\t\t\tStopSound();","path":"OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs","position":31,"original_position":31,"commit_id":"2a5b418d303a3fdae442221a63441506943ca8ed","original_commit_id":"2a5b418d303a3fdae442221a63441506943ca8ed","user":{"login":"pchote","id":167819,"avatar_url":"https://avatars.githubusercontent.com/u/167819?v=3","gravatar_id":"","url":"https://api.github.com/users/pchote","html_url":"https://github.com/pchote","followers_url":"https://api.github.com/users/pchote/followers","following_url":"https://api.github.com/users/pchote/following{/other_user}","gists_url":"https://api.github.com/users/pchote/gists{/gist_id}","starred_url":"https://api.github.com/users/pchote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pchote/subscriptions","organizations_url":"https://api.github.com/users/pchote/orgs","repos_url":"https://api.github.com/users/pchote/repos","events_url":"https://api.github.com/users/pchote/events{/privacy}","received_events_url":"https://api.github.com/users/pchote/received_events","type":"User","site_admin":false},"body":"Why are you doing this twice? (here and `INotifyRemovedFromWorld.RemovedFromWorld`).  You should be able to remove one of these cases.","created_at":"2016-12-23T12:05:22Z","updated_at":"2016-12-23T12:11:03Z","html_url":"https://github.com/OpenRA/OpenRA/pull/12345#discussion_r93758616","pull_request_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/12345","_links":{"self":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/93758616"},"html":{"href":"https://github.com/OpenRA/OpenRA/pull/12345#discussion_r93758616"},"pull_request":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/12345"}}},"pull_request":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/12345","id":92196953,"html_url":"https://github.com/OpenRA/OpenRA/pull/12345","diff_url":"https://github.com/OpenRA/OpenRA/pull/12345.diff","patch_url":"https://github.com/OpenRA/OpenRA/pull/12345.patch","issue_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/12345","number":12345,"state":"open","locked":false,"title":"Fix the AmbientSound still playing when the actor is not in world","user":{"login":"abcdefg30","id":7704140,"avatar_url":"https://avatars.githubusercontent.com/u/7704140?v=3","gravatar_id":"","url":"https://api.github.com/users/abcdefg30","html_url":"https://github.com/abcdefg30","followers_url":"https://api.github.com/users/abcdefg30/followers","following_url":"https://api.github.com/users/abcdefg30/following{/other_user}","gists_url":"https://api.github.com/users/abcdefg30/gists{/gist_id}","starred_url":"https://api.github.com/users/abcdefg30/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abcdefg30/subscriptions","organizations_url":"https://api.github.com/users/abcdefg30/orgs","repos_url":"https://api.github.com/users/abcdefg30/repos","events_url":"https://api.github.com/users/abcdefg30/events{/privacy}","received_events_url":"https://api.github.com/users/abcdefg30/received_events","type":"User","site_admin":false},"body":"Also fixes the origin of the sound not being updated for moving actors.\r\nImho we should really remove the \"hack\" when interval is zero. It's just a mess, sounds awful and blocks expanding the features of that trait. You could also use the length of the sound track as interval anyways.","created_at":"2016-11-03T17:01:12Z","updated_at":"2016-12-23T12:11:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3dcba6380c26b2254fa86003082a5c422a52a1b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/12345/commits","review_comments_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/12345/comments","review_comment_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/12345/comments","statuses_url":"https://api.github.com/repos/OpenRA/OpenRA/statuses/2a5b418d303a3fdae442221a63441506943ca8ed","head":{"label":"abcdefg30:removeAmbient","ref":"removeAmbient","sha":"2a5b418d303a3fdae442221a63441506943ca8ed","user":{"login":"abcdefg30","id":7704140,"avatar_url":"https://avatars.githubusercontent.com/u/7704140?v=3","gravatar_id":"","url":"https://api.github.com/users/abcdefg30","html_url":"https://github.com/abcdefg30","followers_url":"https://api.github.com/users/abcdefg30/followers","following_url":"https://api.github.com/users/abcdefg30/following{/other_user}","gists_url":"https://api.github.com/users/abcdefg30/gists{/gist_id}","starred_url":"https://api.github.com/users/abcdefg30/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abcdefg30/subscriptions","organizations_url":"https://api.github.com/users/abcdefg30/orgs","repos_url":"https://api.github.com/users/abcdefg30/repos","events_url":"https://api.github.com/users/abcdefg30/events{/privacy}","received_events_url":"https://api.github.com/users/abcdefg30/received_events","type":"User","site_admin":false},"repo":{"id":21796544,"name":"OpenRA","full_name":"abcdefg30/OpenRA","owner":{"login":"abcdefg30","id":7704140,"avatar_url":"https://avatars.githubusercontent.com/u/7704140?v=3","gravatar_id":"","url":"https://api.github.com/users/abcdefg30","html_url":"https://github.com/abcdefg30","followers_url":"https://api.github.com/users/abcdefg30/followers","following_url":"https://api.github.com/users/abcdefg30/following{/other_user}","gists_url":"https://api.github.com/users/abcdefg30/gists{/gist_id}","starred_url":"https://api.github.com/users/abcdefg30/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abcdefg30/subscriptions","organizations_url":"https://api.github.com/users/abcdefg30/orgs","repos_url":"https://api.github.com/users/abcdefg30/repos","events_url":"https://api.github.com/users/abcdefg30/events{/privacy}","received_events_url":"https://api.github.com/users/abcdefg30/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abcdefg30/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/abcdefg30/OpenRA","forks_url":"https://api.github.com/repos/abcdefg30/OpenRA/forks","keys_url":"https://api.github.com/repos/abcdefg30/OpenRA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abcdefg30/OpenRA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abcdefg30/OpenRA/teams","hooks_url":"https://api.github.com/repos/abcdefg30/OpenRA/hooks","issue_events_url":"https://api.github.com/repos/abcdefg30/OpenRA/issues/events{/number}","events_url":"https://api.github.com/repos/abcdefg30/OpenRA/events","assignees_url":"https://api.github.com/repos/abcdefg30/OpenRA/assignees{/user}","branches_url":"https://api.github.com/repos/abcdefg30/OpenRA/branches{/branch}","tags_url":"https://api.github.com/repos/abcdefg30/OpenRA/tags","blobs_url":"https://api.github.com/repos/abcdefg30/OpenRA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abcdefg30/OpenRA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abcdefg30/OpenRA/git/refs{/sha}","trees_url":"https://api.github.com/repos/abcdefg30/OpenRA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abcdefg30/OpenRA/statuses/{sha}","languages_url":"https://api.github.com/repos/abcdefg30/OpenRA/languages","stargazers_url":"https://api.github.com/repos/abcdefg30/OpenRA/stargazers","contributors_url":"https://api.github.com/repos/abcdefg30/OpenRA/contributors","subscribers_url":"https://api.github.com/repos/abcdefg30/OpenRA/subscribers","subscription_url":"https://api.github.com/repos/abcdefg30/OpenRA/subscription","commits_url":"https://api.github.com/repos/abcdefg30/OpenRA/commits{/sha}","git_commits_url":"https://api.github.com/repos/abcdefg30/OpenRA/git/commits{/sha}","comments_url":"https://api.github.com/repos/abcdefg30/OpenRA/comments{/number}","issue_comment_url":"https://api.github.com/repos/abcdefg30/OpenRA/issues/comments{/number}","contents_url":"https://api.github.com/repos/abcdefg30/OpenRA/contents/{+path}","compare_url":"https://api.github.com/repos/abcdefg30/OpenRA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abcdefg30/OpenRA/merges","archive_url":"https://api.github.com/repos/abcdefg30/OpenRA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abcdefg30/OpenRA/downloads","issues_url":"https://api.github.com/repos/abcdefg30/OpenRA/issues{/number}","pulls_url":"https://api.github.com/repos/abcdefg30/OpenRA/pulls{/number}","milestones_url":"https://api.github.com/repos/abcdefg30/OpenRA/milestones{/number}","notifications_url":"https://api.github.com/repos/abcdefg30/OpenRA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abcdefg30/OpenRA/labels{/name}","releases_url":"https://api.github.com/repos/abcdefg30/OpenRA/releases{/id}","deployments_url":"https://api.github.com/repos/abcdefg30/OpenRA/deployments","created_at":"2014-07-13T17:54:32Z","updated_at":"2016-09-22T12:37:15Z","pushed_at":"2016-12-23T11:02:36Z","git_url":"git://github.com/abcdefg30/OpenRA.git","ssh_url":"git@github.com:abcdefg30/OpenRA.git","clone_url":"https://github.com/abcdefg30/OpenRA.git","svn_url":"https://github.com/abcdefg30/OpenRA","homepage":"http://www.openra.net","size":109800,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"7513707b8dffc06591db4f759dddbb35725e8da4","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":"Open Source real-time strategy game engine for early Westwood games such as Command & Conquer: Red Alert written in C# using SDL and OpenGL. Runs on Windows, Linux, *BSD 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}","deployments_url":"https://api.github.com/repos/OpenRA/OpenRA/deployments","created_at":"2010-10-04T07:38:05Z","updated_at":"2016-12-23T07:10:51Z","pushed_at":"2016-12-23T11:34:51Z","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":109884,"stargazers_count":3669,"watchers_count":3669,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1183,"mirror_url":null,"open_issues_count":1101,"forks":1183,"open_issues":1101,"watchers":3669,"default_branch":"bleed"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/12345"},"html":{"href":"https://github.com/OpenRA/OpenRA/pull/12345"},"issue":{"href":"https://api.github.com/repos/OpenRA/OpenRA/issues/12345"},"comments":{"href":"https://api.github.com/repos/OpenRA/OpenRA/issues/12345/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/12345/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/12345/commits"},"statuses":{"href":"https://api.github.com/repos/OpenRA/OpenRA/statuses/2a5b418d303a3fdae442221a63441506943ca8ed"}}}}
{"actor":{"display_login":"pchote"}}