The rowing boat: seagrass at the tide line and resin from pines; rope, pitch, and a boat at the workbench (driftwood, rope, pitch, nails); tied up at a berth of its own at the end of the pier, one each, saved; Set sail needs the ship's compass and the Highlands aren't charted yet; online too
This commit is contained in:
@@ -37,6 +37,11 @@ static func build(key: String) -> ArrayMesh:
|
||||
match key:
|
||||
"stick": m = _stick()
|
||||
"driftwood": m = _driftwood()
|
||||
"seagrass": m = _seagrass()
|
||||
"rope": m = _rope()
|
||||
"pine_resin": m = _pine_resin()
|
||||
"pitch": m = _pitch()
|
||||
"rowing_boat": m = _rowing_boat()
|
||||
"treasure_map": m = _treasure_map()
|
||||
"ship_compass": m = _ship_compass()
|
||||
"spyglass": m = _spyglass()
|
||||
@@ -203,6 +208,83 @@ static func _driftwood() -> ArrayMesh:
|
||||
P._cylinder(st, Vector3(0.1, 0.09, 0.05), Vector3(0.22, 0.12, 0.24), 0.03, 0.015, 5, GREY, r)
|
||||
return P._commit(st)
|
||||
|
||||
## A tangle of long, flat ribbons of seagrass.
|
||||
static func _seagrass() -> ArrayMesh:
|
||||
var st := P._begin()
|
||||
var r := _rng(45)
|
||||
for i in range(6):
|
||||
var a := r.randf() * TAU
|
||||
var col := Color(0.28, 0.42, 0.2).lerp(Color(0.5, 0.48, 0.25), r.randf())
|
||||
_box(st, Vector3(r.randf_range(-0.03, 0.03), 0.01 + i * 0.006, r.randf_range(-0.03, 0.03)), Vector3(0.03, 0.006, 0.38),
|
||||
col, Basis(Vector3.UP, a))
|
||||
return P._commit(st)
|
||||
|
||||
## A coil of seagrass rope.
|
||||
static func _rope() -> ArrayMesh:
|
||||
var st := P._begin()
|
||||
var r := _rng(47)
|
||||
const ROPE := Color(0.6, 0.55, 0.36)
|
||||
var n := 12
|
||||
for k in range(2):
|
||||
for i in range(n):
|
||||
var a0 := TAU * i / n
|
||||
var a1 := TAU * (i + 1) / n
|
||||
var rr := 0.1 - k * 0.035
|
||||
P._cylinder(st, Vector3(cos(a0) * rr, 0.025 + k * 0.03, sin(a0) * rr), Vector3(cos(a1) * rr, 0.025 + k * 0.03, sin(a1) * rr),
|
||||
0.02, 0.02, 5, ROPE.darkened(r.randf() * 0.12), r)
|
||||
return P._commit(st)
|
||||
|
||||
## A few lumps of sticky amber resin.
|
||||
static func _pine_resin() -> ArrayMesh:
|
||||
var st := P._begin()
|
||||
var r := _rng(49)
|
||||
var n := FastNoiseLite.new()
|
||||
n.seed = 49
|
||||
n.frequency = 3.0
|
||||
for i in range(4):
|
||||
var c := Vector3(r.randf_range(-0.05, 0.05), 0.03, r.randf_range(-0.05, 0.05))
|
||||
P._blob(st, c, Vector3.ONE * r.randf_range(0.025, 0.045), n, 0.25, Color(0.8, 0.5, 0.12).darkened(r.randf() * 0.25), r, 1)
|
||||
return P._commit(st)
|
||||
|
||||
## A small clay pot of black pitch, a stick stood in it.
|
||||
static func _pitch() -> ArrayMesh:
|
||||
var st := P._begin()
|
||||
var r := _rng(51)
|
||||
P._cylinder(st, Vector3(0, 0, 0), Vector3(0, 0.12, 0), 0.07, 0.085, 8, Color(0.55, 0.36, 0.24), r, 0.0)
|
||||
P._cylinder(st, Vector3(0, 0.115, 0), Vector3(0, 0.125, 0), 0.078, 0.078, 8, Color(0.06, 0.05, 0.05), r, -1.0, Color(0.06, 0.05, 0.05))
|
||||
P._cylinder(st, Vector3(0.01, 0.06, 0.0), Vector3(0.05, 0.24, 0.02), 0.008, 0.007, 4, HANDLE, r)
|
||||
return P._commit(st)
|
||||
|
||||
## A rowing boat, bow to -Z: a model 0.55 m long (moorings.gd shows it eight
|
||||
## times over at the pier). Driftwood planks, pitch-black seams, two thwarts
|
||||
## and a pair of oars.
|
||||
static func _rowing_boat() -> ArrayMesh:
|
||||
var st := P._begin()
|
||||
var r := _rng(53)
|
||||
const WOOD := Color(0.66, 0.6, 0.5)
|
||||
const SEAM := Color(0.1, 0.08, 0.07)
|
||||
const OAR := Color(0.55, 0.42, 0.28)
|
||||
var hw := 0.085 # half the beam amidships
|
||||
# Bottom: a wide plank aft, narrowing to the bow.
|
||||
_box(st, Vector3(0, 0.01, 0.07), Vector3(hw * 1.7, 0.012, 0.36), WOOD)
|
||||
_box(st, Vector3(0, 0.014, -0.16), Vector3(hw * 1.1, 0.012, 0.12), WOOD)
|
||||
for side in [-1.0, 1.0]:
|
||||
# Sides amidships and aft, two strakes with a dark seam between.
|
||||
_box(st, Vector3(side * hw, 0.03, 0.06), Vector3(0.008, 0.03, 0.38), WOOD.darkened(0.05))
|
||||
_box(st, Vector3(side * hw, 0.047, 0.06), Vector3(0.0085, 0.004, 0.38), SEAM)
|
||||
_box(st, Vector3(side * hw, 0.062, 0.06), Vector3(0.008, 0.028, 0.38), WOOD)
|
||||
# Bow: the sides swept in to meet at the stem.
|
||||
var bow := Basis(Vector3.UP, side * 0.53)
|
||||
_box(st, Vector3(side * hw * 0.5, 0.048, -0.193), Vector3(0.008, 0.07, 0.17), WOOD, bow)
|
||||
_box(st, Vector3(0, 0.055, -0.265), Vector3(0.014, 0.085, 0.014), WOOD.darkened(0.15)) # stem
|
||||
_box(st, Vector3(0, 0.045, 0.25), Vector3(hw * 2.0, 0.06, 0.008), WOOD.darkened(0.08)) # transom
|
||||
for z in [-0.02, 0.15]:
|
||||
_box(st, Vector3(0, 0.055, z), Vector3(hw * 2.0, 0.008, 0.035), WOOD.darkened(0.12)) # thwarts
|
||||
for side in [-1.0, 1.0]:
|
||||
P._cylinder(st, Vector3(side * 0.04, 0.07, 0.17), Vector3(side * 0.05, 0.075, -0.13), 0.004, 0.004, 4, OAR, r)
|
||||
_box(st, Vector3(side * 0.05, 0.075, -0.15), Vector3(0.022, 0.003, 0.05), OAR)
|
||||
return P._commit(st)
|
||||
|
||||
## A rolled-up, torn sheet of old parchment tied with string.
|
||||
static func _treasure_map() -> ArrayMesh:
|
||||
var st := P._begin()
|
||||
|
||||
@@ -372,6 +372,11 @@ func _run(p: Node3D, what: String, a: Array) -> void:
|
||||
if w.wreck != null and p.global_position.distance_to(w.wreck.chest.global_position) < 4.0:
|
||||
if w.wreck.open_for(p, String(p.player_id)):
|
||||
WorldNet.wreck_state(w.wreck.to_data())
|
||||
"moor":
|
||||
# The mooring post at the end of the pier: tie up your boat.
|
||||
if w.moorings != null and p.global_position.distance_to(w.moorings.post.global_position) < 4.0:
|
||||
if w.moorings.moor(p, String(p.player_id)):
|
||||
WorldNet.boats_state(w.moorings.to_data())
|
||||
"tunnel_go":
|
||||
# Down into the cliff tunnel, or back out at the top: a teleport
|
||||
# the server makes (the tunnel's under the island), from nearby.
|
||||
|
||||
@@ -389,6 +389,17 @@ func _s2c_treasure(d: Dictionary) -> void:
|
||||
return
|
||||
world.treasure.load_data(d)
|
||||
|
||||
## Someone tied up a boat at the pier: everyone here sees it.
|
||||
func boats_state(d: Dictionary) -> void:
|
||||
_all("_s2c_boats", [d])
|
||||
mark_changed()
|
||||
|
||||
@rpc("authority", "call_remote", "reliable")
|
||||
func _s2c_boats(d: Dictionary) -> void:
|
||||
if not is_client() or world.moorings == null:
|
||||
return
|
||||
world.moorings.load_data(d)
|
||||
|
||||
## Who's had their share of the wreck's sea chest changed: everyone here
|
||||
## sees whether it's empty for them.
|
||||
func wreck_state(d: Dictionary) -> void:
|
||||
|
||||
22
scripts/world/boat.gd
Normal file
22
scripts/world/boat.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
extends StaticBody3D
|
||||
## A rowing boat tied up at the pier (moorings.gd): whose it is, and, for
|
||||
## its owner, "Set sail".
|
||||
|
||||
const PostScript = preload("res://scripts/world/mooring_post.gd")
|
||||
|
||||
var moorings: Node3D
|
||||
var owner_id := ""
|
||||
var rest := Transform3D() ## where it's tied up (it bobs about this)
|
||||
|
||||
func mine(player: Node) -> bool:
|
||||
return PostScript.id_of(player) == owner_id
|
||||
|
||||
func interact_prompt(player: Node) -> String:
|
||||
if mine(player):
|
||||
return "Your rowing boat [E] Set sail"
|
||||
var who := String(moorings.moored.get(owner_id, {}).get("name", ""))
|
||||
return "%s's rowing boat" % who if not who.is_empty() else "Someone's rowing boat"
|
||||
|
||||
func interact(player: Node) -> void:
|
||||
if mine(player):
|
||||
moorings.set_sail(player)
|
||||
1
scripts/world/boat.gd.uid
Normal file
1
scripts/world/boat.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bd8yx310myk8m
|
||||
25
scripts/world/mooring_post.gd
Normal file
25
scripts/world/mooring_post.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends StaticBody3D
|
||||
## The mooring post at the end of the pier (moorings.gd): E ties up the
|
||||
## rowing boat in your bag. Online, your game asks the server.
|
||||
|
||||
var moorings: Node3D
|
||||
|
||||
## Whose boat: the player's id (a server's character, or, at home, yours).
|
||||
static func id_of(player: Node) -> String:
|
||||
var pid: Variant = player.get("player_id")
|
||||
if pid != null and not String(pid).is_empty():
|
||||
return String(pid)
|
||||
return String(Net.get_identity().player_id)
|
||||
|
||||
func interact_prompt(player: Node) -> String:
|
||||
if moorings.has_boat(id_of(player)):
|
||||
return "Mooring post (your boat's tied up here)"
|
||||
if player.inventory.count(moorings.BOAT_ITEM) > 0:
|
||||
return "Mooring post [E] Tie up your boat"
|
||||
return "Mooring post (build a rowing boat at a workbench, and tie it up here)"
|
||||
|
||||
func interact(player: Node) -> void:
|
||||
if moorings.world.is_online():
|
||||
PlayerNet.ask("moor", [])
|
||||
return
|
||||
moorings.moor(player, id_of(player))
|
||||
1
scripts/world/mooring_post.gd.uid
Normal file
1
scripts/world/mooring_post.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dt0os4fg56rxi
|
||||
158
scripts/world/moorings.gd
Normal file
158
scripts/world/moorings.gd
Normal file
@@ -0,0 +1,158 @@
|
||||
extends Node3D
|
||||
## The Cove's moorings (0.6.0, docs/WORLDLETS_DESIGN.md §5): berths along
|
||||
## the end of the pier, and a mooring post on the deck. Build a rowing boat at
|
||||
## a workbench, carry it down to the pier and press E at the post: it's tied
|
||||
## up at a berth of its own, one boat for each player, and it stays there
|
||||
## (saved with the Cove; online the server decides, and everyone sees
|
||||
## everyone's boat). Your own boat's prompt is "Set sail", but nobody's
|
||||
## charted the way to the Highlands yet: that's the next part of the journey,
|
||||
## and the ship's compass from the pirate chest is what it'll need.
|
||||
|
||||
const ItemMeshes = preload("res://scripts/items/item_meshes.gd")
|
||||
const BoatScript = preload("res://scripts/world/boat.gd")
|
||||
const PostScript = preload("res://scripts/world/mooring_post.gd")
|
||||
const BERTHS := 6 ## three each side (any further in, it shallows)
|
||||
const BOAT_SCALE := 8.0 ## the item's model (0.55 m) up to a boat (4.4 m)
|
||||
const BERTH_GAP := 5.0
|
||||
const BOAT_ITEM := "rowing_boat"
|
||||
|
||||
var world: Node3D
|
||||
var pier: Node3D
|
||||
var moored: Dictionary = {} ## player id -> {"berth": i, "name": who}
|
||||
var boats: Dictionary = {} ## player id -> boat.gd
|
||||
var post: StaticBody3D
|
||||
var _t := 0.0
|
||||
|
||||
func setup(w: Node3D) -> bool:
|
||||
world = w
|
||||
pier = w.pier
|
||||
if pier == null:
|
||||
return false
|
||||
add_to_group("moorings")
|
||||
post = StaticBody3D.new()
|
||||
post.name = "MooringPost"
|
||||
post.collision_layer = 1 | 2
|
||||
post.set_script(PostScript)
|
||||
post.moorings = self
|
||||
var st := SurfaceTool.new()
|
||||
st.begin(Mesh.PRIMITIVE_TRIANGLES)
|
||||
pier._box(st, Vector3(0, 0.45, 0), Vector3(0.24, 0.9, 0.24), pier.POST)
|
||||
pier._box(st, Vector3(0, 0.8, 0), Vector3(0.32, 0.08, 0.32), pier.POST.darkened(0.2))
|
||||
pier._box(st, Vector3(0, 0.62, 0), Vector3(0.27, 0.1, 0.27), Color(0.62, 0.55, 0.38)) # (a coil of rope)
|
||||
st.generate_normals()
|
||||
var mi := MeshInstance3D.new()
|
||||
mi.mesh = st.commit()
|
||||
var mat := StandardMaterial3D.new()
|
||||
mat.vertex_color_use_as_albedo = true
|
||||
mat.roughness = 0.9
|
||||
mi.material_override = mat
|
||||
post.add_child(mi)
|
||||
var cs := CollisionShape3D.new()
|
||||
var box := BoxShape3D.new()
|
||||
box.size = Vector3(0.3, 0.9, 0.3)
|
||||
cs.shape = box
|
||||
cs.position = Vector3(0, 0.45, 0)
|
||||
post.add_child(cs)
|
||||
add_child(post)
|
||||
post.global_position = pier.end - pier.dir * 1.2 + _right() * (pier.WIDTH * 0.5 - 0.3)
|
||||
return true
|
||||
|
||||
func _right() -> Vector3:
|
||||
return pier.dir.cross(Vector3.UP).normalized()
|
||||
|
||||
## Where berth `i` is: alongside the end of the pier, in pairs, bow out to sea.
|
||||
func berth_xf(i: int) -> Transform3D:
|
||||
var side := 1.0 if i % 2 == 0 else -1.0
|
||||
var along: Vector3 = pier.end - pier.dir * (2.0 + (i / 2) * BERTH_GAP)
|
||||
var p: Vector3 = along + _right() * side * (pier.WIDTH * 0.5 + 1.0)
|
||||
p.y = world.terrain.sea_level - 0.08
|
||||
return Transform3D(Basis.looking_at(pier.dir, Vector3.UP), p)
|
||||
|
||||
func has_boat(id: String) -> bool:
|
||||
return moored.has(id)
|
||||
|
||||
func _free_berth() -> int:
|
||||
var used := moored.values().map(func(m): return int(m.berth))
|
||||
for i in range(BERTHS):
|
||||
if not i in used:
|
||||
return i
|
||||
return -1
|
||||
|
||||
## Player `p` (id `id`) ties up the boat in their bag. Says why not and
|
||||
## returns false when they can't.
|
||||
func moor(p: Node, id: String) -> bool:
|
||||
if has_boat(id):
|
||||
Actions.tell(p, "Your boat's already tied up here")
|
||||
return false
|
||||
if p.inventory.count(BOAT_ITEM) <= 0:
|
||||
Actions.tell(p, "Build a rowing boat at a workbench and bring it here to tie it up")
|
||||
return false
|
||||
var b := _free_berth()
|
||||
if b < 0:
|
||||
Actions.tell(p, "Every berth along the pier is taken")
|
||||
return false
|
||||
p.inventory.remove(BOAT_ITEM, 1)
|
||||
var who := String(p.get("display")) if p.get("display") != null else ""
|
||||
moored[id] = {"berth": b, "name": who}
|
||||
_sync()
|
||||
Actions.tell(p, "You tie your boat up at the end of the pier")
|
||||
Sfx.at("creak", post.global_position)
|
||||
if Net.is_server():
|
||||
WorldNet.mark_changed()
|
||||
return true
|
||||
|
||||
## Your boat: off to the Highlands. Not yet.
|
||||
func set_sail(p: Node) -> void:
|
||||
if p.inventory.count("ship_compass") <= 0:
|
||||
Actions.tell(p, "Past the bay it's open sea: without a ship's compass you'd be lost within the hour")
|
||||
return
|
||||
Actions.tell(p, "The compass needle points north over the water, but nobody's charted the way to the Highlands yet. (That's the next part of the journey: coming in a later version.)")
|
||||
|
||||
func _sync() -> void:
|
||||
for id in boats.keys():
|
||||
if not moored.has(id):
|
||||
boats[id].queue_free()
|
||||
boats.erase(id)
|
||||
for id in moored:
|
||||
if boats.has(id):
|
||||
continue
|
||||
var b: StaticBody3D = StaticBody3D.new()
|
||||
b.name = "Boat_%d" % int(moored[id].berth)
|
||||
b.collision_layer = 1 | 2
|
||||
b.set_script(BoatScript)
|
||||
b.moorings = self
|
||||
b.owner_id = String(id)
|
||||
var mi := MeshInstance3D.new()
|
||||
mi.name = "Hull"
|
||||
mi.mesh = ItemMeshes.build(BOAT_ITEM)
|
||||
mi.material_override = ItemDB.item_material()
|
||||
mi.scale = Vector3.ONE * BOAT_SCALE
|
||||
b.add_child(mi)
|
||||
var cs := CollisionShape3D.new()
|
||||
var box := BoxShape3D.new()
|
||||
box.size = Vector3(1.4, 0.6, 4.2)
|
||||
cs.shape = box
|
||||
cs.position = Vector3(0, 0.3, 0)
|
||||
b.add_child(cs)
|
||||
add_child(b)
|
||||
b.global_transform = berth_xf(int(moored[id].berth))
|
||||
b.rest = b.global_transform
|
||||
boats[id] = b
|
||||
|
||||
## A gentle bob on the swell (just the look).
|
||||
func _process(delta: float) -> void:
|
||||
_t += delta
|
||||
for id in boats:
|
||||
var b: Node3D = boats[id]
|
||||
var k := float(int(moored[id].berth)) * 1.7
|
||||
b.global_transform = b.rest.translated(Vector3(0, sin(_t * 1.1 + k) * 0.05, 0)) * Transform3D(Basis(Vector3(0, 0, 1), sin(_t * 0.8 + k) * 0.03), Vector3.ZERO)
|
||||
|
||||
func to_data() -> Dictionary:
|
||||
return {"moored": moored.duplicate(true)}
|
||||
|
||||
func load_data(d: Dictionary) -> void:
|
||||
moored = {}
|
||||
var m: Dictionary = d.get("moored", {})
|
||||
for id in m:
|
||||
moored[String(id)] = {"berth": int(m[id].get("berth", 0)), "name": String(m[id].get("name", ""))}
|
||||
_sync()
|
||||
1
scripts/world/moorings.gd.uid
Normal file
1
scripts/world/moorings.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dlc5hki2qd50v
|
||||
@@ -409,6 +409,8 @@ func _scatter_trees() -> void:
|
||||
node.drops_final = {"wood": [2, 3], "stick": [2, 4]}
|
||||
node.max_hp = 3.0
|
||||
node.hp = 3.0
|
||||
elif vi in conifers:
|
||||
node.drops_final["pine_resin"] = [1, 2] # (0.6.0: pitch for a boat)
|
||||
var cs := CollisionShape3D.new()
|
||||
cs.shape = cap
|
||||
cs.position = Vector3(0, cap.height * 0.5 + 0.1, 0)
|
||||
@@ -664,9 +666,9 @@ func _scatter_pickups() -> void:
|
||||
rng.seed = world_seed + 6
|
||||
# Order matters: new kinds go at the END so existing saves keep their ids.
|
||||
var want := {"stick": 260, "stone": 170, "flint": 80, "mushroom": 110, "feather": 70, "fiber": 150,
|
||||
"iron_nugget": 70, "clay": 60, "salt": 40, "driftwood": 45}
|
||||
"iron_nugget": 70, "clay": 60, "salt": 40, "driftwood": 45, "seagrass": 40}
|
||||
var radius: Dictionary = {"stick": 0.35, "stone": 0.25, "flint": 0.25, "mushroom": 0.25, "feather": 0.25, "fiber": 0.45,
|
||||
"iron_nugget": 0.25, "clay": 0.3, "salt": 0.25, "driftwood": 0.5}
|
||||
"iron_nugget": 0.25, "clay": 0.3, "salt": 0.25, "driftwood": 0.5, "seagrass": 0.4}
|
||||
for id: String in want:
|
||||
# Fibre grows as a plant (wild flax) you pick, 2 fibre a clump.
|
||||
var mesh: Mesh = ItemMeshes.build("fiber_plant") if id == "fiber" else ItemDB.mesh_for(id)
|
||||
@@ -718,8 +720,11 @@ func _scatter_pickups() -> void:
|
||||
# Washed up along a beach (the Cove), near the waterline:
|
||||
# what a boat's hull is made of.
|
||||
chance = 0.95 if terrain.beach_weight(x, z) > 0.6 and h < terrain.water_level + 1.6 else 0.0
|
||||
"seagrass":
|
||||
# (0.6.0) Washed up at the tide line, for a boat's rope.
|
||||
chance = 0.95 if terrain.beach_weight(x, z) > 0.6 and h < terrain.water_level + 0.8 else 0.0
|
||||
# A few right by the spawn so the first craft is quick.
|
||||
if Vector2(x - _spawn.x, z - _spawn.z).length() < 18.0 and not id in ["iron_nugget", "clay", "salt", "driftwood"]:
|
||||
if Vector2(x - _spawn.x, z - _spawn.z).length() < 18.0 and not id in ["iron_nugget", "clay", "salt", "driftwood", "seagrass"]:
|
||||
chance += 0.5
|
||||
if keep > chance:
|
||||
continue
|
||||
|
||||
@@ -57,6 +57,7 @@ var pier: Node3D ## the Cove's pier (scripts/world/pier.gd), or null
|
||||
var tunnel: Node3D ## the cliff tunnel (scripts/world/tunnel.gd, J1), or null
|
||||
var wreck: Node3D ## the Cove's wreck (scripts/world/wreck.gd, 0.6.0), or null
|
||||
var treasure: Node3D ## the pirate treasure (scripts/world/treasure.gd), or null
|
||||
var moorings: Node3D ## the boats tied up at the pier (scripts/world/moorings.gd), or null
|
||||
var sea_cave: Node3D ## the Cove's end of it (scripts/world/sea_cave.gd), or null
|
||||
var traveling := false ## on the way to another worldlet (the scene is about to change)
|
||||
var _session_time := 0.0 ## seconds played since the last save
|
||||
@@ -368,6 +369,15 @@ func _on_terrain_ready() -> void:
|
||||
props.pier = pr
|
||||
else:
|
||||
pr.free()
|
||||
# The moorings (0.6.0): rowing boats tied up at the end of the pier.
|
||||
if pier != null and not menu_mode:
|
||||
var mo := preload("res://scripts/world/moorings.gd").new()
|
||||
mo.name = "Moorings"
|
||||
add_child(mo)
|
||||
if mo.setup(self):
|
||||
moorings = mo
|
||||
else:
|
||||
mo.free()
|
||||
# The wreck (0.6.0): on the Cove's beach, with the sea chest's treasure maps.
|
||||
var wk := preload("res://scripts/world/wreck.gd").new()
|
||||
wk.name = "Wreck"
|
||||
@@ -717,6 +727,7 @@ func collect_save() -> Dictionary:
|
||||
"tunnel": tunnel.to_data() if tunnel != null else {},
|
||||
"wreck": wreck.to_data() if wreck != null else {},
|
||||
"treasure": treasure.to_data() if treasure != null else {},
|
||||
"moorings": moorings.to_data() if moorings != null else {},
|
||||
"map": map_data(),
|
||||
}
|
||||
|
||||
@@ -735,6 +746,7 @@ func _shared_state(harvested: Dictionary, regrow: Dictionary, taken: Array, drop
|
||||
"tunnel": tunnel.to_data() if tunnel != null else {},
|
||||
"wreck": wreck.to_data() if wreck != null else {},
|
||||
"treasure": treasure.to_data() if treasure != null else {},
|
||||
"moorings": moorings.to_data() if moorings != null else {},
|
||||
}
|
||||
|
||||
## The live pieces (placed and not being removed).
|
||||
@@ -872,6 +884,8 @@ func _apply_save(s: Dictionary, with_player: bool) -> void:
|
||||
wreck.load_data(s.get("wreck", {}))
|
||||
if treasure != null:
|
||||
treasure.load_data(s.get("treasure", {}))
|
||||
if moorings != null:
|
||||
moorings.load_data(s.get("moorings", {}))
|
||||
if with_player:
|
||||
load_map_data(String(s.get("map", "")))
|
||||
# The bear (bear_range.gd): applied when it's set up, after loading.
|
||||
|
||||
Reference in New Issue
Block a user