Skip to content

Commit

Permalink
reset to misc
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSecondReal0 committed Nov 30, 2020
1 parent 383a38a commit 2876691
Show file tree
Hide file tree
Showing 56 changed files with 1,088 additions and 81 deletions.
10 changes: 7 additions & 3 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ Translations: GrbavaCigla
Programming
-----------
Monban
Moxvallix
TheSecondReal0
TheRyeGuyWhoWillNowDie
Darshadi
zapzoop0099
GrbavaCigla
Macmv
NiceMicro
Vainiovano
Damjan94
jngo102
tooManyArguments
Moxvallix
Macmv
Evolve2k
Wandang
Daniel071
Expand All @@ -45,11 +48,12 @@ Art
---
Luke_Connor
Moxvallix
Zughy
rand_0moide
PRIME
Gai_
Orangemn6
jngo102
NiceMicro

Game design
-----------
Expand Down
29 changes: 29 additions & 0 deletions src/assets/autoload/dlman.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
extends Node


# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var mapdata
# Called when the node enters the scene tree for the first time.
func _ready():
set_network_master(1)
func distribute():
var map = File.new()
map.open("user://maps/servermap.tscn", File.READ)
if not map.file_exists("user://maps/servermap.tscn"):
map.close()
map.open("res://assets/maps/test/test.tscn", File.READ)
mapdata = map.get_as_text()
rpc("recieve",mapdata)
recieve(mapdata)
map.close()
remotesync func recieve(data):
var localmap = File.new()
localmap.open("user://maps/currentmap.tscn", File.WRITE)
localmap.store_string(data)
localmap.close()

# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
3 changes: 2 additions & 1 deletion src/assets/autoload/network.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var player_name: String setget toss, get_player_name
puppet var peers: Array = []
puppet var names: Dictionary = {}
var myID: int = 1

var rawmap
signal server_started
signal connection_handled

Expand Down Expand Up @@ -75,6 +75,7 @@ func _player_connected(id) -> void:
# remotely set myID var of new player to their network id
# sync peer list of all players
rset("peers", peers)


func _player_disconnected(id) -> void:
peers.erase(id)
Expand Down
3 changes: 1 addition & 2 deletions src/assets/autoload/playermanager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ var playerColors: Dictionary = {enabledRoles[0]: Color(1,0,0),# traitor
enabledRoles[2]: Color(1,1,1)}# default
var rng = RandomNumberGenerator.new()
signal roles_assigned

signal host_kill
func _ready():
set_network_master(1)
# warning-ignore:return_value_discarded
GameManager.connect("state_changed", self, "state_changed")

func assigntasks():
for id in Network.peers:
taskstoassign = tasks
Expand Down
2 changes: 1 addition & 1 deletion src/assets/main/maps.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extends Node2D

var maps: Dictionary = {"lobby": {"dir": preload("res://assets/maps/lobby/lobby.tscn")}, "test": {"dir": preload("res://assets/maps/test/test.tscn")}}
var maps: Dictionary = {"lobby": {"dir": preload("res://assets/maps/lobby/lobby.tscn")}, "test": {"dir": load("user://maps/currentmap.tscn")}}

signal spawn(position,frommap)

Expand Down
14 changes: 9 additions & 5 deletions src/assets/player/infiltrator.gd
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ func _kill_player(player: KinematicBody2D) -> void:
"""
Kill the player who is currently the target.
"""

var target_sprite: AnimatedSprite = _target_player.get_node("Sprite")
target_sprite.material.set_shader_param("line_color", Color.transparent)
emit_signal("kill", _target_player)
var kid = _target_player.id

set_reloaded(false)
enable_killing(false)
# kill_cooldown_timer.start()
Expand All @@ -95,8 +97,9 @@ func _get_target() -> void:
distance = temp_distance
_target_player = player
if _target_player != null:
var target_sprite: AnimatedSprite = _target_player.get_node("Sprite")
target_sprite.material.set_shader_param("line_color", Color.red)
pass
#var target_sprite: AnimatedSprite = _target_player.get_node("Sprite")
#target_sprite.material.set_shader_param("line_color", Color.red)

func _instantiate_kill_gui() -> void:
"""
Expand All @@ -123,8 +126,9 @@ func _on_KillArea_body_exited(body: Node) -> void:
Remove the outline from the body that exited the kill area.
"""
if player.main_player:
var sprite: AnimatedSprite = body.get_node("Sprite")
sprite.material.set_shader_param("line_color", Color.transparent)
#var sprite: AnimatedSprite = body.get_node("Sprite")
#sprite.material.set_shader_param("line_color", Color.transparent)
pass

func _on_KillCooldownTimer_timeout() -> void:
"""
Expand Down
29 changes: 18 additions & 11 deletions src/assets/player/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ var movement = Vector2(0,0)
# Only true when this is the player being controlled
export var main_player = false
#anim margin controls how big the player movement must be before animations are played
var x_anim_margin = 0.1
var y_anim_margin = 0.1
var x_anim_margin = 0.00
var y_anim_margin = 0.00
#whether the character faces in the right direction
var face_right = true

# The input number is incremented on each _physics_process call. GDScript's int
# type is int64_t which is enough for thousands of years of gameplay
Expand All @@ -35,8 +37,10 @@ var input_queue: Array = []
func _ready():
# Set the sprite material for every player to be a duplicate of their
# initial material so that outlines may be modified independently.

sprite.set_material(sprite.material.duplicate())

PlayerManager.connect("host_kill",self,"on_host_kill")

if "--server" in OS.get_cmdline_args():
main_player = false
if main_player:
Expand Down Expand Up @@ -78,7 +82,6 @@ func _checkRole(role: String) -> void:
set_collision_layer_bit(2, true)
if has_node("Infiltrator"):
get_node("Infiltrator").queue_free()

func changeNameColor(role: String):
match role:
"traitor":
Expand Down Expand Up @@ -136,17 +139,21 @@ func _physics_process(_delta):

# We handle animations and stuff here
if movement.x > x_anim_margin:
$Sprite.play("walk-h")
$Sprite.flip_h = false
$spritecollection/AnimationPlayer.play("h_move")
if not face_right:
face_right = true
$spritecollection.scale.x = -$spritecollection.scale.x
elif movement.x < -x_anim_margin:
$Sprite.play("walk-h")
$Sprite.flip_h = true
$spritecollection/AnimationPlayer.play("h_move")
if face_right:
face_right = false
$spritecollection.scale.x = -$spritecollection.scale.x
elif movement.y > y_anim_margin:
$Sprite.play("walk-down")
$spritecollection/AnimationPlayer.play("h_move")
elif movement.y < -y_anim_margin:
$Sprite.play("walk-up")
$spritecollection/AnimationPlayer.play("h_move")
else:
$Sprite.play("idle")
$spritecollection/AnimationPlayer.play("idle", 0.2)

# Only called on the main player. Rerolls the player's unreceived inputs on top
# of the server's player position
Expand Down
Loading

0 comments on commit 2876691

Please sign in to comment.