|
| 1 | + |
| 2 | +AUTHOR = 'ekimekim' |
| 3 | + |
| 4 | +DESCRIPTION = """Newly created zones must be submitted for op approval. |
| 5 | +Ops gain commands: |
| 6 | + /zone op help |
| 7 | + /zone op wool ZONE - Paint 10x10x10 area about and below op in green woll for requested zone, red wool other zone, yellow if both. |
| 8 | + /zone op confirm ZONE |
| 9 | +""" |
| 10 | + |
| 11 | +import zones |
| 12 | +from player_cmd import register |
| 13 | +from helpers import ops |
| 14 | + |
| 15 | +def set_confirm(zone): |
| 16 | + zone['confirmed'] = False |
| 17 | + |
| 18 | +def on_start(): |
| 19 | + zones.new_zone_hooks.append(set_confirm) |
| 20 | + register("/zone op help", ophelp) |
| 21 | + register("/zone op wool (.*)", woolzone) |
| 22 | + register("/zone op confirm (.*)", confirmzone) |
| 23 | + |
| 24 | +def ops_only(fn): |
| 25 | + def wrapped_fn(message, user, *args): |
| 26 | + if user not in ops(): |
| 27 | + return False |
| 28 | + else: |
| 29 | + return fn(message, user, *args) |
| 30 | + |
| 31 | +@ops_only |
| 32 | +def ophelp(message, user): |
| 33 | + tell(user, "Note that unlike /zone commands, zone names are taken verbatim (no quotes).\n" |
| 34 | + "/zone op help - Obvious.\n" |
| 35 | + "/zone op wool <zone> - 10x10x10 cube below player highlighted as follows:\n" |
| 36 | + "__ green: In given zone.\n" |
| 37 | + "__ red: In zone besides one given.\n" |
| 38 | + "__ yellow: In given zone AND at least one other.\n" |
| 39 | + "__ You will need to log out/in to reverse changes.\n" |
| 40 | + "/zone op confirm <zone> - Confirm zone." |
| 41 | + |
| 42 | + |
| 43 | +@ops_only |
| 44 | +def zoneconfirm(message, user, name): |
| 45 | + if name not in zones.get_zones(): |
| 46 | + tell(user, "Zone does not exist.") |
| 47 | + return |
| 48 | + zones.get_zones()['confirmed'] = True |
| 49 | + |
| 50 | + |
| 51 | +@ops_only |
| 52 | +def zonewool(message, user, name): |
| 53 | + pass # TODO |
0 commit comments