diff options
Diffstat (limited to 'client')
| -rw-r--r-- | client/map/tile_factory.gd | 10 | ||||
| -rw-r--r-- | client/map/tiles/item_portal.gd | 2 | ||||
| -rw-r--r-- | client/map/tiles/player_portal.gd | 13 | ||||
| -rw-r--r-- | client/map/tiles/portal.gd | 12 |
4 files changed, 16 insertions, 21 deletions
diff --git a/client/map/tile_factory.gd b/client/map/tile_factory.gd index f3fddfe7..4cd8c745 100644 --- a/client/map/tile_factory.gd +++ b/client/map/tile_factory.gd @@ -47,8 +47,6 @@ func produce(raw_name: String, position: Vector2i, neighbors: Array) -> Tile: ctx.floor_meshers = floor_meshers match tile_name.name: - "black-hole-counter": return ItemPortal.new(ctx, false) - "black-hole": return PlayerPortal.new(ctx, false) "book": return CounterBase.new(ctx, preload("res://map/tiles/book.tscn")) "ceiling-lamp": return GenericTile.new(ctx, preload("res://map/tiles/ceiling_lamp.tscn")) "chair": return Chair.new(ctx) @@ -76,8 +74,12 @@ func produce(raw_name: String, position: Vector2i, neighbors: Array) -> Tile: "tree": return ExteriorTree.new(ctx) "wall-window": return WallWindow.new(ctx) "wall": return Wall.new(ctx) - "white-hole-counter": return ItemPortal.new(ctx, true) - "white-hole": return PlayerPortal.new(ctx, true) + "white-hole-counter": return ItemPortal.new(ctx, 1) + "white-hole": return PlayerPortal.new(ctx) + "grey-hole-counter": return ItemPortal.new(ctx, 0) + "grey-hole": return PlayerPortal.new(ctx) + "black-hole-counter": return ItemPortal.new(ctx, -1) + "black-hole": return PlayerPortal.new(ctx) "house-balcony": return HouseBalcony.new(ctx) "house-door": return HouseDoor.new(ctx) diff --git a/client/map/tiles/item_portal.gd b/client/map/tiles/item_portal.gd index f9d2a2ec..6d292bde 100644 --- a/client/map/tiles/item_portal.gd +++ b/client/map/tiles/item_portal.gd @@ -17,6 +17,6 @@ class_name ItemPortal extends CounterBase var model := preload("res://map/tiles/portal.tscn") -func _init(ctx: TileFactory.TileCC, type: bool): +func _init(ctx: TileFactory.TileCC, type: float): super(ctx, model) model.configure(0.2, type) diff --git a/client/map/tiles/player_portal.gd b/client/map/tiles/player_portal.gd index 222f84ee..8339a797 100644 --- a/client/map/tiles/player_portal.gd +++ b/client/map/tiles/player_portal.gd @@ -17,16 +17,13 @@ class_name PlayerPortal extends Floor var model: PortalModel = load("res://map/tiles/portal.tscn").instantiate() -func _init(ctx: TileFactory.TileCC, type: bool): +func _init(ctx: TileFactory.TileCC): super(ctx) - model.configure(0.4, type) + change(ctx.tile_name.name) base.add_child(model) func change(tn: String) -> bool: - if tn == "white-hole": - model.target_type = 1. - return true - if tn == "black-hole": - model.target_type = -1. - return true + if tn == "white-hole": model.target_type = 1.; model.target_size = 0.4; return true + if tn == "grey-hole": model.target_type = 0.; model.target_size = 0.2; return true + if tn == "black-hole": model.target_type = -1.; model.target_size = 0.4; return true return false diff --git a/client/map/tiles/portal.gd b/client/map/tiles/portal.gd index 75da4980..dbb882c5 100644 --- a/client/map/tiles/portal.gd +++ b/client/map/tiles/portal.gd @@ -20,17 +20,13 @@ var target_type = 0. var current_type = 0. var target_size = 0. var current_size = 0. -var mat: ShaderMaterial - -func configure(size: float, type: bool): - mat = $Mesh.get_active_material(0) - target_type = 1. if type else -1. - target_size = size +@onready var mat: ShaderMaterial = $Mesh.get_active_material(0) func _process(delta: float) -> void: + if not mat: return if abs(target_type - current_type) > 0.01: - current_type = G.interpolate(current_type, target_type, delta * 10.) + current_type = G.interpolate(current_type, target_type, delta * 15.) mat.set_shader_parameter("type", current_type) if abs(target_size - current_size) > 0.01: - current_size = G.interpolate(current_size, target_size, delta * 3.) + current_size = G.interpolate(current_size, target_size, delta * 5.) mat.set_shader_parameter("size", current_size) |