added NPCs to character sample script and some other updates

This commit is contained in:
Turánszki János
2023-01-13 16:23:35 +01:00
parent bb3b1fa7ba
commit f90663c814
9 changed files with 870 additions and 489 deletions
@@ -1025,7 +1025,9 @@ Describes a Collider object.
#### ExpressionComponent
- FindExpressionID(string name) : int -- Find an expression within the ExpressionComponent by name
- SetWeight(int id, float weight) -- Set expression weight by ID. The ID can be a non-preset expression. Use FindExpressionID() to retrieve non-preset expression IDs
- GetWeight(int id) : float -- returns current weight of expression
- SetPresetWeight(ExpressionPreset preset, float weight) -- Set a preset expression's weight. You can get access to preset values from ExpressionPreset table
- GetPresetWeight(ExpressionPreset preset) : float -- returns current weight of preset expression
[outer] ExpressionPreset = {
Happy = 0,
@@ -22,7 +22,7 @@ function zone_expression(zone_entity, expression_preset, expression_string)
local str = "If character gets close to this, it will be " .. expression_string .. "\n"
if zone_active then
str = str .. "...and a character is currently" .. expression_string .. "!"
str = str .. "...and a character is currently " .. expression_string .. "!"
else
str = str .. "...but no one is " .. expression_string .. " currently."
end
@@ -15,8 +15,6 @@ if zone_transform ~= nil then
humanoid.SetLookAtEnabled(true)
humanoid.SetLookAt(zone_pos)
zone_active = true
else
humanoid.SetLookAtEnabled(false)
end
end
end
File diff suppressed because it is too large Load Diff
@@ -2029,7 +2029,7 @@ runProcess(function()
application.SetActivePath(prevPath)
return
end
if(input.Press(string.byte('R'))) then
if(not backlog_isactive() and input.Press(string.byte('R'))) then
-- reload script
backlog_post("RELOAD")
killProcesses()
+45
View File
@@ -5299,6 +5299,8 @@ Luna<ExpressionComponent_BindLua>::FunctionType ExpressionComponent_BindLua::met
lunamethod(ExpressionComponent_BindLua, FindExpressionID),
lunamethod(ExpressionComponent_BindLua, SetWeight),
lunamethod(ExpressionComponent_BindLua, SetPresetWeight),
lunamethod(ExpressionComponent_BindLua, GetWeight),
lunamethod(ExpressionComponent_BindLua, GetPresetWeight),
{ NULL, NULL }
};
Luna<ExpressionComponent_BindLua>::PropertyType ExpressionComponent_BindLua::properties[] = {
@@ -5373,6 +5375,49 @@ int ExpressionComponent_BindLua::SetPresetWeight(lua_State* L)
}
return 0;
}
int ExpressionComponent_BindLua::GetWeight(lua_State* L)
{
int argc = wi::lua::SGetArgCount(L);
if (argc > 0)
{
int id = wi::lua::SGetInt(L, 1);
if (id >= 0 && component->expressions.size() > id)
{
wi::lua::SSetFloat(L, component->expressions[id].weight);
}
else
{
wi::lua::SError(L, "GetWeight(int id) id is out of bounds!");
}
}
else
{
wi::lua::SError(L, "GetWeight(int id) not enough arguments!");
}
return 0;
}
int ExpressionComponent_BindLua::GetPresetWeight(lua_State* L)
{
int argc = wi::lua::SGetArgCount(L);
if (argc > 0)
{
ExpressionComponent::Preset preset = (ExpressionComponent::Preset)wi::lua::SGetInt(L, 1);
int id = component->presets[size_t(preset)];
if (id >= 0 && component->expressions.size() > id)
{
wi::lua::SSetFloat(L, component->expressions[id].weight);
}
else
{
wi::lua::SError(L, "GetPresetWeight(ExpressionPreset preset) preset doesn't exist!");
}
}
else
{
wi::lua::SError(L, "GetPresetWeight(ExpressionPreset preset) not enough arguments!");
}
return 0;
}
+2
View File
@@ -1693,6 +1693,8 @@ namespace wi::lua::scene
int FindExpressionID(lua_State* L);
int SetWeight(lua_State* L);
int SetPresetWeight(lua_State* L);
int GetWeight(lua_State* L);
int GetPresetWeight(lua_State* L);
};
class HumanoidComponent_BindLua
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 71;
// minor bug fixes, alterations, refactors, updates
const int revision = 134;
const int revision = 135;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);