Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions gamedata/scripts/lua_help_ex.script
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@
sphere,
box,
}

debug_render {
DBG_ScriptObject* add_object(u32 id, DebugRenderType type)
DBG_ScriptObject* add_object(LPCSTR id, DebugRenderType type)
Expand Down Expand Up @@ -544,13 +545,18 @@
// }
// level.add_bullet(t)

// Script Attachments
// Script Attachments
function add_attachment(string, string)
function get_attachment(string)
function remove_attachment(string)
function remove_attachment(script_attachment)
function iterate_attachments(function)

// Post-Process Effectors
float get_pp_effector_factor(int id)
float get_pp_effector_length(int id)
bool check_pp_effector(int id)

// MT only
function scheduler_flush(bool)
}
Expand Down Expand Up @@ -1279,5 +1285,5 @@
property userdata
}

Script Attachment Guide: https://igigog.github.io/anomaly-modding-book/tutorials/scripting/script-attachments.html
Script Attachment Guide: https://anomaly-modding-book.netlify.app/docs/tutorials/scripting/script-attachments
--]]
2 changes: 1 addition & 1 deletion gamedata/scripts/lua_help_imgui.script
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Basic ImGui scripting guide: https://igigog.github.io/anomaly-modding-book/tutorials/scripting/imgui.html
-- Basic ImGui scripting guide: https://anomaly-modding-book.netlify.app/docs/tutorials/scripting/imgui
--[[
namespace ImGui
{
Expand Down
5 changes: 5 additions & 0 deletions src/xrGame/PostprocessAnimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ void CPostprocessAnimator::SetDesiredFactor(float f, float sp)
VERIFY(_valid(m_dest_factor));
};

float CPostprocessAnimator::GetCurrentFactor()
{
return m_factor;
};

void CPostprocessAnimator::SetCurrentFactor(float f)
{
m_factor = f;
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/PostprocessAnimator.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class CPostprocessAnimator
IC LPCSTR Name() { return *m_Name; }
virtual void Stop(float speed);
void SetDesiredFactor(float f, float sp);
float GetCurrentFactor();
void SetCurrentFactor(float f);
void SetCyclic(bool b) { m_bCyclic = b; }
float GetLength();
Expand Down
54 changes: 40 additions & 14 deletions src/xrGame/level_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,16 +1057,38 @@ void remove_pp_effector(int id)

void set_pp_effector_factor(int id, float f, float f_sp)
{
CPostprocessAnimator* pp = smart_cast<CPostprocessAnimator*>(Actor()->Cameras().GetPPEffector((EEffectorPPType)id));
CPostprocessAnimator* pp = smart_cast<CPostprocessAnimator*>(Actor()->Cameras().GetPPEffector((EEffectorPPType)id));

if (pp) pp->SetDesiredFactor(f, f_sp);
if (pp) pp->SetDesiredFactor(f, f_sp);
}

void set_pp_effector_factor2(int id, float f)
{
CPostprocessAnimator* pp = smart_cast<CPostprocessAnimator*>(Actor()->Cameras().GetPPEffector((EEffectorPPType)id));
CPostprocessAnimator* pp = smart_cast<CPostprocessAnimator*>(Actor()->Cameras().GetPPEffector((EEffectorPPType)id));

if (pp) pp->SetCurrentFactor(f);
}

bool check_pp_effector(int id)
{
CPostprocessAnimator* pp = smart_cast<CPostprocessAnimator*>(Actor()->Cameras().GetPPEffector((EEffectorPPType)id));
if (pp)
{
return pp->Valid();
}
return false;
}

if (pp) pp->SetCurrentFactor(f);
float get_pp_effector_factor(int id)
{
CPostprocessAnimator* pp = smart_cast<CPostprocessAnimator*>(Actor()->Cameras().GetPPEffector((EEffectorPPType)id));
return pp ? pp->GetCurrentFactor() : 0.0f;
}

float get_pp_effector_length(int id)
{
CPostprocessAnimator* pp = smart_cast<CPostprocessAnimator*>(Actor()->Cameras().GetPPEffector((EEffectorPPType)id));
return pp ? pp->GetLength() : 0.0f;
}

#include "relation_registry.h"
Expand Down Expand Up @@ -2556,7 +2578,6 @@ void CLevel::script_register(lua_State* L)

def("map_add_object_spot_ser", map_add_object_spot_ser),
def("map_add_object_spot", map_add_object_spot),
//- def("map_add_object_spot_complex", map_add_object_spot_complex),
def("map_remove_object_spot", map_remove_object_spot),
def("map_has_object_spot", map_has_object_spot),
def("map_change_spot_hint", map_change_spot_hint),
Expand All @@ -2578,13 +2599,10 @@ void CLevel::script_register(lua_State* L)
def("show_indicators", show_indicators),
def("show_weapon", show_weapon),
def("add_call", ((void (*)(const ::luabind::functor<bool>&, const ::luabind::functor<void>&))&add_call)),
def("add_call", ((void (*)(const ::luabind::object&, const ::luabind::functor<bool>&,
const ::luabind::functor<void>&))&add_call)),
def("add_call", ((void (*)(const ::luabind::object&, const ::luabind::functor<bool>&, const ::luabind::functor<void>&))&add_call)),
def("add_call", ((void (*)(const ::luabind::object&, LPCSTR, LPCSTR))&add_call)),
def("remove_call", ((void (*)(const ::luabind::functor<bool>&, const ::luabind::functor<void>&))&remove_call)),
def("remove_call",
((void (*)(const ::luabind::object&, const ::luabind::functor<bool>&, const ::luabind::functor<void>&))&
remove_call)),
def("remove_call", ((void (*)(const ::luabind::object&, const ::luabind::functor<bool>&, const ::luabind::functor<void>&))&remove_call)),
def("remove_call", ((void (*)(const ::luabind::object&, LPCSTR, LPCSTR))&remove_call)),
def("remove_calls_for_object", remove_calls_for_object),
def("present", is_level_present),
Expand All @@ -2606,8 +2624,8 @@ void CLevel::script_register(lua_State* L)
def("add_cam_effector", ((float (*)(LPCSTR, int, bool, LPCSTR, float))&add_cam_effector)),
def("add_cam_effector", ((float (*)(LPCSTR, int, bool, LPCSTR, float, bool))&add_cam_effector)),
def("add_cam_effector", ((float (*)(LPCSTR, int, bool, LPCSTR, float, bool, float))&add_cam_effector)),
// ver; allow changing the speed of cam effectors
def("add_cam_effector", ((float (*)(LPCSTR, int, bool, LPCSTR, float, bool, float, float))& add_cam_effector)),
// ver; allow changing the speed of cam effectors
def("add_cam_effector", ((float (*)(LPCSTR, int, bool, LPCSTR, float, bool, float, float))& add_cam_effector)),

// demonized: Set custom camera position and direction with movement smoothing (for cutscenes, etc)
def("set_cam_custom_position_direction", ((void (*)(Fvector&, Fvector&, unsigned int, bool, bool))& set_cam_position_direction)),
Expand All @@ -2617,15 +2635,23 @@ void CLevel::script_register(lua_State* L)
def("set_cam_custom_position_direction", ((void (*)(Fvector&, Fvector&))&set_cam_position_direction)),
def("remove_cam_custom_position_direction", &remove_cam_position_direction),

def("add_cam_effector", ((float (*)(LPCSTR, int, bool, LPCSTR))& add_cam_effector)),
def("add_cam_effector", ((float (*)(LPCSTR, int, bool, LPCSTR, float))& add_cam_effector)),
def("add_cam_effector", ((float (*)(LPCSTR, int, bool, LPCSTR, float, bool))& add_cam_effector)),
def("add_cam_effector", ((float (*)(LPCSTR, int, bool, LPCSTR, float, bool, float))& add_cam_effector)),
def("remove_cam_effector", &remove_cam_effector),
def("set_cam_effector_factor", &set_cam_effector_factor),
def("get_cam_effector_factor", &get_cam_effector_factor),
def("get_cam_effector_length", &get_cam_effector_length),
def("check_cam_effector", &check_cam_effector),

def("add_pp_effector", &add_pp_effector),
def("remove_pp_effector", &remove_pp_effector),
def("set_pp_effector_factor", &set_pp_effector_factor),
def("set_pp_effector_factor", &set_pp_effector_factor2),
def("remove_pp_effector", &remove_pp_effector),
def("set_pp_effector_factor", &set_pp_effector_factor2),
def("get_pp_effector_factor", &get_pp_effector_factor),
def("get_pp_effector_length", &get_pp_effector_length),
def("check_pp_effector", &check_pp_effector),

def("add_complex_effector", &add_complex_effector),
def("remove_complex_effector", &remove_complex_effector),
Expand Down