class_name Actor
extends KinematicBody2D

const PhysicsConst = preload("res://src/Utilities/Physic/PhysicsConst.gd")

const FLOOR_NORMAL := Vector2.UP
# Mass of Blobby
# Kilograms
export var mass := 6.5


#TODO Split the blobby specific parts up from this
var stomp_feedback := 1400 * 30
var stomp_time := 0.2
var init_stomp_time := 0.2
var inair_velocity := 21
var wallslide_threshold := 1000
var base_floor_friction := 0.5
var initial_velocity_dependence := 0.7
var floor_friction := base_floor_friction
# TODO Mixing Vectors and ints is questionable
var max_velocity := {
  "walk": 120,
  "run": 160,
  "jump": Vector2(120, 420),
  "fall": Vector2(120, 420),
  "walljump": 200,
  "idle": 12000,
  "duck": 165,
  "duck_walk": 165
}
# x is applied directly to velocity and y is multiplied with acceleration
var duck_boost = Vector2(2, 0.75)
var velocity_jump_boost_ratio := 10
# This is added to the acceleration force initially
var init_acceleration_force := {"": 0, "idle_walk": 4181, "idle_run": 5765, "walk_run": 1000}
# Oriented around deltas of 0.0166666...s
# newtonmeters is the unit
var acceleration_force := {
  "walk": Vector2(1800, 1300),
  "fall": Vector2(1800, 1050),
  "jump": Vector2(1800, 0),
  "idle": Vector2(1800, 1300),
  "duck": Vector2(500, 1300),
  "duck_walk": Vector2(500, 1300),
  "run": Vector2(2500, 1400),
  "walljump": Vector2(600, 1050),
  "air_strafe": Vector2(333, 2000)
}
var velocity := Vector2.ZERO
var max_air_strafe_charges := 0
var air_strafe_charges := 0
# Gravity as m/s^2
var _gravity: float = PhysicsConst.gravity

onready var level_state := get_tree().root.get_child(4).get_node("%LevelState")
onready var signal_manager := get_tree().root.get_child(4).get_node("%SignalManager")
