diff --git a/godot_custom/hull.cpp b/godot_custom/hull.cpp index cc9a91d..77bc647 100644 --- a/godot_custom/hull.cpp +++ b/godot_custom/hull.cpp @@ -10,15 +10,18 @@ const f32 DT = 0.1; void HullData::_bind_methods() { - DATA_PROP_BIND(linear_acceleration); - DATA_PROP_BIND(linear_velocity_max); - DATA_PROP_BIND(angular_acceleration); - DATA_PROP_BIND(angular_velocity_max); + DATA_PROP_BIND(linear_acceleration, "0,1000,or_greater,suffix:p/s²"); + DATA_PROP_BIND(linear_velocity_max, "0,1000,or_greater,suffix:p/s"); + DATA_PROP_BIND(angular_acceleration, "0,100,or_greater,suffix:rad/s²"); + DATA_PROP_BIND(angular_velocity_max, "0,100,or_greater,suffix:rad/s"); + SET_GET_BIND(armor_cells_max, PackedByteArray, HullData); - SET_GET_BIND(num_turrets, i32, HullData); ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "armor_cells_max"), "set_armor_cells_max", "get_armor_cells_max"); - DATA_PROP_BIND(armor_max); - DATA_PROP_BIND(hull_max); + DATA_PROP_BIND(armor_max, ""); + DATA_PROP_BIND(hull_max, ""); + + SET_GET_BIND(num_turrets, i32, HullData); + ADD_PROPERTY(PropertyInfo(Variant::INT, "num_turrets"), "set_num_turrets", "get_num_turrets"); } SET_GET_IMPL(armor_cells_max, PackedByteArray, HullData); diff --git a/godot_custom/hull.h b/godot_custom/hull.h index a9a6fc0..aa74c9b 100644 --- a/godot_custom/hull.h +++ b/godot_custom/hull.h @@ -57,10 +57,11 @@ void set_##name(f32 value); \ f32 get_##name() const; -#define DATA_PROP_BIND(name) \ +// "min,max[,step][,or_greater][,or_less][,hide_slider][,radians_as_degrees][,degrees][,exp][,suffix:]" +#define DATA_PROP_BIND(name, hint) \ ClassDB::bind_method(D_METHOD(STRINGIFY(set_##name), "value"), &HullData::set_##name); \ ClassDB::bind_method(D_METHOD(STRINGIFY(get_##name)), &HullData::get_##name); \ - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, #name), STRINGIFY(set_##name), STRINGIFY(get_##name)); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, #name, PROPERTY_HINT_RANGE, hint), STRINGIFY(set_##name), STRINGIFY(get_##name)); #define DATA_PROP_IMPL(name) \ void HullData::set_##name(f32 value) { \ diff --git a/simulation/node_2d.tscn b/simulation/node_2d.tscn index 4bb5915..b313fb3 100644 --- a/simulation/node_2d.tscn +++ b/simulation/node_2d.tscn @@ -22,7 +22,6 @@ func _physics_process(delta: float) -> void: [node name="Hull" type="Hull" parent="."] position = Vector2(57, 68) -angular_velocity = 12.5664 data = SubResource("HullData_313hc") wish_linear_velocity_type = 1 wish_linear_velocity = Vector2(100, 0)