From 6edaaecc8d41abdc29b7557d87e49a678c708e45 Mon Sep 17 00:00:00 2001 From: spiritlake <32268357+spiritlake@users.noreply.github.com> Date: Wed, 18 Dec 2019 17:12:07 -0500 Subject: [PATCH 1/3] Create README.md --- snippets/watchable-scenes/README.md | 189 ++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 snippets/watchable-scenes/README.md diff --git a/snippets/watchable-scenes/README.md b/snippets/watchable-scenes/README.md new file mode 100644 index 00000000..f37af20c --- /dev/null +++ b/snippets/watchable-scenes/README.md @@ -0,0 +1,189 @@ +Watchable scenes are scenes which anyone can view on the portal (ie, watch), but which only invited participants and admin can pose into. + +Because it interacts heavily with the scene system, Watchable doesn't work well as a plug-in. You'll have to do some custom code in order to enable it. You can make the changes listed below in order to create Watchable scenes on your game. + +##On game +**In `aresmush\plugins\scenes\public\scene.rb`** + +* add: `attribute :watchable_scene, :type => DataType::Boolean` + +**In `aresmush\plugins\scenes\helpers\permissions.rb`** + + add: + + def self.can_join_scene?(actor, scene) + return !scene.is_private? if !actor + return true if scene.owner == actor + return true if !scene.is_private? && !scene.watchable_scene + return true if actor.room == scene.room + return true if scene.invited.include?(actor) + scene.participants.include?(actor) + end + +**In `aresmush/plugins/scenes/commands/scene_info_cmd.rb`** + +* under `is_private = self.value == "Private"` add: `is_watchable = self.value == "Watchable"` +* under `scene.update(private_scene: is_private)` add `scene.update(watchable_scene: is_watchable)` + +**In `aresmush/plugins/scenes/commands/scene_start_cmd.rb`** + +* under `private_scene = self.privacy == "Private"` add `watchable_scene = self.privacy == "Watchable"` + +**In `plugins\scenes\commands\scene_addpose_cmd.rb`** + +* Change `if (!Scenes.can_read_scene?(enactor, scene))` to `if (!Scenes.can_join_scene?(enactor, scene))` + +**In `plugins\scenes\commands\scene_clearlog_cmd.rb`** + +* Change `if (!Scenes.can_edit_scene?(enactor, scene))` to `if (!Scenes.can_join_scene?(enactor, Scene[self.scene_num]))` + +**In `plugins\scenes\commands\scene_enablelog_cmd.rb`** + +* Change `if (!Scenes.can_edit_scene?(enactor, scene))` to `if (!Scenes.can_join_scene?(enactor, Scene[self.scene_num]))` + +**In `plugins\scenes\commands\scene_invite_cmd.rb`** + +* Change `if (!Scenes.can_read_scene?(enactor, scene))` to `if (!Scenes.can_join_scene?(enactor, scene))` + +**In `plugins\scenes\commands\scene_join_cmd.rb`** + +* Change `can_join = Scenes.can_read_scene?(enactor, scene) || !scene.private_scene` to `can_join = Scenes.can_join_scene?(enactor, scene)` + +##Web API Files + +**In `plugins\scenes\helpers\web_data.rb`** + +* Under `can_edit: viewer && Scenes.can_edit_scene?(viewer, scene),` add `can_join: Scenes.can_join_scene?(viewer, scene),` + +**In `aresmush/plugins/scenes/public/scenes_api.rb`** + +* Change `self.start_scene(enactor, location, private_scene, scene_type, temp_room)` to `self.start_scene(enactor, location, private_scene, watchable_scene, scene_type, temp_room)` +* Under `private_scene: private_scene,` add `watchable_scene: watchable_scene,` + +**In `aresmush/plugins/scenes/templates/scenes_list_template.rb`** + +change the `def privacy` section to read: + + def privacy(scene) + if scene.private_scene + message = t('scenes.private') + color = "%xr" + elsif scene.watchable_scene + message = "Watchable" + color = "%xc" + else + message = t('scenes.open') + color = "%xg" + end + "#{color}#{message}%xn" + end + +**In `aresmush/plugins/scenes/web/create_scene_handler.rb`:** + +* Under `private_scene: completed ? false : (privacy == "Private"),` add `watchable_scene: completed ? false : (privacy == "Watchable"),` + +**In `aresmush/plugins/scenes/web/edit_scene_handler.rb`:** + +* Under `scene.update(private_scene: request.args[:privacy] == "Private")` add `scene.update(watchable_scene: request.args[:privacy] == "Watchable")` + +**In `aresmush/plugins/scenes/web/get_scene_handler.rb`:** + +* Change `privacy: scene.completed ? "Open" : (scene.private_scene ? "Private" : "Open"),` to `privacy: scene.completed ? "Open" : (scene.private_scene ? "Private" : (scene.watchable_scene ? "Watchable" : "Open")),` + +**In `aresmush/plugins/scenes/web/live_scenes_handler.rb`:** + +* Under `can_view: enactor && Scenes.can_read_scene?(enactor, s),` add `can_join: Scenes.can_join_scene?(enactor, s),` +* Under `is_private: s.private_scene,` add `is_watchable: s.watchable_scene,` + +## Where list + +**In `plugins\who\templates\where_template.rb`** + +* Under the `if (scene.private_scene)` section (line 74), add: + + `elsif (scene.watchable_scene)` + `append_to_group(groups['private'], room, name)` + +The whole section should read: + + elsif (scene) + if (scene.private_scene) + append_to_group(groups['private'], room, name) + elsif (scene.watchable_scene) + append_to_group(groups['private'], room, name) + else + append_to_group(groups['open'], room, name) + end + else + append_to_group(groups['private'], room, name) + end + +##Web Portal +**In `app\controllers\scene-create.js` AND in `app\controllers\scene-edit.js`** + +Change the scenePrivacyValues to read + + scenePrivacyValues: computed(function() { + return [ 'Open', 'Private', 'Watchable' ]; + }), + +In `app\templates\scenes-live.hbs` + +Change + + {{#if scene.is_private}} + Private + {{else}} + Open + {{/if}} + +to read + + {{#if scene.is_private}} + Private + {{else}} + {{#if scene.is_watchable}} + Watchable + {{else}} + Open + {{/if}} + {{/if}} + +AND + +Change the Join Scene button to read + + {{#if scene.can_join}} + + {{/if}} + + +**In `app\templates\components\live-scene-control.hbs`**, under the 'not isApproved' warning, add, + + {{else if (not scene.can_join)}} +
You can watch this scene, but cannot join it without an invitation.
+ + + + + +## Error message + +You'll probably want to change the `scene_is_private` message in the locale file to read `"That scene is private or watchable. You must get an invitation/meetme from one of the participants to join."` + +##Texting + +If you have the txt plugin installed, you'll want to also make changes here: + +**In `plugins\txt\commands\txt_send_cmd.rb`** + +* Line 58 should read `can_txt_scene = Scenes.can_join_scene?(enactor, scene)` + +**In `plugins\txt\web\add_txt_handler.rb`**, the access check (line 24) should be: + + if (!Scenes.can_join_scene?(enactor, scene)) + return { error: t('scenes.access_not_allowed') } + end From 08d96cbcb005a706e6ff8ab800a5226e7240e383 Mon Sep 17 00:00:00 2001 From: spiritlake <32268357+spiritlake@users.noreply.github.com> Date: Wed, 18 Dec 2019 22:16:48 -0500 Subject: [PATCH 2/3] Update README.md --- snippets/watchable-scenes/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/snippets/watchable-scenes/README.md b/snippets/watchable-scenes/README.md index f37af20c..5231c2a8 100644 --- a/snippets/watchable-scenes/README.md +++ b/snippets/watchable-scenes/README.md @@ -3,6 +3,7 @@ Watchable scenes are scenes which anyone can view on the portal (ie, watch), but Because it interacts heavily with the scene system, Watchable doesn't work well as a plug-in. You'll have to do some custom code in order to enable it. You can make the changes listed below in order to create Watchable scenes on your game. ##On game + **In `aresmush\plugins\scenes\public\scene.rb`** * add: `attribute :watchable_scene, :type => DataType::Boolean` From 5ae5c89cb098139831f91b4e643bb15094e10ca4 Mon Sep 17 00:00:00 2001 From: spiritlake <32268357+spiritlake@users.noreply.github.com> Date: Wed, 18 Dec 2019 22:47:08 -0500 Subject: [PATCH 3/3] Update README.md --- snippets/watchable-scenes/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/watchable-scenes/README.md b/snippets/watchable-scenes/README.md index 5231c2a8..35480d9b 100644 --- a/snippets/watchable-scenes/README.md +++ b/snippets/watchable-scenes/README.md @@ -2,7 +2,7 @@ Watchable scenes are scenes which anyone can view on the portal (ie, watch), but Because it interacts heavily with the scene system, Watchable doesn't work well as a plug-in. You'll have to do some custom code in order to enable it. You can make the changes listed below in order to create Watchable scenes on your game. -##On game +## On game **In `aresmush\plugins\scenes\public\scene.rb`** @@ -50,7 +50,7 @@ Because it interacts heavily with the scene system, Watchable doesn't work well * Change `can_join = Scenes.can_read_scene?(enactor, scene) || !scene.private_scene` to `can_join = Scenes.can_join_scene?(enactor, scene)` -##Web API Files +## Web API Files **In `plugins\scenes\helpers\web_data.rb`** @@ -119,7 +119,7 @@ The whole section should read: append_to_group(groups['private'], room, name) end -##Web Portal +## Web Portal **In `app\controllers\scene-create.js` AND in `app\controllers\scene-edit.js`** Change the scenePrivacyValues to read @@ -175,7 +175,7 @@ Change the Join Scene button to read You'll probably want to change the `scene_is_private` message in the locale file to read `"That scene is private or watchable. You must get an invitation/meetme from one of the participants to join."` -##Texting +## Texting If you have the txt plugin installed, you'll want to also make changes here: