Skip to content

Commit f4910a9

Browse files
committed
Poprawki 3
1 parent e4517cd commit f4910a9

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

Nodes/Enemies/Frog.tscn

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ func general_ai(delta):
5151
motion.y = 0
5252
state = IDLE
5353
elif state == JUMP:
54-
direction *= -1
55-
sprite.flip_h = direction < 0
54+
if Com.is_server:
55+
direction *= -1
5656

5757
if col.normal.y != 0:
5858
state = IDLE

Scripts/Game.gd

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ onready var effects = $Effects
1212
var entity_list = {}
1313
var special_entity_list = {}
1414

15+
signal player_joined
16+
1517
func _ready():
1618
if !Com.is_server:
1719
Network.connect("game_over", self, "on_over")

Scripts/Player.gd

+4
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ func get_state_vector():
533533
func apply_state_vector(timestamp, diff_vector, vector):
534534
if vector[0] != uname:
535535
self.uname = vector[0]
536+
537+
if self != Com.player:
538+
Com.game.emit_signal("player_joined", uname)
539+
536540
sprite2.self_modulate.h = vector[1] / 360.0
537541
hue = vector[1]
538542

Scripts/UI/Chat.gd

+7-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const PLACEHOLDER = "T to chat, /g global, /l local, /w NAME whisper, /r reply"
1919
func _ready():
2020
Com.controls.connect("key_press", self, "on_key_press")
2121
Network.connect("chat_message", self, "on_message_get")
22+
Com.game.connect("player_joined", self, "on_new_player")
2223
input.placeholder_text = PLACEHOLDER
2324

2425
func on_message_get(type, from, message):
@@ -27,13 +28,17 @@ func on_message_get(type, from, message):
2728
if type == Data.CHATS.WHISPER:
2829
last_whisper = from
2930

31+
func on_new_player(uname):
32+
return #spam
33+
add_message(null, uname + " joined the room", Data.CHATS.SYSTEM)
34+
3035
func add_message(author, message, type = mode, add_whisper = false):
3136
history.push_color("#" + chat_colors[type].to_html())
32-
history.add_text(mode_text(type, add_whisper))
37+
if type != Data.CHATS.SYSTEM: history.add_text(mode_text(type, add_whisper))
3338
history.pop()
3439

3540
history.push_color("#" + chat_colors[type].lightened(0.5).to_html())
36-
history.append_bbcode(str("[b]", author, ":[/b] "))
41+
if author: history.append_bbcode(str("[b]", author, ":[/b] "))
3742
history.pop()
3843

3944
history.add_text(str(message, "\n"))

Server/Room.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ public void Tick() {
7171
if (exit == 1) {
7272
room = Server.GetAdjacentMap((int)map.Get("map_x") + (int)map.Get("width"), (int)map.Get("map_y") + (int)position.y / 1080);
7373
if (room != null) {
74-
position.x = 0;
74+
position.x = 2;
7575
position.y += ((int)map.Get("map_y") - (int)room.GetMapValue("map_y")) * 1080;
7676
}
7777
} else if (exit == 3) {
7878
room = Server.GetAdjacentMap((int)map.Get("map_x") - 1, (int)map.Get("map_y") + (int)position.y / 1080);
7979
if (room != null) {
80-
position.x = (int)room.GetMapValue("width") * 1920;
80+
position.x = (int)room.GetMapValue("width") * 1920 - 2;
8181
position.y += ((int)map.Get("map_y") - (int)room.GetMapValue("map_y")) * 1080;
8282
}
8383
}

TODO.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
-equip soul nie zawsze dobrze działa
44
+zabezpieczenia przed złymi pakietami, wywołaniami metod z niepoprawnymi danymi itp.
5-
-żaby mają dałna i skaczą do tyłu
65
+informacje jak ktoś wchodzi albo umiera
76
>w sumie TICK można całkiem pomijać jak nie ma zmian (w UDP pewnie przestanie działać)
87

0 commit comments

Comments
 (0)