Commit 3917d9fd authored by Tommy Ang's avatar Tommy Ang 🤣

Implement explosion flag and PR interact flag

parent 0e3284c0
......@@ -68,8 +68,8 @@ command /potatotown <text="help"> [<text>]:
message "&e/ptown flag <flag> - &aToggle Flag Option"
message "&e&oAvailable flags - &a&oFire, ff "
message ""
message "&aGreen &e- Protection Enabled"
message "&cRed &e- Protection Disabled"
message "&aGreen &e- Action allowed"
message "&cRed &e- Action disabled"
message "&e/ptown help 5 &aFor Next Page"
else if arg 2 is "5":
message "&6-------------------Potato Town (&e5&6/&e5&6)-------------------"
......@@ -187,35 +187,49 @@ command /potatotown <text="help"> [<text>]:
#message "Nation: "
set {_fire} to {ptown.%{_town}%.flag::fire}
if {_fire} is not set:
set {_fire} to "&aIgnition"
set {_fire} to "&cIgnition"
if {_fire} is "true":
set {_fire} to "&aIgnition"
if {_fire} is "false":
set {_fire} to "&cIgnition"
if {_fire} is "false":
set {_fire} to "&aIgnition"
set {_friendlyfire} to {ptown.%{_town}%.flag::friendlyfire}
if {_friendlyfire} is not set:
set {_friendlyfire} to "&aFriendlyFire"
set {_friendlyfire} to "&cFriendlyFire"
if {_friendlyfire} is "true":
set {_friendlyfire} to "&aFriendlyFire"
if {_friendlyfire} is "false":
set {_friendlyfire} to "&cFriendlyFire"
message "&6Flag: %{_fire}% &f| %{_friendlyfire}%"
if {_friendlyfire} is "false":
set {_friendlyfire} to "&aFriendlyFire"
set {_explosion} to {ptown.%{_town}%.flag::explosion}
if {_explosion} is not set:
set {_explosion} to "&cExplosion"
if {_explosion} is "true":
set {_explosion} to "&cExplosion"
if {_explosion} is "false":
set {_explosion} to "&aExplosion"
message "&6Flag: %{_fire}% &f| %{_friendlyfire}% &f| %{_explosion}%"
set {_prbreak} to {ptown.%{_town}%.prflag::break}
set {_prbuild} to {ptown.%{_town}%.prflag::build}
set {_printeract} to {ptown.%{_town}%.prflag::interact}
if {_prbreak} is not set:
set {_prbreak} to "&aBreak"
if {_prbreak} is "true":
set {_prbreak} to "&aBreak"
if {_prbreak} is "false":
set {_prbreak} to "&cBreak"
else if {_prbreak} is "true":
set {_prbreak} to "&cBreak"
else if {_prbreak} is "false":
set {_prbreak} to "&aBreak"
if {_prbuild} is not set:
set {_prbuild} to "&aBuild"
if {_prbuild} is "true":
set {_prbuild} to "&aBuild"
if {_prbuild} is "false":
set {_prbuild} to "&cBuild"
else if {_prbuild} is "true":
set {_prbuild} to "&cBuild"
else if {_prbuild} is "false":
set {_prbuild} to "&aBuild"
if {_printeract} is not set:
set {_printeract} to "&cInteract"
else if {_printeract} is "true":
set {_printeract} to "&cInteract"
else if {_printeract} is "false":
set {_printeract} to "&aInteract"
#message "Nation Flag: Build | Break"
message "&6PR Flag: %{_prbuild}% &f| %{_prbreak}%"
message "&6PR Flag: %{_prbuild}% &f| %{_prbreak}% &f| %{_printeract}%"
set {_player} to {ptown.%{_town}%.owner}
set {_player} to {_player} parsed as offline player
if {_player} is online:
......@@ -624,7 +638,7 @@ command /potatotown <text="help"> [<text>]:
set {ptown.%{_town}%.prflag::build} to "true"
message "{@Prefix} &cProtection for PR Building has been enabled, your PR members are not allowed to build in your town."
stop
if arg 2 is "break":
else if arg 2 is "break":
set {_town} to "%{ptown.%player%}%"
if "%{ptown.%{_town}%.owner}%" is not player's name:
if player's current language is "zh_cn" or "zh_tw":
......@@ -644,8 +658,28 @@ command /potatotown <text="help"> [<text>]:
set {ptown.%{_town}%.prflag::break} to "true"
message "{@Prefix} &cProtection for PR Breaking has been enabled, your PR members are not allowed to break in your town."
stop
else if arg 2 is "interact":
set {_town} to "%{ptown.%player%}%"
if "%{ptown.%{_town}%.owner}%" is not player's name:
if player's current language is "zh_cn" or "zh_tw":
message "{@Prefix} &c您不这个小镇的主人!"
else:
message "{@Prefix} &cYou are not the owner of this town!"
stop
if {ptown.%{_town}%.prflag::interact} is not set:
set {ptown.%{_town}%.prflag::interact} to "false"
message "{@Prefix} &aProtection for PR Interaction has been disabled, your PR members can now interact in your town."
stop
if {ptown.%{_town}%.prflag::interact} is "true":
set {ptown.%{_town}%.prflag::interact} to "false"
message "{@Prefix} &aProtection for PR Interaction has been disabled, your PR members can now interact in your town."
stop
if {ptown.%{_town}%.prflag::interact} is "false":
set {ptown.%{_town}%.prflag::interact} to "true"
message "{@Prefix} &cProtection for PR Interaction has been enabled, your PR members are not allowed to interact in your town."
stop
else:
message "{@Prefix} &cPlease specify a flag to toggle. (build/break)"
message "{@Prefix} &cPlease specify a flag to toggle. (build/break/interact)"
if arg 1 is "join":
if arg 2 is not set:
if player's current language is "zh_cn" or "zh_tw":
......@@ -892,7 +926,7 @@ command /potatotown <text="help"> [<text>]:
set {ptown.%{_town}%.flag::fire} to "true"
message "{@Prefix} &2Fire protection has been enabled"
stop
if arg 2 is "ff":
else if arg 2 is "ff":
set {_town} to "%{ptown.%player%}%"
loop {ptown.%{_town}%.modlist::*}:
if "%loop-value%" is player's name:
......@@ -906,7 +940,7 @@ command /potatotown <text="help"> [<text>]:
stop
if {ptown.%{_town}%.flag::friendlyfire} is "false":
set {ptown.%{_town}%.flag::friendlyfire} to "true"
message "{@Prefix} &2FriendlyFire protection has been disabled"
message "{@Prefix} &2FriendlyFire protection has been enabled"
stop
if "%{ptown.%{_town}%.owner}%" is not player's name:
if player's current language is "zh_cn" or "zh_tw":
......@@ -924,8 +958,44 @@ command /potatotown <text="help"> [<text>]:
stop
if {ptown.%{_town}%.flag::friendlyfire} is "false":
set {ptown.%{_town}%.flag::friendlyfire} to "true"
message "{@Prefix} &2FriendlyFire protection has been disabled"
stop
message "{@Prefix} &2FriendlyFire protection has been enabled"
stop
else if arg 2 is "explosion":
set {_town} to "%{ptown.%player%}%"
loop {ptown.%{_town}%.modlist::*}:
if "%loop-value%" is player's name:
if {ptown.%{_town}%.flag::explosion} is not set:
set {ptown.%{_town}%.flag::explosion} to "false"
message "{@Prefix} &cExplosion protection has been disabled"
stop
if {ptown.%{_town}%.flag::explosion} is "true":
set {ptown.%{_town}%.flag::explosion} to "false"
message "{@Prefix} &cExplosion protection has been disabled"
stop
if {ptown.%{_town}%.flag::explosion} is "false":
set {ptown.%{_town}%.flag::explosion} to "true"
message "{@Prefix} &2Explosion protection has been enabled"
stop
if "%{ptown.%{_town}%.owner}%" is not player's name:
if player's current language is "zh_cn" or "zh_tw":
message "{@Prefix} &c您不这个小镇的主人!"
else:
message "{@Prefix} &cYou are not the owner of this town!"
stop
if {ptown.%{_town}%.flag::explosion} is not set:
set {ptown.%{_town}%.flag::explosion} to "false"
message "{@Prefix} &cExplosion protection has been disabled"
stop
if {ptown.%{_town}%.flag::explosion} is "true":
set {ptown.%{_town}%.flag::explosion} to "false"
message "{@Prefix} &cExplosion protection has been disabled"
stop
if {ptown.%{_town}%.flag::explosion} is "false":
set {ptown.%{_town}%.flag::explosion} to "true"
message "{@Prefix} &2Explosion protection has been enabled"
stop
else:
message "{@Prefix} &cPlease specify a flag to toggle. (build/break/explosion)"
if arg 1 is "unclaim":
set {_town} to "%{ptown.%player%}%"
if {ptown.%player%} is not set:
......@@ -1364,6 +1434,9 @@ function hasPermission(chunk: chunk, player: player, event: text) :: boolean:
else if {_event} is "build":
if {ptown.%{_town}%.prflag::build} is "false":
return true
else if {_event} is "interact":
if {ptown.%{_town}%.prflag::interact} is "false":
return true
# Townless Player
if {ptown.%{_player}%} is not set:
if {_town} is set:
......@@ -1587,9 +1660,13 @@ on PlayerInteractEvent:
on explode:
if {ptownlist.chunk::%chunk at event-location%} is "Safezone":
cancel event
if "%entity%" contains "creeper":
if "%entity%" contains "creeper" or "TNT":
if {ptownlist.chunk::%chunk at event-location%} is set:
cancel event
set {_town} to {ptownlist.chunk::%chunk at event-location%}
if {ptown.%{_town}%.flag::explosion} is not set:
cancel event
else if {ptown.%{_town}%.flag::explosion} is "true":
cancel event
# Cancel explosion if there is town within 1 radius of explosion
set {_mapX} to 1
set {_mapY} to 1
......@@ -1601,8 +1678,12 @@ on explode:
set {_block} to block {_X} west of {_block}
set {_chunk} to chunk at {_block}
if {ptownlist.chunk::%{_chunk}%} is set:
cancel event
stop
set {_town} to {ptownlist.chunk::%{_chunk}%}
# Explosion flag
if {ptown.%{_town}%.flag::explosion} is not set:
cancel event
else if {ptown.%{_town}%.flag::explosion} is "true":
cancel event
subtract 1 from {_mapX}
subtract 1 from {_mapY}
set {_mapX} to 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment