mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-21 20:08:40 +03:00
Added float type and default values for trenchbroom integration
This commit is contained in:
@@ -160,13 +160,41 @@ namespace Nuake
|
||||
ClassProperty classProp;
|
||||
classProp.name = t.Name;
|
||||
classProp.type = ClassPropertyType::String;
|
||||
if (t.Type == ExposedVarTypes::String && t.Value.has_value())
|
||||
if (t.Type == ExposedVarTypes::String)
|
||||
{
|
||||
classProp.value = std::any_cast<std::string>(t.Value);
|
||||
if (t.Value.has_value())
|
||||
{
|
||||
classProp.value = std::any_cast<std::string>(t.Value);
|
||||
}
|
||||
|
||||
classProp.type = ClassPropertyType::String;
|
||||
}
|
||||
else if (t.Type == ExposedVarTypes::Int)
|
||||
{
|
||||
classProp.value = std::to_string(std::any_cast<int>(t.Value));
|
||||
if (t.Value.has_value())
|
||||
{
|
||||
classProp.value = std::to_string(std::any_cast<int>(t.Value));
|
||||
}
|
||||
|
||||
classProp.type = ClassPropertyType::Integer;
|
||||
}
|
||||
else if (t.Type == ExposedVarTypes::Float)
|
||||
{
|
||||
if (t.Value.has_value())
|
||||
{
|
||||
classProp.value = std::to_string(std::any_cast<float>(t.Value));
|
||||
}
|
||||
|
||||
classProp.type = ClassPropertyType::Float;
|
||||
}
|
||||
else if (t.Type == ExposedVarTypes::Bool)
|
||||
{
|
||||
if (t.Value.has_value())
|
||||
{
|
||||
classProp.value = std::to_string(std::any_cast<bool>(t.Value));
|
||||
}
|
||||
|
||||
classProp.type = ClassPropertyType::Float;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -199,6 +199,12 @@ namespace Nuake {
|
||||
ev.Value = properties[ev.Name];
|
||||
ev.DefaultValue = ev.Value;
|
||||
}
|
||||
else if (ev.Type == NetScriptExposedVarType::Float)
|
||||
{
|
||||
float value = atof(properties[ev.Name].c_str());
|
||||
ev.Value = value;
|
||||
ev.DefaultValue = ev.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user