mirror of
https://port.numenaute.org/aleajactaest/bazar_alea.git
synced 2024-11-12 18:29:04 +00:00
107 lines
3.3 KiB
GDScript
107 lines
3.3 KiB
GDScript
extends Node
|
|
|
|
signal update_message(message)
|
|
|
|
@export var debug_console:bool = false:
|
|
get: return debug_console
|
|
set(value):
|
|
debug_console = value
|
|
|
|
@export var debug_app:bool = false:
|
|
get: return debug_app
|
|
set(value):
|
|
debug_app = value
|
|
|
|
@export var verbose_console:bool = false:
|
|
get: return verbose_console
|
|
set(value):
|
|
verbose_console = value
|
|
|
|
@export var verbose_app:bool = false:
|
|
get: return verbose_app
|
|
set(value):
|
|
verbose_app = value
|
|
|
|
@export var error_console:bool = false:
|
|
get: return error_console
|
|
set(value):
|
|
error_console = value
|
|
|
|
@export var error_app:bool = false:
|
|
get: return error_app
|
|
set(value):
|
|
error_app = value
|
|
|
|
|
|
#------------------ Player Enums ------------------#
|
|
# Demarche (Attend, Marche, Cours, sprint
|
|
enum GAIT {WAITING, WALKING , RUNNING , SPRINTING}
|
|
# Sol, Air, Couverture, poupee de chiffon
|
|
enum MOVEMENT_STATE {NONE , GROUNDED , IN_AIR , MANTLING, RAGDOLL}
|
|
#
|
|
enum MOVEMENT_ACTION {NONE ,LOW_MANTLE , HIGH_MANTLE , ROLLING , GETTING_UP}
|
|
# Fusis, Pistolet
|
|
enum OVERLAY_STATE {DEFAULT , RIFLE , PISTOL}
|
|
#
|
|
enum ROTATION_MODE {VELOCITY_DIRECTION , LOOKING_DIRECTION , AIMING}
|
|
# Position (debout, accroupi)
|
|
enum STANCE {STANDING , CROUCHING}
|
|
#
|
|
enum VIEW_MODE {THIRD_PERSON , FIRST_PERSON}
|
|
#
|
|
enum VIEW_ANGLE {RIGHT_SHOULDER , LEFT_SHOULDER , HEAD}
|
|
# Type de cape/manteau
|
|
enum MANTLE_TYPE {HIGH_MANTLE , LOW_MANTLE, FALLING_CATCH}
|
|
# Direction du mouvement (devant, droite, gauche, arriere)
|
|
enum MOVEMENT_DIRECTION {FORWARD , RIGHT, LEFT, BACKWARD}
|
|
|
|
|
|
func map_range_clamped(value,InputMin,InputMax,OutputMin,OutputMax):
|
|
value = clamp(value,InputMin,InputMax)
|
|
return ((value - InputMin) / (InputMax - InputMin) * (OutputMax - OutputMin) + OutputMin)
|
|
|
|
|
|
func get_time_text() -> String:
|
|
var time = Time.get_datetime_dict_from_system()
|
|
return "%s/%02d/%02d %02d:%02d:%02d" % [
|
|
time['year'], time['month'], time['day'],
|
|
time['hour'], time['minute'], time['second'],
|
|
]
|
|
|
|
func get_time_only_text() -> String:
|
|
var time = Time.get_datetime_dict_from_system()
|
|
return "%02d:%02d:%02d" % [
|
|
time['hour'], time['minute'], time['second'],
|
|
]
|
|
|
|
func send_message_console(severity:String, format_string:String, array_text:Array) -> void:
|
|
var formattage = "%s %s [%s:%d] " + format_string
|
|
var frame = get_stack()[2]
|
|
var param = [get_time_text(), severity, frame.source, frame.line]
|
|
param.append_array(array_text)
|
|
print( formattage % param )
|
|
|
|
func send_message_app(severity:String, format_string:String, array_text:Array) -> void:
|
|
var formattage = "%s %s [%s:%d] " + format_string
|
|
var frame = get_stack()[2]
|
|
var param = [get_time_text(), severity, frame.source, frame.line]
|
|
param.append_array(array_text)
|
|
update_message.emit(formattage % param)
|
|
|
|
func msg_debug(format_string:String, array_text:Array) -> void:
|
|
if debug_console:
|
|
send_message_console("DEBUG", format_string, array_text)
|
|
if debug_app:
|
|
send_message_app("DEBUG", format_string, array_text)
|
|
|
|
func msg_info(format_string:String, array_text:Array) -> void:
|
|
if verbose_console:
|
|
send_message_console("INFO", format_string, array_text)
|
|
if verbose_app:
|
|
send_message_app("INFO", format_string, array_text)
|
|
|
|
func msg_error(format_string:String, array_text:Array) -> void:
|
|
if error_console:
|
|
send_message_console("ERROR", format_string, array_text)
|
|
if error_app:
|
|
send_message_app("ERROR", format_string, array_text)
|