mirror of
https://codeberg.org/sunder/sunder.git
synced 2026-07-14 21:44:36 +00:00
first commit 🎉
This commit is contained in:
commit
6e724f67fe
805 changed files with 62098 additions and 0 deletions
17
scenes/multiplayer/match/scripts/modes/ffa.gd
Normal file
17
scenes/multiplayer/match/scripts/modes/ffa.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends "res://scenes/multiplayer/match/scripts/mode.gd"
|
||||
|
||||
func setup(p_match:Match) -> void:
|
||||
p_match.scoreboard.add_panel()
|
||||
p_match.scoreboard.add_child(DeathmatchScoringComponent.new(p_match.scoreboard, p_match.player_spawner))
|
||||
#p_match.scoreboard.scoring_resources.append(DeathmatchScoringComponent.new(p_match.scoreboard, p_match.players))
|
||||
p_match.player_spawner.child_entered_tree.connect(func(player:Player) -> void:
|
||||
player.iff.fill = Color.RED
|
||||
var panel:ScorePanel = p_match.scoreboard.get_panel(0)
|
||||
panel.add_entry(player.peer_id, player.username)
|
||||
player.damage.connect(_ffa_damage_handler)
|
||||
)
|
||||
|
||||
|
||||
func _ffa_damage_handler(source: Node, target: Node, amount: float) -> void:
|
||||
assert(target.find_children("*", "Health"))
|
||||
target.health.damage.rpc(amount, source.peer_id)
|
||||
1
scenes/multiplayer/match/scripts/modes/ffa.gd.uid
Normal file
1
scenes/multiplayer/match/scripts/modes/ffa.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ker32mqppmyt
|
||||
42
scenes/multiplayer/match/scripts/modes/rabbit.gd
Normal file
42
scenes/multiplayer/match/scripts/modes/rabbit.gd
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
extends "res://scenes/multiplayer/match/scripts/mode.gd"
|
||||
|
||||
var match:Match
|
||||
|
||||
func setup(p_match:Match) -> void:
|
||||
var flag:Flag = Flag.instantiate()
|
||||
p_match.objective_spawner.add_child(flag)
|
||||
var spawn := p_match.map.get_spawn_position("objectives")
|
||||
flag.global_position = spawn
|
||||
flag.respawn_timer.timeout.connect(func() -> void:
|
||||
if spawn:
|
||||
flag.waypoint.text = ""
|
||||
flag.global_position = spawn
|
||||
flag.state = flag.FlagState.ON_STAND
|
||||
)
|
||||
p_match.teams.add_teams(["rabbit", "chasers"])
|
||||
flag.grabbed.connect(
|
||||
func(carry:FlagHolder) -> void:
|
||||
carry.owner.hud.objective_label.set_visible(true)
|
||||
p_match.switch_team(carry.owner.peer_id, "rabbit")
|
||||
flag.respawn_timer.stop()
|
||||
)
|
||||
flag.dropped.connect(
|
||||
func(carry:FlagHolder) -> void:
|
||||
carry.owner.hud.objective_label.set_visible(false)
|
||||
p_match.switch_team(carry.owner.peer_id, "chasers")
|
||||
flag.respawn_timer.start()
|
||||
)
|
||||
p_match.scoreboard.add_child(
|
||||
RabbitScoringComponent.new(p_match.scoreboard, flag))
|
||||
p_match.scoreboard.add_child(
|
||||
DeathmatchScoringComponent.new(p_match.scoreboard, p_match.player_spawner))
|
||||
|
||||
p_match.player_spawner.child_entered_tree.connect(func(player:Player) -> void:
|
||||
p_match.teams["chasers"].add(player.peer_id, player.username)
|
||||
player.damage.connect(_rabbit_damage_handler)
|
||||
)
|
||||
|
||||
func _rabbit_damage_handler(source: Node, target: Node, amount: float) -> void:
|
||||
assert(target.find_children("*", "Health"))
|
||||
if source == target or source.team_id != target.team_id:
|
||||
target.health.damage.rpc(amount, source.peer_id)
|
||||
1
scenes/multiplayer/match/scripts/modes/rabbit.gd.uid
Normal file
1
scenes/multiplayer/match/scripts/modes/rabbit.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://blvw3hbunban1
|
||||
Loading…
Add table
Add a link
Reference in a new issue