//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- bool CNPC_Monk::CreateBehaviors() { AddBehavior( &m_LeadBehavior ); AddBehavior( &m_AssaultBehavior ); return BaseClass::CreateBehaviors(); }
bool CNPC_Barney::CreateBehaviors( void ) { BaseClass::CreateBehaviors(); AddBehavior( &m_FuncTankBehavior ); return true; }
bool CASW_Boomer::CreateBehaviors() { m_ExplodeBehavior.KeyValue( "schedule_chance", "40" ); m_ExplodeBehavior.KeyValue( "schedule_chance_rate", "1" ); //softcopy: explode range, max projectiles cvar //m_ExplodeBehavior.KeyValue( "range", "200" ); //m_ExplodeBehavior.KeyValue( "max_projectiles", "8" ); m_ExplodeBehavior.KeyValue( "range", asw_boomer_explode_range.GetString() ); m_ExplodeBehavior.KeyValue( "max_projectiles",asw_boomer_max_projectile.GetString() ); m_ExplodeBehavior.KeyValue( "max_buildup_time", "3" ); m_ExplodeBehavior.KeyValue( "min_velocity", "150" ); m_ExplodeBehavior.KeyValue( "max_velocity", "450" ); m_ExplodeBehavior.KeyValue( "attach_name", "sack_" ); m_ExplodeBehavior.KeyValue( "attach_count", "12" ); //softcopy: explode damage, radius cvar //m_ExplodeBehavior.KeyValue( "damage", "55" ); //m_ExplodeBehavior.KeyValue( "radius", "240" ); m_ExplodeBehavior.KeyValue( "damage", asw_boomer_explode_damage.GetString() ); m_ExplodeBehavior.KeyValue( "radius", asw_boomer_explode_radius.GetString() ); AddBehavior( &m_ExplodeBehavior ); m_ExplodeBehavior.Init(); //softcopy: melee cvar //m_MeleeBehavior.KeyValue( "range", "140" ); //m_MeleeBehavior.KeyValue( "min_damage", "4" ); //m_MeleeBehavior.KeyValue( "max_damage", "6" ); //m_MeleeBehavior.KeyValue( "force", "4" ); m_MeleeBehavior.KeyValue( "range", asw_boomer_melee_range.GetString() ); m_MeleeBehavior.KeyValue( "min_damage", asw_boomer_melee_min_damage.GetString() ); m_MeleeBehavior.KeyValue( "max_damage", asw_boomer_melee_max_damage.GetString() ); m_MeleeBehavior.KeyValue( "force", asw_boomer_melee_force.GetString() ); AddBehavior( &m_MeleeBehavior ); m_MeleeBehavior.Init(); //softcopy: increase boomer chase distance //m_ChaseEnemyBehavior.KeyValue( "chase_distance", "600" ); m_ChaseEnemyBehavior.KeyValue( "chase_distance", "1100" ); AddBehavior( &m_ChaseEnemyBehavior ); m_ChaseEnemyBehavior.Init(); return BaseClass::CreateBehaviors(); }
//----------------------------------------------------------------------------- // Purpose: // Input: // Output: //----------------------------------------------------------------------------- bool CASW_Ranger::CreateBehaviors() { AddBehavior( &m_CombatStunBehavior ); m_CombatStunBehavior.Init(); AddBehavior( &m_FlinchBehavior ); m_FlinchBehavior.Init(); //m_PrepareToEngageBehavior.KeyValue( "prepare_radius_min", "300" ); //m_PrepareToEngageBehavior.KeyValue( "prepare_radius_max", "600" ); //AddBehavior( &m_PrepareToEngageBehavior ); //m_PrepareToEngageBehavior.Init(); AddBehavior( &m_RetreatBehavior ); m_RetreatBehavior.Init(); m_RangedAttackBehavior.KeyValue( "minRange", "0" ); m_RangedAttackBehavior.KeyValue( "maxRange", "600" ); m_RangedAttackBehavior.KeyValue( "rate", "4.0" ); m_RangedAttackBehavior.KeyValue( "global_shot_delay", "1" ); m_RangedAttackBehavior.KeyValue( "volley_type", "volley1" ); AddBehavior( &m_RangedAttackBehavior ); m_RangedAttackBehavior.Init(); m_ChaseEnemyBehavior.KeyValue( "chase_distance", "200" ); AddBehavior( &m_ChaseEnemyBehavior ); m_ChaseEnemyBehavior.Init(); AddBehavior( &m_IdleBehavior ); m_IdleBehavior.Init(); return BaseClass::CreateBehaviors(); }
//----------------------------------------------------------------------------- // Purpose: // Input: // Output: //----------------------------------------------------------------------------- bool CASW_Shaman::CreateBehaviors() { /* AddBehavior( &m_CombatStunBehavior ); m_CombatStunBehavior.Init(); */ //self.AddBehavior( "behavior_protect", BehaviorParms ); m_HealOtherBehavior.KeyValue( "heal_distance", "300" ); m_HealOtherBehavior.KeyValue( "approach_distance", "120" ); m_HealOtherBehavior.KeyValue( "heal_amount", "0.04" ); // percentage per tick healed m_HealOtherBehavior.KeyValue( "consideration_distance", "800" ); AddBehavior( &m_HealOtherBehavior ); m_HealOtherBehavior.Init(); m_ScuttleBehavior.KeyValue( "pack_range", "800" ); m_ScuttleBehavior.KeyValue( "min_backoff", "150" ); m_ScuttleBehavior.KeyValue( "max_backoff", "300" ); m_ScuttleBehavior.KeyValue( "min_yaw", "10" ); m_ScuttleBehavior.KeyValue( "max_yaw", "25" ); m_ScuttleBehavior.KeyValue( "min_wait", "1.25" ); m_ScuttleBehavior.KeyValue( "max_wait", "2.0" ); AddBehavior( &m_ScuttleBehavior ); m_ScuttleBehavior.Init(); /* AddBehavior( &m_FearBehavior ); m_FearBehavior.Init(); */ AddBehavior( &m_IdleBehavior ); m_IdleBehavior.Init(); return BaseClass::CreateBehaviors(); }
/** * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions. */ Extension() { SetExtensionInformation("PathBehavior", _("Path Behavior"), _("Behavior allowing to move objects on a predefined path"), "Florian Rival", "Open source (MIT License)"); { gd::BehaviorMetadata & aut = AddBehavior("PathBehavior", _("Path"), _("Path"), _("Make objects move on a predefined path."), "", "CppPlatform/Extensions/pathicon.png", "PathBehavior", std::shared_ptr<gd::Behavior>(new PathBehavior), std::shared_ptr<gd::BehaviorsSharedData>(new ScenePathDatas)); #if defined(GD_IDE_ONLY) aut.SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("SetReverseAtEnd", _("De/activate rounding"), _("Activate or desactivate rounding"), _("Activate rounding for _PARAM0_: _PARAM2_"), _("Options"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("yesorno", _("Activate")) .SetFunctionName("SetReverseAtEnd").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("SetStopAtEnd", _("De/activate the stop at the end of the path"), _("Activate or deactivate the stop at the end of the object"), _("Stop _PARAM0_ when the end of the path is reached: _PARAM2_"), _("Options"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("yesorno", _("Activate")) .SetFunctionName("SetStopAtEnd").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddCondition("ReverseAtEnd", _("Rounds"), _("Return true if the object round"), _("_PARAM0_ is rounding"), _("Options"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("ReverseAtEnd").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddCondition("StopAtEnd", _("Stop at the end of the path"), _("Return true if the object stops at the end of its path."), _("_PARAM0_ stops at the end of the path"), _("Options"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("StopAtEnd").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("Reverse", _("Invert the movement on the path"), _("Invert the movement on the path."), _("Invert the sens of the movement of _PARAM0_ on its path"), _("Movement"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("Reverse").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddCondition("GetSegment", _("Number of the segment on the path"), _("True if the number of the current segment on the path satisfies the test."), _("The number of the current segment of the path of _PARAM0_ is _PARAM2__PARAM3_"), _("Position"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("relationalOperator", _("Comparison sign")) .AddParameter("expression", _("Value")) .SetFunctionName("GetCurrentSegment").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("EnterSegment", _("Position on the segment of a path"), _("Put the object directly on specific segment of the path"), _("Do _PARAM2__PARAM3_ to number of the current segment of _PARAM0_"), _("Position"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("operator", _("Modification sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetCurrentSegment").SetGetter("GetCurrentSegment").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddExpression("Segment", _("Current segment"), _("Number of the current segment"), _("Position"), "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("GetCurrentSegment").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddCondition("GetPosition", _("Position of the object on the segment"), _("Return true if the position on the path satisfy the test.\nPosition on a segment is a value between 0 and 1."), _("The position of _PARAM0_ on the current segment is _PARAM2__PARAM3_"), _("Position"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("relationalOperator", _("Comparison sign")) .AddParameter("expression", _("Value")) .SetFunctionName("GetPositionOnSegment").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("SetPosition", _("Put the object on a precise position of the current segment"), _("Put the object on a precise position on the current segment."), _("Put _PARAM0_ on _PARAM2__PARAM3_ on the current segment"), _("Position"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("operator", _("Modification sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetPositionOnSegment").SetGetter("GetPositionOnSegment").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddExpression("Position", _("Position on the segment"), _("Position on the segment ( value between 0 and 1 )"), _("Position"), "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("GetPositionOnSegment").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddCondition("GetPathName", _("Path name"), _("Test the path name."), _("The name of the current path of _PARAM0_ is _PARAM1__PARAM2_"), _("Path"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("relationalOperator", _("Comparison sign")) .AddParameter("string", _("Name")) .SetFunctionName("GetCurrentPathName").SetManipulatedType("string").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("SetPathName", _("Change the path"), _("Change the path used."), _("Set _PARAM2_ as the current path of _PARAM0_"), _("Path"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("string", _("Name")) .SetFunctionName("ChangeCurrentPath").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddStrExpression("CurrentPathName", _("Current path name"), _("Current path name"), _("Path"), "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("GetCurrentPathName").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddCondition("GetOffsetX", _("X position of the path"), _("Return true if the X position satisfies the test."), _("The X position of the path of _PARAM0_ is _PARAM2__PARAM3_"), _("Path position"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("relationalOperator", _("Comparison sign")) .AddParameter("expression", _("Value")) .SetFunctionName("GetOffsetX").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("SetOffsetX", _("Modify the path X position"), _("Change the path X position."), _("Do _PARAM2__PARAM3_ to the X position of the path of _PARAM0_"), _("Path position"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("operator", _("Modification sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetOffsetX").SetGetter("GetOffsetX").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddExpression("PathX", _("X position of the path"), _("X position of the path"), _("Path position"), "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("GetOffsetX").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddCondition("GetOffsetY", _("Path Y position"), _("Return true if the Y position satisfies the test."), _("The Y position of the path of _PARAM0_ is _PARAM2__PARAM3_"), _("Path position"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("relationalOperator", _("Comparison sign")) .AddParameter("expression", _("Value")) .SetFunctionName("GetOffsetY").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("SetOffsetY", _("Modify the path Y position"), _("Change the path Y position."), _("Do _PARAM2__PARAM3_ to the Y position of the path of _PARAM0_"), _("Path position"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("operator", _("Modification sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetOffsetY").SetGetter("GetOffsetY").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddExpression("PathY", _("Path Y position"), _("Path Y position"), _("Path position"), "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("GetOffsetY").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddCondition("GetFollowAngle", _("Automatic rotation"), _("Return true if the object's angle is automatically updated."), _("The angle of _PARAM0_ is automatically updated on the path"), _("Options"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("FollowAngle").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("SetFollowAngle", _("De/activate automatic rotation"), _("Activate or deactivate the automatic update of the angle of the object on the path."), _("Activate automatic rotation of _PARAM0_: _PARAM2_"), _("Options"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("yesorno", _("Activate \?")) .SetFunctionName("SetFollowAngle").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddCondition("GetAngleOffset", _("Angle offset"), _("Return true if the angle offset satifies the condition."), _("The angle offset of _PARAM0_ is _PARAM2__PARAM3_"), _("Options"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("relationalOperator", _("Comparison sign")) .AddParameter("expression", _("Value")) .SetFunctionName("GetAngleOffset").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("SetAngleOffset", _("Change the angle offset"), _("Change the angle offset"), _("Do _PARAM2__PARAM3_ to angle offset of _PARAM0_"), _("Options"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("operator", _("Modification sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetAngleOffset").SetGetter("GetAngleOffset").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddExpression("AngleOffset", _("Angle offset"), _("Add an offset to the angle of the object"), _("Options"), "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("GetAngleOffset").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddCondition("GetSpeed", _("Speed"), _("Return true if the speed satisfy the condition."), _("The speed of _PARAM0_ on the path is _PARAM2__PARAM3_"), _("Movement"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("relationalOperator", _("Comparison sign")) .AddParameter("expression", _("Value")) .SetFunctionName("GetSpeed").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddAction("SetSpeed", _("Change the speed"), _("Change the speed of the object on the path."), _("Do _PARAM1__PARAM2_ to the speed of _PARAM0_ on the path"), _("Movement"), "CppPlatform/Extensions/pathicon24.png", "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .AddParameter("operator", _("Modification sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetSpeed").SetGetter("GetSpeed").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h"); aut.AddExpression("Speed", _("Speed"), _("Moving speed on the path"), _("Movement"), "CppPlatform/Extensions/pathicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathBehavior") .SetFunctionName("GetSpeed").SetIncludeFile("PathBehavior/PathBehavior.h"); #endif }; GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION(); };
//========================================================= // Purpose: //========================================================= bool CNPC_GMan::CreateBehaviors() { AddBehavior( &m_FollowBehavior ); return BaseClass::CreateBehaviors(); }
bool CNPC_Dog::CreateBehaviors( void ) { AddBehavior( &m_FollowBehavior ); return BaseClass::CreateBehaviors(); }
/** * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions. */ Extension() { SetExtensionInformation("Light", _("Light"), _("Allow to display lights and use light obstacles."), "Florian Rival", "Open source (MIT License)"); gd::ObjectMetadata & obj = AddObject<LightObject>( "Light", _("Light"), _("Emits light that can be stopped by objects"), "CppPlatform/Extensions/lightIcon32.png"); AddRuntimeObject<LightObject, RuntimeLightObject>( obj, "RuntimeLightObject"); #if defined(GD_IDE_ONLY) LightObject::LoadEdittimeIcon(); obj.SetIncludeFile("Light/LightObject.h"); obj.AddAction("ChangeColor", _("Color"), _("Change light color."), _("Change color of _PARAM0_ to _PARAM1_"), _("Setup"), "CppPlatform/Extensions/lightIcon24.png", "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .AddParameter("color", _("Color")) .SetFunctionName("SetColor").SetIncludeFile("Light/LightObject.h"); obj.AddAction("Intensity", _("Intensity"), _("Modify the intensity of a light"), _("Do _PARAM1__PARAM2_ to the intensity of _PARAM0_"), _("Setup"), "CppPlatform/Extensions/lightIcon24.png", "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetIntensity").SetManipulatedType("number").SetGetter("GetIntensity").SetIncludeFile("Light/LightObject.h"); obj.AddCondition("Intensity", _("Intensity"), _("Test the intensity of a light."), _("Intensity of _PARAM0_ is _PARAM1__PARAM2_"), _("Setup"), "CppPlatform/Extensions/lightIcon24.png", "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Value to test")) .SetFunctionName("GetIntensity").SetManipulatedType("number").SetIncludeFile("Light/LightObject.h"); obj.AddAction("Radius", _("Radius"), _("Modify the radius of a light"), _("Do _PARAM1__PARAM2_ to radius of _PARAM0_"), _("Setup"), "CppPlatform/Extensions/lightIcon24.png", "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetRadius").SetManipulatedType("number").SetGetter("GetRadius").SetIncludeFile("Light/LightObject.h"); obj.AddCondition("Radius", _("Radius"), _("Test the radius of a light."), _("The radius of _PARAM0_ is _PARAM2_ _PARAM1_"), _("Setup"), "CppPlatform/Extensions/lightIcon24.png", "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Value to test")) .SetFunctionName("GetRadius").SetManipulatedType("number").SetIncludeFile("Light/LightObject.h"); obj.AddAction("Quality", _("Quality"), _("Modify the quality of a light"), _("Do _PARAM1__PARAM2_ to the quality of _PARAM0_"), _("Setup"), "CppPlatform/Extensions/lightIcon24.png", "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetQuality").SetManipulatedType("number").SetGetter("GetQuality").SetIncludeFile("Light/LightObject.h"); obj.AddCondition("Quality", _("Quality"), _("Test the quality of a light"), _("The quality of _PARAM0_ is _PARAM1__PARAM2_"), _("Setup"), "CppPlatform/Extensions/lightIcon24.png", "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Value to test")) .SetFunctionName("GetQuality").SetManipulatedType("number").SetIncludeFile("Light/LightObject.h"); obj.AddAction("ChangeGlobalColor", _("Global color"), _("Change scene color for a global light."), _("Change scene global color of _PARAM0_ to _PARAM1_"), _("Setup"), "CppPlatform/Extensions/lightIcon24.png", "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .AddParameter("color", _("Color")) .SetFunctionName("SetGlobalColor").SetIncludeFile("Light/LightObject.h"); obj.AddAction("SetGlobalLight", _("Make a light global"), _("Make a light global or simple."), _("Make _PARAM0_ global : _PARAM1_"), _("Light type"), "CppPlatform/Extensions/lightIcon24.png", "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .AddParameter("yesorno", _("Make light global")) .SetFunctionName("SetGlobalLight").SetIncludeFile("Light/LightObject.h"); obj.AddCondition("GlobalLight", _("A light is global"), _("Return true if light is global"), _("_PARAM0_ is a global light"), _("Light type"), "CppPlatform/Extensions/lightIcon24.png", "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .SetFunctionName("IsGlobalLight").SetIncludeFile("Light/LightObject.h"); obj.AddExpression("Intensity", _("Intensity"), _("Intensity"), _("Setup"), "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .SetFunctionName("GetIntensity").SetIncludeFile("Light/LightObject.h"); obj.AddExpression("Radius", _("Radius"), _("Radius"), _("Setup"), "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .SetFunctionName("GetRadius").SetIncludeFile("Light/LightObject.h"); obj.AddExpression("Quality", _("Quality"), _("Quality"), _("Setup"), "CppPlatform/Extensions/lightIcon16.png") .AddParameter("object", _("Object"), "Light") .SetFunctionName("GetQuality").SetIncludeFile("Light/LightObject.h"); #endif AddBehavior("LightObstacleBehavior", _("Light obstacle"), _("LightObstacle"), _("Mark the objects as obstacles for Light objects."), "", "CppPlatform/Extensions/lightObstacleIcon32.png", "LightObstacleBehavior", std::shared_ptr<gd::Behavior>(new LightObstacleBehavior), std::shared_ptr<gd::BehaviorsSharedData>(new SceneLightObstacleDatas)); GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION(); };
TimeWidget::TimeWidget(Vector2n Position) : LabelWidget(Position, Content, LabelWidget::Background::Normal) { AddBehavior(new DraggablePositionBehavior(*this)); }
ConceptionApp::ConceptionApp(InputManager & InputManager) : App(InputManager), m_CurrentProject(), m_TypingModule(new TypingModule()) // Gets cleaned up via unique_ptr when pushed back to m_Widgets { PopulateConcepts(); { auto MainCanvas = new Canvas(Vector2n(0, 0), true, true); //MainCanvas->MoveView(0, 336); MainCanvas->MoveView(1, -64); #if 1 { auto StdIncludesList = new ListWidget<ConceptId>(Vector2n::ZERO, m_CurrentProject.GetStdIncludes(), *m_TypingModule); StdIncludesList->m_TapAction = [=](Vector2n LocalPosition, std::vector<ConceptId> & m_List) { auto Entry = m_TypingModule->TakeString(); if (!Entry.empty()) { auto ConceptId = FindOrCreateConcept(Entry); //Insert(ConceptId); // TEST auto Spot = m_List.begin() + (LocalPosition.Y() / lineHeight); m_List.insert(Spot, ConceptId); } else { auto ListEntry = static_cast<decltype(m_List.size())>(LocalPosition.Y() / lineHeight); if (ListEntry < m_List.size()) { m_TypingModule->SetString(GetConcept(m_List[ListEntry]).GetContent()); m_List.erase(m_List.begin() + ListEntry); } } }; auto LabelledStdIncludesList = new FlowLayoutWidget(Vector2n(-280, -250), { std::shared_ptr<Widget>(new LabelWidget(Vector2n::ZERO, std::string("#include <"), LabelWidget::Background::None)), std::shared_ptr<Widget>(StdIncludesList), std::shared_ptr<Widget>(new LabelWidget(Vector2n::ZERO, std::string(">"), LabelWidget::Background::None)) }, {}); LabelledStdIncludesList->AddBehavior(std::shared_ptr<Behavior>(new DraggablePositionBehavior(*LabelledStdIncludesList))); MainCanvas->AddWidget(LabelledStdIncludesList); } #endif MainCanvas->AddWidget(new ButtonWidget(Vector2n(-100, -350), []() { std::cout << "Hi from anon func.\n"; } )); MainCanvas->AddWidget(new ButtonWidget(Vector2n(-60, -350), []() { std::cout << "Second button.\n"; } )); MainCanvas->AddWidget(new ToggleWidget(Vector2n(-20, -350), [](bool State) { std::cout << "Testing this toggle widget! It's now set to " << State << ".\n"; }, true)); MainCanvas->AddWidget(new LiveFunctionWidget(Vector2n(-100, 100), *m_TypingModule, m_CurrentProject)); MainCanvas->AddWidget(new LiveProgramWidget(Vector2n(-100, -300), *m_TypingModule, m_CurrentProject)); MainCanvas->AddWidget(new LiveProgramWidget(Vector2n(-100, -100), *m_TypingModule, m_CurrentProject)); MainCanvas->AddWidget(new LiveGofmtWidget(Vector2n(-460, 200), *m_TypingModule, m_CurrentProject)); MainCanvas->AddWidget(new TextFieldWidget(Vector2n(-460, 160), *m_TypingModule)); MainCanvas->AddWidget(new ShellWidget(Vector2n(-460, 60), *m_TypingModule)); MainCanvas->AddWidget(new SayWidget(Vector2n(-460, -100), *m_TypingModule)); MainCanvas->AddWidget(new ConceptStringBoxWidget(Vector2n(-400, 100 + 400), *m_TypingModule)); // TEST: Modify some Concept { auto Widget = new TextFieldWidget(Vector2n(-320, 470), *m_TypingModule); Widget->SetContent(GetConcept(47).GetContent()); Widget->m_OnChange = [=]() { static_cast<ConceptBasic &>(ModifyConcept(47)).SetContentTEST(Widget->GetContent()); }; Widget->AddBehavior(std::shared_ptr<Behavior>(new DraggablePositionBehavior(*Widget))); MainCanvas->AddWidget(Widget); } // Label resizing test { auto SourceWidget = new TextFieldWidget(Vector2n::ZERO, *m_TypingModule); auto Content = [=]() -> std::string { return SourceWidget->GetContent(); }; auto LabelWidget = new class LabelWidget(Vector2n::ZERO, Content, LabelWidget::Background::Normal); MainCanvas->AddWidget(new FlowLayoutWidget(Vector2n(-100, -450), { std::shared_ptr<Widget>(SourceWidget), std::shared_ptr<Widget>(LabelWidget) }, {})); } // Time widget { auto Content = []() -> std::string { auto now = std::chrono::system_clock::now(); auto duration = now.time_since_epoch(); auto seconds = std::chrono::duration_cast<std::chrono::seconds>(duration).count(); return std::to_string(seconds); }; auto LabelWidget = new class LabelWidget(Vector2n(360, -340), Content, LabelWidget::Background::Normal); LabelWidget->AddBehavior(std::shared_ptr<Behavior>(new DraggablePositionBehavior(*LabelWidget))); MainCanvas->AddWidget(LabelWidget); } MainCanvas->AddWidget(new TimeWidget(Vector2n(360, -360))); // Time widget #if 0 // "./GenProgram.go" file contents displayed (in real-time) in this Label Widget { auto Content = []() -> std::string { //return FromFileToString("./GenProgram.go"); return FromFileToString("/Users/Dmitri/Desktop/goproj_play/src/gist.github.com/4670289.git/gistfile1.go"); }; auto LabelWidget = new class LabelWidget(Vector2n(-546, -186), Content, LabelWidget::Background::Normal); LabelWidget->AddBehavior(std::shared_ptr<Behavior>(new DraggablePositionBehavior(*LabelWidget))); MainCanvas->AddWidget(LabelWidget); } #endif #if 1 { MainCanvas->AddWidget(new ListWidget<Concept *>(Vector2n(-730 - 450, -250), Concepts, *m_TypingModule)); } #endif m_Widgets.push_back(std::unique_ptr<Widget>(m_TypingModule)); m_Widgets.push_back(std::unique_ptr<Widget>(MainCanvas)); m_Widgets.push_back(std::unique_ptr<Widget>(new DebugOverlayWidget())); // DEBUG: Print debug info } // Prepare and start the thread { m_CurrentProject.StartBackgroundThread(); } { // Load program m_CurrentProject.LoadSampleGenProgram(*static_cast<Canvas *>(m_Widgets[0].get())); } }
/** * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions. */ Extension() { SetExtensionInformation("PathfindingBehavior", _("Pathfinding behavior"), _("Compute paths for objects avoiding obstacles."), "Florian Rival", "Open source (MIT License)"); { gd::BehaviorMetadata & aut = AddBehavior("PathfindingBehavior", _("Pathfinding"), "Pathfinding", _("Behavior which move objects and avoid objects flagged as obstacles."), "", "CppPlatform/Extensions/AStaricon.png", "PathfindingBehavior", std::shared_ptr<gd::Behavior>(new PathfindingBehavior), std::shared_ptr<gd::BehaviorsSharedData>(new gd::BehaviorsSharedData)); #if defined(GD_IDE_ONLY) aut.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("SetDestination", _("Move to a position"), _("Move the object to a position"), _("Move _PARAM0_ to _PARAM3_;_PARAM4_"), _(""), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddCodeOnlyParameter("currentScene", "") .AddParameter("expression", _("Destination X position")) .AddParameter("expression", _("Destination Y position")) .SetFunctionName("MoveTo").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("PathFound", _("Path found"), _("Return true if a path has been found."), _("A path has been found for _PARAM0_"), _(""), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("PathFound").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("DestinationReached", _("Destination reached"), _("Return true if destination was reached."), _("_PARAM0_ reached its destination"), _(""), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("DestinationReached").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("CellWidth", _("Width of the cells"), _("Change the width of the cells of the virtual grid."), _("Do _PARAM2__PARAM3_ to the width of the virtual cells of _PARAM0_"), _("Virtual grid"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Width (pixels)")) .SetFunctionName("SetCellWidth").SetGetter("GetCellWidth").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("CellWidth", _("Width of the virtual grid"), _("Compare the width of the cells of the virtual grid."), _("Width of the virtual cells of _PARAM0_ is _PARAM2__PARAM3_"), _("Virtual grid"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Width (pixels)")) .SetFunctionName("GetCellWidth").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("CellHeight", _("Height of the cells"), _("Change the height of the cells of the virtual grid."), _("Do _PARAM2__PARAM3_ to the height of the virtual cells of _PARAM0_"), _("Virtual grid"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Height (pixels)")) .SetFunctionName("SetCellHeight").SetGetter("GetCellHeight").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("CellHeight", _("Height of the virtual grid"), _("Compare the height of the cells of the virtual grid."), _("Height of the virtual cells of _PARAM0_ is _PARAM2__PARAM3_"), _("Virtual grid"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Height (pixels)")) .SetFunctionName("GetCellHeight").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("Acceleration", _("Acceleration"), _("Change the acceleration when moving the object"), _("Do _PARAM2__PARAM3_ to the acceleration of _PARAM0_ on the path"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetAcceleration").SetGetter("GetAcceleration").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("Acceleration", _("Acceleration"), _("Compare the acceleration when moving the object"), _("Acceleration of _PARAM0_ is _PARAM2__PARAM3_"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Value")) .SetFunctionName("GetAcceleration").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("MaxSpeed", _("Maximum speed"), _("Change the maximum speed when moving the object"), _("Do _PARAM2__PARAM3_ to the max. speed of _PARAM0_ on the path"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetMaxSpeed").SetGetter("GetMaxSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("MaxSpeed", _("Maximum speed"), _("Compare the maximum speed when moving the object"), _("Max. speed of _PARAM0_ is _PARAM2__PARAM3_"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Value")) .SetFunctionName("GetMaxSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("Speed", _("Speed"), _("Change the speed of the object on the path"), _("Do _PARAM2__PARAM3_ to the speed of _PARAM0_ on the path"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetSpeed").SetGetter("GetSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("Speed", _("Speed"), _("Compare the speed of the object on the path"), _("Speed of _PARAM0_ is _PARAM2__PARAM3_"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Value")) .SetFunctionName("GetSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("AngularMaxSpeed", _("Angular maximum speed"), _("Change the maximum angular speed when moving the object"), _("Do _PARAM2__PARAM3_ to the max. angular speed of _PARAM0_ on the path"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetAngularMaxSpeed").SetGetter("GetAngularMaxSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("AngularMaxSpeed", _("Angular maximum speed"), _("Compare the maximum angular speed when moving the object"), _("Max. angular speed of _PARAM0_ is _PARAM2__PARAM3_"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Value")) .SetFunctionName("GetAngularMaxSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("AngleOffset", _("Rotation offset"), _("Change the rotation offset applied when moving the object"), _("Do _PARAM2__PARAM3_ to the rotation offset of _PARAM0_ on the path"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Value")) .SetFunctionName("SetAngleOffset").SetGetter("GetAngleOffset").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("AngleOffset", _("Rotation offset"), _("Compare the rotation offset when moving the object"), _("Rotation offset of _PARAM0_ is _PARAM2__PARAM3_"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Value")) .SetFunctionName("GetAngleOffset").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("ExtraBorder", _("Extra border"), _("Change the size of the extra border applied to the object when planning a path"), _("Do _PARAM2__PARAM3_ to the extra border of _PARAM0_ on the path"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Value (in pixels)")) .SetFunctionName("SetExtraBorder").SetGetter("GetExtraBorder").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("ExtraBorder", _("Extra border"), _("Compare the size of the extra border applied to the object when planning a path"), _("Size of the extra border applied to _PARAM0_ is _PARAM2__PARAM3_"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Value (in pixels)")) .SetFunctionName("GetExtraBorder").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("AllowDiagonals", _("Diagonals moves"), _("Allow or restrict diagonal moves on the path"), _("Allow diagonal moves for _PARAM0_ on the path: _PARAM2_"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("yesorno", _("Allow?")) .SetFunctionName("SetAllowDiagonals").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("DiagonalsAllowed", _("Diagonals moves"), _("Return true if the object is allowed to do diagonal moves on the path"), _("Diagonal moves allowed for _PARAM0_"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("DiagonalsAllowed").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddAction("RotateObject", _("Rotate the object"), _("Enable or disable rotation of the object on the path"), _("Enable rotation of _PARAM0_ on the path: _PARAM2_"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("yesorno", _("Rotate object?")) .SetFunctionName("SetRotateObject").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddCondition("ObjectRotated", _("Object rotated"), _("Return true if the object is rotated when traveling on its path."), _("_PARAM0_ is rotated when traveling on its path"), _("Path"), "CppPlatform/Extensions/AStaricon24.png", "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("IsObjectRotated").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("GetNodeX", _("Get a waypoint X position"), _("Get next waypoint X position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("expression", _("Node index (start at 0!)")) .SetFunctionName("GetNodeX").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("GetNodeY", _("Get a waypoint Y position"), _("Get next waypoint Y position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .AddParameter("expression", _("Node index (start at 0!)")) .SetFunctionName("GetNodeY").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("NextNodeIndex", _("Index of the next waypoint"), _("Get the index of the next waypoint to reach"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetNextNodeIndex").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("NodeCount", _("Waypoint count"), _("Get the number of waypoints on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetNodeCount").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("NextNodeX", _("Get next waypoint X position"), _("Get next waypoint X position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetNextNodeX").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("NextNodeY", _("Get next waypoint Y position"), _("Get next waypoint Y position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetNextNodeY").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("LastNodeX", _("Last waypoint X position"), _("Last waypoint X position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetLastNodeX").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("LastNodeY", _("Last waypoint Y position"), _("Last waypoint Y position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetLastNodeY").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("DestinationX", _("Destination X position"), _("Destination X position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetDestinationX").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("DestinationY", _("Destination Y position"), _("Destination Y position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetDestinationY").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("Acceleration", _("Acceleration"), _("Acceleration of the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetAcceleration").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("MaxSpeed", _("Maximum speed"), _("Maximum speed of the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetMaxSpeed").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("Speed", _("Speed"), _("Speed of the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetSpeed").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("AngularMaxSpeed", _("Angular maximum speed"), _("Angular maximum speed of the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetAngularMaxSpeed").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("AngleOffset", _("Rotation offset"), _("Rotation offset applied the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetAngleOffset").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("ExtraBorder", _("Extra border size"), _("Extra border applied the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetExtraBorder").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("CellWidth", _("Width of a cell"), _("Width of the virtual grid"), _("Virtual grid"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetCellWidth").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); aut.AddExpression("CellHeight", _("Height of a cell"), _("Height of the virtual grid"), _("Virtual grid"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingBehavior") .SetFunctionName("GetCellHeight").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h"); #endif } { gd::BehaviorMetadata & aut = AddBehavior("PathfindingObstacleBehavior", _("Obstacle for pathfinding"), "PathfindingObstacle", _("Flag the object as being an obstacle for pathfinding."), "", "CppPlatform/Extensions/pathfindingobstacleicon.png", "PathfindingObstacleBehavior", std::shared_ptr<gd::Behavior>(new PathfindingObstacleBehavior), std::shared_ptr<gd::BehaviorsSharedData>(new gd::BehaviorsSharedData)); #if defined(GD_IDE_ONLY) aut.SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h"); aut.AddAction("Cost", _("Cost"), _("Change the cost of going through the object."), _("Do _PARAM2__PARAM3_ to the cost of _PARAM0_"), _("Obstacles"), "CppPlatform/Extensions/pathfindingobstacleicon24.png", "CppPlatform/Extensions/pathfindingobstacleicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior") .AddParameter("operator", _("Modification's sign")) .AddParameter("expression", _("Difficulty")) .SetFunctionName("SetCost").SetGetter("GetCost").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h"); aut.AddCondition("Cost", _("Cost"), _("Compare the cost of going through the object"), _("Cost of _PARAM0_ is _PARAM2__PARAM3_"), _("Obstacles"), "CppPlatform/Extensions/pathfindingobstacleicon24.png", "CppPlatform/Extensions/pathfindingobstacleicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior") .AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("expression", _("Difficulty")) .SetFunctionName("GetCost").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h"); aut.AddAction("SetImpassable", _("Set impassable"), _("Set the object as being an impassable obstacle or not"), _("Set _PARAM0_ as an impassable obstacle: _PARAM2_"), _("Obstacles"), "CppPlatform/Extensions/pathfindingobstacleicon24.png", "CppPlatform/Extensions/pathfindingobstacleicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior") .AddParameter("yesorno", _("Impassable?")) .SetFunctionName("SetImpassable").SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h"); aut.AddCondition("IsImpassable", _("Is impassable"), _("Return true if the obstacle is impassable"), _("_PARAM0_ is impassable"), _("Obstacles"), "CppPlatform/Extensions/pathfindingobstacleicon24.png", "CppPlatform/Extensions/pathfindingobstacleicon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior") .SetFunctionName("IsImpassable").SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h"); aut.AddExpression("Cost", _("Cost"), _("Obstacle cost"), _("Obstacles"), "CppPlatform/Extensions/AStaricon16.png") .AddParameter("object", _("Object")) .AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior") .SetFunctionName("GetCost").SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h"); #endif } GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION(); };
//----------------------------------------------------------------------------- // Purpose: // Input : - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CNPC_Stalker::CreateBehaviors() { AddBehavior( &m_ActBusyBehavior ); return BaseClass::CreateBehaviors(); }