Skip to content
This repository was archived by the owner on Apr 27, 2019. It is now read-only.

Commit 1679afa

Browse files
author
El Sif
committed
merge master
2 parents 10480db + 5f68517 commit 1679afa

24 files changed

Lines changed: 1147 additions & 114 deletions

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# StarryPy
22

3-
StarryPy is Twisted-based plugin-driven Starbound server wrapper. It is currently
4-
in beta.
5-
6-
**NOTE! Player warping is currently __broken__**
3+
StarryPy is Twisted-based plugin-driven Starbound server wrapper. It is currently in beta.
74

85
## Features
96

@@ -17,13 +14,13 @@ With the built-in plugins (which are removable):
1714
* Join/quit announcements.
1815
* And more.
1916

20-
## Version 1.6 is here!
17+
## Version 1.7 is here!
2118

22-
With this most recent release, we are compatible with the current release of Starbound (Upbeat Giraffe). Any bugs found in the process, please open an issue ticket, so we can squash them as quickly as possible.
19+
With this most recent release, we are compatible with the current release of Starbound (Pleased Giraffe - Protocol 691). Any bugs found in the process, please open an issue ticket, so we can squash them as quickly as possible.
2320

2421
## Upgrading from older versions of StarryPy
2522

26-
StarryPy 1.5 is **NOT** backwards compatible with older versions. As unfortunate as it is, we suggest wiping your database, and starting fresh. It will save a lot of headaches in the long run.
23+
This version of StarryPy should be completely compatible with all version back to 1.5. If you run into any problems, please let us know.
2724

2825
## Installation
2926

base_plugin.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ def on_environment_update(self, data):
9494
def on_entity_interact_result(self, data):
9595
return True
9696

97+
def on_update_tile_protection(self, data):
98+
return True
99+
97100
def on_modify_tile_list(self, data):
98101
return True
99102

@@ -166,7 +169,7 @@ def on_status_effect_request(self, data):
166169
def on_update_world_properties(self, data):
167170
return True
168171

169-
def on_heartbeat(self, data):
172+
def on_step_update(self, data):
170173
return True
171174

172175
def on_connect_success(self, data):
@@ -256,6 +259,9 @@ def after_environment_update(self, data):
256259
def after_entity_interact_result(self, data):
257260
return True
258261

262+
def after_update_tile_protection(self, data):
263+
return True
264+
259265
def after_modify_tile_list(self, data):
260266
return True
261267

@@ -328,7 +334,7 @@ def after_status_effect_request(self, data):
328334
def after_update_world_properties(self, data):
329335
return True
330336

331-
def after_heartbeat(self, data):
337+
def after_step_update(self, data):
332338
return True
333339

334340
def after_connect_success(self, data):

packets/packet_types.py

Lines changed: 75 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ class Packets(IntEnum):
6363
HIT_REQUEST = 50
6464
DAMAGE_REQUEST = 51
6565
DAMAGE_NOTIFICATION = 52
66-
CALL_SCRIPTED_ENTITY = 53
67-
UPDATE_WORLD_PROPERTIES = 54
68-
HEARTBEAT = 55
66+
ENTITY_MESSAGE = 53
67+
ENTITY_MESSAGE_RESPONSE = 54
68+
UPDATE_WORLD_PROPERTIES = 55
69+
STEP_UPDATE = 56
6970

7071

7172
class WarpActionType(IntEnum):
@@ -151,8 +152,8 @@ def _decode(self, obj, context):
151152
SBInt32("satellite"))
152153

153154
warp_action = lambda name="warp_action": Struct(name,
154-
Byte("type"),
155-
Switch("warp_action_type", lambda ctx: ctx["type"],
155+
Byte("warp_type"),
156+
Switch("warp_action_type", lambda ctx: ctx["warp_type"],
156157
{
157158
1 : LazyBound("next", lambda: warp_world),
158159
2 : HexAdapter(Field("uuid", 16)),
@@ -206,6 +207,30 @@ def _decode(self, obj, context):
206207
HexAdapter(Field("instance", 16))
207208
)
208209

210+
211+
warp_touniqueworld_write = lambda name="warp_touniqueworld_write": Struct(name,
212+
Byte("warp_type"),
213+
Byte("world_type"),
214+
star_string("unique_world_name"),
215+
Byte("has_position"))
216+
217+
warp_toplayerworld_write = lambda name="warp_toplayerworld_write": Struct(name,
218+
Byte("warp_type"),
219+
Byte("world_type"),
220+
HexAdapter(Field("uuid", 16)),
221+
Byte("has_position"))
222+
223+
warp_toplayer_write = lambda name="warp_toplayer_write": Struct(name,
224+
Byte("warp_type"),
225+
HexAdapter(Field("uuid", 16))
226+
)
227+
228+
warp_toalias_write = lambda name="warp_toalias_write": Struct(name,
229+
Byte("warp_type"),
230+
SBInt32("alias")
231+
)
232+
233+
209234
projectile = DictVariant("projectile")
210235

211236
# ---------------------------------------
@@ -299,45 +324,40 @@ def _decode(self, obj, context):
299324
send_mode=send_mode))
300325

301326
# (12) - PlayerWarp
302-
#player_warp = lambda name="player_warp": Struct(name,
303-
# Enum(UBInt8("warp_type"),
304-
# WARP_TO=0,
305-
# WARP_RETURN=1,
306-
# WARP_TO_HOME_WORLD=2,
307-
# WARP_TO_ORBITED_WORLD=3,
308-
# WARP_TO_OWN_SHIP=4),
309-
# WarpVariant("world_id"))
310327
player_warp = lambda name="player_warp": Struct(name,
311328
warp_action())
312329

313-
# (8) - PlayerWarpResult
314-
player_warp_result = lambda name="player_warp_result": Struct(name,
315-
Flag("success"),
316-
warp_action(),
317-
Flag("warp_action_invalid"))
318-
319-
#player_warp_write = lambda t, world_id: player_warp().build(
320-
# Container(
321-
# warp_type=t,
322-
# world_id=world_id))
323-
324-
player_warp_toworld_write = lambda world_type, destination: player_warp().build(
330+
player_warp_touniqueworld_write = lambda destination: warp_touniqueworld_write().build(
325331
Container(
326-
warp_action_type=1,
327-
world_type=world_type,
328-
unique_world_name=destination
332+
warp_type=1,
333+
world_type=1,
334+
unique_world_name=destination,
335+
has_position=0
329336
))
330-
player_warp_toplayer_write = lambda uuid: player_warp().build(
337+
player_warp_toplayerworld_write = lambda destination: warp_toplayerworld_write().build(
331338
Container(
332-
warp_action_type=2,
339+
warp_type=1,
340+
world_type=3,
341+
uuid=destination,
342+
has_position=0
343+
))
344+
player_warp_toplayer_write = lambda uuid: warp_toplayer_write().build(
345+
Container(
346+
warp_type=2,
333347
uuid=uuid
334348
))
335-
player_warp_toalias_write = lambda alias: player_warp().build(
349+
player_warp_toalias_write = lambda alias: warp_toalias_write().build(
336350
Container(
337-
warp_action_type=3,
351+
warp_type=3,
338352
alias=alias
339353
))
340354

355+
# (8) - PlayerWarpResult
356+
player_warp_result = lambda name="player_warp_result": Struct(name,
357+
Flag("success"),
358+
warp_action(),
359+
Flag("warp_action_invalid"))
360+
341361
# (13) - FlyShip
342362
fly_ship = lambda name="fly_ship": Struct(name,
343363
celestial_coordinate())
@@ -368,6 +388,9 @@ def _decode(self, obj, context):
368388
If(lambda ctx: ctx["a"] == 0,
369389
Struct("junk",
370390
Padding(1),
391+
Peek(Byte("b")),
392+
If(lambda ctx: ctx["b"] == 0,
393+
Padding(1)),
371394
VLQ("extra_length"))),
372395
If(lambda ctx: ctx["a"] > 8,
373396
Struct("junk2",
@@ -436,6 +459,22 @@ def _decode(self, obj, context):
436459
Byte("variant_type"),
437460
GreedyRange(StarByteArray("item_description")))
438461

462+
# (29) - UpdateTileProtection
463+
update_tile_protection = lambda name="update_tile_protection": Struct(name,
464+
GreedyRange(
465+
Struct("dungeon_block",
466+
UBInt16("dungeon_id"),
467+
Flag("is_protected"))))
468+
469+
update_tile_protection_writer = lambda name="update_tile_protection_writer": Struct(name,
470+
UBInt16("dungeon_id"),
471+
Byte("is_protected"))
472+
473+
update_tile_protection_write = lambda dungeon_id, is_protected: update_tile_protection_writer().build(
474+
Container(
475+
dungeon_id=dungeon_id,
476+
is_protected=is_protected))
477+
439478
# (36) - SpawnEntity
440479
spawn_entity = lambda name="spawn_entity": Struct(name,
441480
GreedyRange(
@@ -507,7 +546,7 @@ def _decode(self, obj, context):
507546
star_string("target_material"),
508547
Flag("killed"))
509548

510-
# (54) - UpdateWorldProperties
549+
# (55) - UpdateWorldProperties
511550
update_world_properties = lambda name="world_properties": Struct(name,
512551
UBInt8("count"),
513552
Array(lambda ctx: ctx.count,
@@ -520,6 +559,6 @@ def _decode(self, obj, context):
520559
count=len(dictionary),
521560
properties=[Container(key=k, value=Container(type="SVLQ", data=v)) for k, v in dictionary.items()]))
522561

523-
# (55) - Heartbeat
524-
heartbeat = lambda name="heartbeat": Struct(name,
525-
VLQ("remote_step"))
562+
# (56) - StepUpdate
563+
step_update = lambda name="step_update": Struct(name,
564+
VLQ("remote_step"))

plugins/announcer_plugin/announcer_plugin.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,9 @@ def activate(self):
1212
super(Announcer, self).activate()
1313

1414
def after_connect_success(self, data):
15-
try:
16-
c = connect_success().parse(data.data)
17-
if c.success:
18-
self.factory.broadcast(
19-
self.protocol.player.colored_name(self.config.colors) + " logged in.", 0, "Announcer")
20-
except AttributeError:
21-
return
22-
except:
23-
self.logger.exception("Unknown error in after_connect_success.")
24-
return
15+
c = connect_success().parse(data.data)
16+
self.factory.broadcast(self.protocol.player.colored_name(self.config.colors) + " logged in.", 0, "Announcer")
2517

2618
def on_client_disconnect_request(self, data):
2719
if self.protocol.player is not None:
28-
self.factory.broadcast(self.protocol.player.colored_name(self.config.colors) + " logged out.", 0,
29-
"Announcer")
20+
self.factory.broadcast(self.protocol.player.colored_name(self.config.colors) + " logged out.", 0, "Announcer")

plugins/backups_plugin/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# StarryPy Planetary Backup System
2+
---
3+
4+
A StarryPy module for managing automated planet backups.
5+
6+
## Contents
7+
8+
- `backups_plugin.py` - The StarryPy plugin for managing planetary backups
9+
- `backuper.py` - The file-system script for implementing automated backups
10+
- `database.py` - Library file for handling connecting and managing the backups database.
11+
- `__init__.py` - Standard python junk.
12+
13+
## In-game Commands
14+
15+
All the following are sub-commands for the master `/backup` command. Hence, your command might look like:
16+
```
17+
/backup add Kharidiron home_planet
18+
```
19+
20+
- `help` - Shows the basic help information
21+
- `add` - Adds a planet to the backups system. Requires an owner and a planet nick-name. Additionally, you must be standing on the planet to-be-backed-up.
22+
- `drop` - Removes a planet from the backups system. Requires an owner and a planet nick-name.
23+
- `manual` - Create a manual backup of a planet. Useful if you just completed a big project. You must be standing on the planet to use it, or you must supply the owner and the planet name.
24+
- `restore` - Restore a planet from a backup. You must provide an owner, a planet name, and a valid backup timestamp of the form `yyyy-mm-ddThh:mm`. That is a capital T in between. Also, no one should be on the planet's surface when the restore is attempted, as the planet file needs to be unlocked in order for the restore to work.
25+
- `enable` - Enable a planet's backups in the automated backup system. An owner and planet name must be provided.
26+
- `disable` - Disable a planet's backups in the automated backup system. An owner and planet name must be provided. This does not delete the planet, it simply turns off the automated backup.
27+
- `list` - Show all planets being backed up. If a name is provided, list all backups for that particular user. The users themselves can use this command to see what backups they own (but no one else's).
28+
- `status` - The status of a particular planet's backups, including all available timestamps. Either the owner and planet name must be provided, or you must be standing on the planet to use.
29+
30+
## Notes
31+
32+
### Windows...
33+
This script collecting was designed for Unix style systems. I do not plan to translate this for Windows systems, since the Windows OS enforces hard file locking, preventing the ability to restore planets gracefully. Sorry folks.
34+
35+
### Crontab...
36+
In order to make use of the automated backup system, you will need to do two things:
37+
38+
1. Setup a crontab entry to run the script at a regular interval. Here is a copy of mine:
39+
```
40+
0 */4 * * * /home/starbound/Starbound/StarryPy/plugins/backups_plugin/backuper.py
41+
```
42+
This runs the backup process once ever four hours, starting at midnight.
43+
44+
2. Edit the file `backuper.py` and set the `UNIVERSE_PATH` variable to point to the location of your Starbound universe directory. Also consider editing the `NUM_TO_KEEP` value to what seems appropriate for your storage and environment. At one backup every four hours, that is six backups a day... or 42 backups a week. Choose what you deem fit.

plugins/backups_plugin/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from backups_plugin import BackupsPlugin

0 commit comments

Comments
 (0)