Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added DenizenScript Language Support #5773

Merged
merged 5 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@
[submodule "vendor/grammars/data-weave-tmLanguage"]
path = vendor/grammars/data-weave-tmLanguage
url = https://github.com/mulesoft-labs/data-weave-tmLanguage
[submodule "vendor/grammars/denizenscript-grammar"]
path = vendor/grammars/denizenscript-grammar
url = https://github.com/BreadcrumbIsTaken/denizenscript-grammar.git
[submodule "vendor/grammars/desktop.tmbundle"]
path = vendor/grammars/desktop.tmbundle
url = https://github.com/Mailaender/desktop.tmbundle.git
Expand Down
2 changes: 2 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ vendor/grammars/dart-syntax-highlight:
- source.dart
vendor/grammars/data-weave-tmLanguage:
- source.data-weave
vendor/grammars/denizenscript-grammar:
- source.denizenscript
vendor/grammars/desktop.tmbundle:
- source.desktop
vendor/grammars/diff.tmbundle:
Expand Down
8 changes: 8 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,14 @@ DataWeave:
ace_mode: text
tm_scope: source.data-weave
language_id: 974514097
DenizenScript:
type: programming
color: "#FBEE96"
ace_mode: text
BreadcrumbIsTaken marked this conversation as resolved.
Show resolved Hide resolved
extensions:
- ".dsc"
BreadcrumbIsTaken marked this conversation as resolved.
Show resolved Hide resolved
tm_scope: source.denizenscript
language_id: 435000929
Dhall:
type: programming
color: "#dfafff"
Expand Down
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **Dafny:** [DafnyVSCode/Dafny-VSCode](https://github.com/DafnyVSCode/Dafny-VSCode)
- **Dart:** [dart-lang/dart-syntax-highlight](https://github.com/dart-lang/dart-syntax-highlight)
- **DataWeave:** [mulesoft-labs/data-weave-tmLanguage](https://github.com/mulesoft-labs/data-weave-tmLanguage)
- **DenizenScript:** [BreadcrumbIsTaken/denizenscript-grammar](https://github.com/BreadcrumbIsTaken/denizenscript-grammar)
- **Dhall:** [atom-haskell/language-haskell](https://github.com/atom-haskell/language-haskell)
- **Diff:** [textmate/diff.tmbundle](https://github.com/textmate/diff.tmbundle)
- **Dockerfile:** [asbjornenge/Docker.tmbundle](https://github.com/asbjornenge/Docker.tmbundle)
Expand Down
83 changes: 83 additions & 0 deletions vendor/grammars/DenizenScript/sample1.dsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Main faction task.
faction:
type: task
script:
- narrate Claim! format:faction_action_format
edit:
- narrate Edit! format:faction_action_format
invite:
- narrate Invite! format:faction_action_format
settings:
- narrate Settings! format:faction_action_format
transfer_ownership:
- if !<player.has_flag[waiting_for_owner_transfer_request_acceptance]>:
- inventory open d:faction_action_danger_zone_transfer_ownership_player_list_inventory
- else:
- narrate "You are still waiting for <player.flag[waiting_for_owner_transfer_request_acceptance].name> to accept the ownership!" format:faction_action_format
create:
- if !<server.has_flag[factions]>:
- flag server factions:<map[]>
- flag server "factions.all claims:<list[]>"

- flag server FACTION_IDS:++

- define FACTION_UUID faction_<server.flag[FACTION_IDS]>

- flag player FACTION:<[FACTION_UUID]>

- definemap default_faction_data:
owner: <player.uuid>
members: <list[<player.uuid>]>
name: <player.name>'s Faction
settings:
permissions:
# This is just place holder stuff ;0
- OwnersGetAllPerms
- MembersGetBasicPerms
- OutsidersDoNotGetPerms
color: <white>
display name: <white><player.name>'s Faction
rivalries: <list[]>
allies: <list[]>
power: 100
claims: <list[<player.location.chunk.cuboid>]>

- note <player.location.chunk.cuboid> as:faction_cuboid_<[FACTION_UUID]>
- flag server "factions.all claims:->:<player.location.chunk.cuboid>"
- flag server factions.<[FACTION_UUID]>:<[default_faction_data]>

- narrate "<green>Faction created! Check it out by using '/faction'!" format:faction_action_format
delete:
- define FACTION_UUID <player.flag[FACTION]>

- define members <[FACTION_UUID].proc[get_members]>
- foreach <[members]> as:m:
- flag <player[<[m]>]> faction:!

- foreach <proc[get_all_claims]> as:cl:
- flag server "factions.all claims:<-:<[cl]>"

- flag server factions:<-:<[FACTION_UUID]>

- narrate "<&[success]>Successfully deleted the faction!" format:faction_action_format
leave:
- define faction <player.flag[faction]>
- if <player.uuid> == <[faction].proc[get_owner]>:
- narrate "Sorry, but you are going to have to tranfer ownership of your faction before you can leave it. You can do so in the <red>Danger Zone<reset> section of the Faction Action Inventory. (<bold>/f<reset>)" format:faction_action_format
- stop
- if <[faction].proc[get_members]> == <list[<player.uuid>]>:
- narrate "You have successfully left the faction." format:faction_action_format
- inject faction.delete
wipe:
- foreach <server.offline_players.include[<server.online_players>]> as:p:
- if <[p].has_flag[FACTION]>:
- flag <[p]> FACTION:!
- foreach <proc[get_factions]> as:i:
- flag server factions:<-:<[i]>
- flag server "factions:<-:all claims"
- flag server factions:!
- foreach <server.notes[cuboids]> as:n:
- if <[n].advanced_matches_text[*faction_cuboid_*]>:
- note remove as:<[n].note_name>
- flag server FACTION_IDS:-1
- narrate Wiped. format:faction_action_format
77 changes: 77 additions & 0 deletions vendor/grammars/DenizenScript/sample2.dsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
player_chooses_new_owner_of_faction:
type: world
events:
on player clicks item in faction_action_danger_zone_transfer_ownership_player_list_inventory:
- define new_owner <context.item.flag[player_id]>

- define faction <player.proc[get_player_faction]>

- define faction_owner <player[<proc[get_owner].context[<[faction]>]>]>

- if !<player.has_flag[has_ownership_offer]>:
- if <[new_owner].has_flag[faction]>:
- if <[new_owner].uuid> == <[faction_owner].uuid>:
- narrate "<&color[#1569EA]>You can't transfer ownership to yourself! You are already the owner." format:faction_action_format
- inventory close
- flag player waiting_for_owner_transfer_request_acceptance:<[new_owner]> expire:10m
- inventory close
- else:
- flag player waiting_for_owner_transfer_request_acceptance:<[new_owner]> expire:10m
- inventory close

- flag <[new_owner]> has_ownership_offer:<[faction]> expire:10m
- runlater out_of_time_for_transfer delay:5s def.new_owner:<[new_owner]>
- narrate targets:<[new_owner]> "<green><player.name>, wants you to become the new owner of their faction<reset>, <[faction].proc[get_display_name]>. <green>To accept, please issue the command<reset>: <yellow>accept<reset>. <green>To deny, please issue the command<reset>: <yellow>deny <green>or, do nothing. This request will expire in 10 minutes." format:faction_action_format
- else:
- narrate "<[new_owner].name> already has a valid offer. Please try again soon." format:faction_action_format

player_accepts_or_denies_offer_to_be_new_owner:
type: world
events:
on player chats flagged:has_ownership_offer:
- define old_owner <player[<player.flag[has_ownership_offer].proc[get_owner]>]>
- define faction <player.flag[has_ownership_offer]>
- if <context.message.to_lowercase> == accept:
- determine passively cancelled

# Removes both the old owner and new owner from their factions to avoid any errors.
- if <[old_owner].has_flag[faction]>:
- flag server factions.<[old_owner].flag[faction]>.members:<-:<[old_owner].uuid>
- flag <[old_owner]> faction:!
- if <player.has_flag[faction]>:
- flag server factions.<player.flag[faction]>.members:<-:<player.uuid>
- flag player faction:!

- flag server factions.<[faction]>.owner:<player.uuid>
- flag server factions.<[faction]>.members:->:<player.uuid>
- flag player FACTION:<[faction]>

# Re-adds the owner to the faction.
- flag server factions.<[faction]>.members:->:<[old_owner].uuid>
- flag <[old_owner]> faction:<[faction]>

- flag <player> has_ownership_offer:!
- flag <[old_owner]> waiting_for_owner_transfer_request_acceptance:!

- narrate "You are now the owner of <player.flag[has_ownership_offer].proc[get_display_name]>!" format:faction_action_format
- narrate "<player.name> has accepted the offer to become owner! You are now no longer the owner of <[faction].proc[get_display_name]>, but are now a regular member." targets:<[old_owner]> format:faction_action_format

- else if <context.message.to_lowercase> == deny:
- determine passively cancelled

- flag <player> has_ownership_offer:!
- flag <[old_owner]> waiting_for_owner_transfer_request_acceptance:!

- narrate "You have denyed the offer." format:faction_action_format
- narrate "<player.name> <red>has declined your offer to become owner of your faction." targets:<[old_owner]> format:faction_action_format
- else:
- determine cancelled

out_of_time_for_transfer:
type: task
definitions: new_owner
script:
- if <player.has_flag[has_ownership_offer]>:
- narrate "Sorry, the ownership offer has expired." targets:<[new_owner]> format:faction_action_format
- else:
- stop
1 change: 1 addition & 0 deletions vendor/grammars/denizenscript-grammar
Submodule denizenscript-grammar added at 4f565e
46 changes: 46 additions & 0 deletions vendor/licenses/git_submodule/denizenscript-grammar.dep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: denizenscript-grammar
version: 4f565e54f3bd3a0cc5bc3ddba480be159b7bd473
type: git_submodule
homepage: https://github.com/BreadcrumbIsTaken/denizenscript-grammar.git
license: mit
licenses:
- sources: LICENSE.md
text: |
Copyright (c) 2022 Breadcrumb (https://breadcrumb.fun)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.md
text: "<details>\n <summary>MIT License</summary>\n \n Copyright (c) 2022
Breadcrumb (https://breadcrumb.fun)\n \n Permission is hereby granted, free
of charge, to any person obtaining a copy\n of this software and associated
documentation files (the \"Software\"), to deal\n in the Software without restriction,
including without limitation the rights\n to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell\n copies of the Software, and to permit
persons to whom the Software is\n furnished to do so, subject to the following
conditions:\n\n The above copyright notice and this permission notice shall
be included in all\n copies or substantial portions of the Software.\n\n THE
SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR
A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n</details>"
notices: []