diff -uwrN sourceold/scripts/SoldierGameObj.h source/scripts/SoldierGameObj.h --- sourceold/scripts/SoldierGameObj.h 2018-11-17 10:23:57.088600000 +1000 +++ source/scripts/SoldierGameObj.h 2018-12-13 16:17:42.213400000 +1000 @@ -203,6 +203,10 @@ void Set_Override_Muzzle_Direction(bool override){OverrideMuzzleDirection = override; Set_Object_Dirty_Bit(BIT_RARE, true);}; bool Get_Override_Muzzle_Direction(){return OverrideMuzzleDirection;}; virtual int Get_Contact_Surface_Type(); + virtual float Get_Skeleton_Heigth( void ); + virtual void Set_Skeleton_Height( float height ); + virtual float Get_Skeleton_Width( void ); + virtual void Set_Skeleton_Width( float width ); protected: RenderObjClass * WeaponRenderModel; //2416 RenderObjClass * BackWeaponRenderModel; //2420 @@ -274,6 +278,10 @@ bool OverrideMuzzleDirection; bool UpdatedTarget; bool DoTilt; + float skeletonHeight; + float skeletonWidth; + float lastSkeletonHeight; + float lastSkeletonWidth; TT_DEPRECATED("Do not use") int Check(void); }; // size: 3404 diff -uwrN sourceold/scripts/jmgUtility.cpp source/scripts/jmgUtility.cpp --- sourceold/scripts/jmgUtility.cpp 2018-11-17 10:23:57.239600000 +1000 +++ source/scripts/jmgUtility.cpp 2018-12-13 16:17:42.216400000 +1000 @@ -9370,7 +9370,7 @@ changeSpawnCapCustom = Get_Int_Parameter("Change_Spawn_Cap_Custom"); sprintf(preset,Get_Parameter("Spawn_Preset")); spawnCount = 0; - int initialSpawn = Get_Int_Parameter("Initial_Spawn"); + initialSpawn = Get_Int_Parameter("Initial_Spawn"); if (initialSpawn == -1) initialSpawn = spawnAtATime; pointMustBeInPathfind = Get_Int_Parameter("Point_Must_Be_In_Pathfind")?true:false; @@ -9381,21 +9381,18 @@ minDistanceBetweenObjects = Get_Float_Parameter("Min_Distance_Between_Objects"); minDistanceBetweenObjects *= minDistanceBetweenObjects; spawnGroupId = Get_Int_Parameter("Spawn_Group_ID"); - for (int x = 0;x < initialSpawn;x++) - for (int y = 0;y < 5;y++) - { - JMG_Utility_Basic_Spawner_In_Radius::SpawnFailureTypes spawnResult = AttemptSpawn(obj); - if (spawnResult == SpawnFailureTypes::SUCCESS) - break; - if (spawnResult == SpawnFailureTypes::LIMIT_REACHED) - x = initialSpawn+1; - } + enabled = Get_Int_Parameter("Starts_Disabled") == 0 ? true : false; + enableDisableCustom = Get_Int_Parameter("Enable_Disable_Custom"); + if (enabled) + Initial_Spawn(obj); Commands->Start_Timer(obj,this,rate+(randomRate ? Commands->Get_Random(-randomRate,randomRate) : 0.0f),1); } void JMG_Utility_Basic_Spawner_In_Radius::Timer_Expired(GameObject *obj,int number) { if (number == 1 && !The_Game()->Is_Game_Over()) { + if (enabled) + { JMG_Utility_Basic_Spawner_In_Radius::SpawnFailureTypes spawnResult = AttemptSpawn(obj); if (spawnResult == SpawnFailureTypes::SPAWN_BLOCKED) { @@ -9405,6 +9402,9 @@ if (spawnResult == SpawnFailureTypes::SUCCESS) Commands->Start_Timer(obj,this,rate+(randomRate ? Commands->Get_Random(-randomRate,randomRate) : 0.0f),1); } + else + Commands->Start_Timer(obj,this,0.1f,1); + } } void JMG_Utility_Basic_Spawner_In_Radius::Custom(GameObject *obj,int message,int param,GameObject *sender) { @@ -9426,6 +9426,12 @@ if (AttemptSpawn(obj) == SpawnFailureTypes::SPAWN_BLOCKED) Commands->Send_Custom_Event(obj,obj,6873525,scriptId,0.1f); } + if (enableDisableCustom && message == enableDisableCustom) + { + enabled = param != 0 ? true : false; + if (param == 1) + Initial_Spawn(obj); + } } JMG_Utility_Basic_Spawner_In_Radius::SpawnFailureTypes JMG_Utility_Basic_Spawner_In_Radius::AttemptSpawn(GameObject *obj) { @@ -9518,6 +9524,18 @@ } return SpawnFailureTypes::SPAWN_BLOCKED; } +void JMG_Utility_Basic_Spawner_In_Radius::Initial_Spawn(GameObject *obj) +{ + for (int x = 0;x < initialSpawn;x++) + for (int y = 0;y < 5;y++) + { + JMG_Utility_Basic_Spawner_In_Radius::SpawnFailureTypes spawnResult = AttemptSpawn(obj); + if (spawnResult == SpawnFailureTypes::SUCCESS) + break; + if (spawnResult == SpawnFailureTypes::LIMIT_REACHED) + x = initialSpawn+1; + } +} bool JMG_Utility_Basic_Spawner_In_Radius::CheckIfObjectIsNearAnotherObject(Vector3 pos) { if (minDistanceBetweenObjects <= 0) @@ -10338,7 +10356,6 @@ } } } - void JMG_Utility_Poke_Send_Custom_From_Poker::Created(GameObject *obj) { Commands->Enable_HUD_Pokable_Indicator(obj,true); @@ -10408,6 +10425,37 @@ lastPlayerCount = playerCount; } } +void JMG_Utility_Custom_Set_Infantry_Height::Created(GameObject *obj) +{ + custom = Get_Int_Parameter("Custom"); + height = Get_Float_Parameter("Height"); +} +void JMG_Utility_Custom_Set_Infantry_Height::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == custom) + { + if (height != -9999.9) + obj->As_SoldierGameObj()->Set_Skeleton_Height(param/100.0f); + else + obj->As_SoldierGameObj()->Set_Skeleton_Height(height); + } +} +void JMG_Utility_Custom_Set_Infantry_Width::Created(GameObject *obj) +{ + custom = Get_Int_Parameter("Custom"); + width = Get_Float_Parameter("Width"); + Commands->Start_Timer(obj,this,0.1f,1); +} +void JMG_Utility_Custom_Set_Infantry_Width::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == custom) + { + if (width != -9999.9) + obj->As_SoldierGameObj()->Set_Skeleton_Width(param/100.0f); + else + obj->As_SoldierGameObj()->Set_Skeleton_Width(width); + } +} ScriptRegistrant JMG_Utility_Check_If_Script_Is_In_Library_Registrant("JMG_Utility_Check_If_Script_Is_In_Library","ScriptName:string,CppName:string"); ScriptRegistrant JMG_Send_Custom_When_Custom_Sequence_Matched_Registrant("JMG_Send_Custom_When_Custom_Sequence_Matched","Success_Custom=0:int,Correct_Step_Custom=0:int,Partial_Failure_Custom=0:int,Failure_Custom=0:int,Send_To_ID=0:int,Custom_0=0:int,Custom_1=0:int,Custom_2=0:int,Custom_3=0:int,Custom_4=0:int,Custom_5=0:int,Custom_6=0:int,Custom_7=0:int,Custom_8=0:int,Custom_9=0:int,Disable_On_Success=1:int,Disable_On_Failure=0:int,Starts_Enabled=1:int,Enable_Custom=0:int,Correct_Step_Saftey=0:int,Failure_Saftey=1:int,Max_Failures=1:int"); ScriptRegistrant JMG_Utility_Change_Model_On_Timer_Registrant("JMG_Utility_Change_Model_On_Timer","Model=null:string,Time=0:float"); @@ -10639,7 +10687,7 @@ ScriptRegistrant JMG_Utility_Credit_Trickle_When_Not_AFK_Registrant("JMG_Utility_Credit_Trickle_When_Not_AFK","Credits=1.0:float,Rate=1.0:float,TrickleCap=0.0:float,Team=2:int,Custom=0:int"); ScriptRegistrant JMG_Utility_Killed_Create_Object_Registrant("JMG_Utility_Killed_Create_Object","Preset:string"); ScriptRegistrant JMG_Utility_Damaged_Create_Object_When_Shield_Zero_Registrant("JMG_Utility_Damaged_Create_Object_When_Shield_Zero","Preset:string"); -ScriptRegistrant JMG_Utility_Basic_Spawner_In_Radius_Registrant("JMG_Utility_Basic_Spawner_In_Radius","Spawn_Preset:string,Spawn_Rate:float,Random_Spawn_Rate:float,Spawn_At_A_Time:int,Min_Spawn_Radius:float,Max_Spawn_Radius:float,Initial_Spawn_Height=0.0:float,Spawn_Limit=-1:int,Spawn_Location=-1.0 -1.0 -1.0:Vector3,X_Multiplier=1.0:float,Y_Multiplier=1.0:float,Collision_Check=1:int,Collision_Retry_Attempts=3:int,Collision_Add_Height=1.0:float,Change_Spawn_Cap_Custom=-1:int,Initial_Spawn=-1:int,Script_ID=-1:int,Point_Must_Be_In_Pathfind=1:int,Manual_Facing=0:int,Face_Location=0.0 0.0 0.0:vector3,Face_Direction=0.0:float,Ignore_Ray_Cast_Failure=0:int,Min_Distance_Between_Objects=0.0:float,Spawn_Group_ID=0:int"); +ScriptRegistrant JMG_Utility_Basic_Spawner_In_Radius_Registrant("JMG_Utility_Basic_Spawner_In_Radius","Spawn_Preset:string,Spawn_Rate:float,Random_Spawn_Rate:float,Spawn_At_A_Time:int,Min_Spawn_Radius:float,Max_Spawn_Radius:float,Initial_Spawn_Height=0.0:float,Spawn_Limit=-1:int,Spawn_Location=-1.0 -1.0 -1.0:Vector3,X_Multiplier=1.0:float,Y_Multiplier=1.0:float,Collision_Check=1:int,Collision_Retry_Attempts=3:int,Collision_Add_Height=1.0:float,Change_Spawn_Cap_Custom=-1:int,Initial_Spawn=-1:int,Script_ID=-1:int,Point_Must_Be_In_Pathfind=1:int,Manual_Facing=0:int,Face_Location=0.0 0.0 0.0:vector3,Face_Direction=0.0:float,Ignore_Ray_Cast_Failure=0:int,Min_Distance_Between_Objects=0.0:float,Spawn_Group_ID=0:int,Starts_Disabled=0:int,Enable_Disable_Custom=0:int"); ScriptRegistrant JMG_Utility_Basic_Spawner_In_Radius_Attached_Registrant("JMG_Utility_Basic_Spawner_In_Radius_Attached","Controller_ID:int,Script_ID:int,Spawn_Group_ID:int"); ScriptRegistrant JMG_Utility_Flying_Vehicle_Crash_Apply_Damage_Registrant("JMG_Utility_Flying_Vehicle_Crash_Apply_Damage","Min_Collision_Speed=33.528:float,Max_Collision_Speed=42.4688:float,Collision_Sound=vehicle_collide_01:string,Explosion_Preset=Plane_Air_Collision:string,Subtract_Min_Speed=0:int"); ScriptRegistrant JMG_Utility_Enemy_Seen_Send_Custom_Registrant("JMG_Utility_Enemy_Seen_Send_Custom","Enemy_Preset_ID:int,ID:int,Visible_Message:int,Visible_Param:int,Not_Visible_Message:int,Not_Visible_Param:int,Max_Lost_Sight_Time=2.5:float"); @@ -10666,3 +10714,5 @@ ScriptRegistrant JMG_Utility_Custom_Send_Custom_On_Script_Count_Registrant("JMG_Utility_Custom_Send_Custom_On_Script_Count","Custom:int,Script:string,MinCount=1,MaxCount=-1:int,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float"); ScriptRegistrant JMG_Utility_Poke_Send_Custom_From_Poker_Registrant("JMG_Utility_Poke_Send_Custom_From_Poker","ID=0:int,Custom=0:int,Param=0:int,Delay=0.0:float,TriggerOnce=1:int,PlayerType=2:int"); ScriptRegistrant JMG_Utility_Custom_Grant_Scaled_Score_Registrant("JMG_Utility_Custom_Grant_Scaled_Score","GrantCustom:int,Score:float,ScoreMultiplier:float,EntireTeam=0:int,MaxPlayerCount=-1:int,Repeat=1:int,GrantToSender=0:int,UpdateScaleCustom=0:int,StopUpdateCustom=0:int"); +ScriptRegistrant JMG_Utility_Custom_Set_Infantry_Height_Registrant("JMG_Utility_Custom_Set_Infantry_Height","Custom:int,Height=-9999.0:float"); +ScriptRegistrant JMG_Utility_Custom_Set_Infantry_Width_Registrant("JMG_Utility_Custom_Set_Infantry_Width","Custom:int,Width=-9999.0:float"); diff -uwrN sourceold/scripts/jmgUtility.h source/scripts/jmgUtility.h --- sourceold/scripts/jmgUtility.h 2018-11-17 10:23:57.241600000 +1000 +++ source/scripts/jmgUtility.h 2018-12-13 16:17:42.218400000 +1000 @@ -6113,6 +6113,8 @@ * \Min_Distance_Between_Objects - If non-zero the script will place objects at least the specified distance away from other objects in the group * \Spawn_Group_ID - The spawn group id which these objects belong to, if -1 or 0 the distance will be checked against all spawn groups (-1 adds the objects to a group, 0 does not) * \ if the value is above 0 the objects will only be checked against other objects with the same value. +* \Starts_Disabled - If set to 1 the script won't be able to spawn objects until an Enable_Disable_Custom with a param of 1 is received +* \Enable_Disable_Custom - Custom used to enable or disable the spawners, if the param is 0 it will be disabled, 1 will attempt to spawn the max, anything else just enables the spawn code * \author jgray * \ingroup JmgUtility */ @@ -6130,6 +6132,7 @@ }; static SList spawnObjectNodeList; private: + bool enabled; float minDistanceBetweenObjects; int spawnGroupId; int scriptId; @@ -6156,12 +6159,15 @@ bool ignoreRayCastFailure; Vector3 faceLocation; float faceDirection; + int enableDisableCustom; + int initialSpawn; void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); void Custom(GameObject *obj,int message,int param,GameObject *sender); SpawnFailureTypes AttemptSpawn(GameObject *obj); bool CheckIfObjectIsNearAnotherObject(Vector3 pos); void SetFacing(GameObject *obj,float facing); + void Initial_Spawn(GameObject *obj); }; /*! @@ -6826,3 +6832,31 @@ void Custom(GameObject *obj,int message,int param,GameObject *sender); void RescaleScore(GameObject *obj); }; \ No newline at end of file + +/*! +* \brief Sets the height scaler for an infantry on a custom +* \Custom - custom to update the height on +* \Height - Height to use, if -9999.0 the param will be used divided by 100 +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Custom_Set_Infantry_Height : public ScriptImpClass { + int custom; + float height; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief Sets the height scaler for an infantry on a custom +* \Custom - custom to update the height on +* \Width - Width to use, if -9999.0 the param will be used divided by 100 +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Custom_Set_Infantry_Width : public ScriptImpClass { + int custom; + float width; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; \ No newline at end of file