diff -uwrN sourceold/scripts/jmgBearHunter.cpp source/scripts/jmgBearHunter.cpp --- sourceold/scripts/jmgBearHunter.cpp 2017-09-14 15:51:54.177000000 +1000 +++ source/scripts/jmgBearHunter.cpp 2017-11-21 06:09:15.531400000 +1000 @@ -2465,6 +2465,7 @@ } else floodLightId = 0; + stealthModeOverride = Get_Int_Parameter("StealthModeOverride"); Commands->Enable_Enemy_Seen(obj,true); Commands->Enable_Hibernation(obj,false); Commands->Start_Timer(obj,this,0.25f,1); @@ -2473,6 +2474,8 @@ { if (Is_Script_Attached(seen,"JMG_Security_Camera_Behavior_Ignore")) return; + if (!JmgUtility::CanSeeStealth(stealthModeOverride,obj,seen)) + return; int seenID = Commands->Get_ID(seen); if (!EnemyID) { @@ -7813,7 +7816,7 @@ ScriptRegistrant JMG_Rp2_Hostile_Mutant_AI_Registrant("JMG_Rp2_Hostile_Mutant_AI",""); ScriptRegistrant JMG_Bear_Hunt_Mutant_Attacker_Registrant("JMG_Bear_Hunt_Mutant_Attacker","Speed:float"); ScriptRegistrant JMG_Bear_Hunter_Animal_Control_Registrant("JMG_Bear_Hunter_Animal_Control",""); -ScriptRegistrant JMG_Security_Camera_Behavior_Registrant("JMG_Security_Camera_Behavior","Angle:float,Alarm_ID=0:int,Is_Gun=1:int,Delay=0:float,Alarm_Message=0:int,Alarm_Sound=Beep:string,UpdateRateMultiplier=1.0:float,IdleAimZAngleModifier=0.0:float,FloodLightPreset=null:string,Power_Message=0:int"); +ScriptRegistrant JMG_Security_Camera_Behavior_Registrant("JMG_Security_Camera_Behavior","Angle:float,Alarm_ID=0:int,Is_Gun=1:int,Delay=0:float,Alarm_Message=0:int,Alarm_Sound=Beep:string,UpdateRateMultiplier=1.0:float,IdleAimZAngleModifier=0.0:float,FloodLightPreset=null:string,Power_Message=0:int,StealthModeOverride=0:int"); ScriptRegistrant JMG_Bear_Hunt_Mutant_Cat_Explosion_Registrant("JMG_Bear_Hunt_Mutant_Cat_Explosion","KillSelfExplosion:string,KilledExplosion:string"); ScriptRegistrant JMG_Bear_Hunter_President_Controller_Registrant("JMG_Bear_Hunter_President_Controller",""); ScriptRegistrant JMG_Bear_Hunter_Turret_Death_Alert_Registrant("JMG_Bear_Hunter_Turret_Death_Alert",""); diff -uwrN sourceold/scripts/jmgBearHunter.h source/scripts/jmgBearHunter.h --- sourceold/scripts/jmgBearHunter.h 2017-09-29 06:54:46.827200000 +1000 +++ source/scripts/jmgBearHunter.h 2017-11-21 06:09:14.712400000 +1000 @@ -2294,6 +2294,7 @@ int CameraFacingCount; int IncreaseOrDecreaseCount; int SeenTime; + int stealthModeOverride; Vector3 CameraFacingLocation[5]; float CameraFacingUpdateTime; void Created(GameObject *obj); diff -uwrN sourceold/scripts/jmgMetroid.cpp source/scripts/jmgMetroid.cpp --- sourceold/scripts/jmgMetroid.cpp 2017-05-08 20:26:23.666009000 +1000 +++ source/scripts/jmgMetroid.cpp 2017-11-21 06:08:14.892400000 +1000 @@ -2686,12 +2686,6 @@ Commands->Start_Timer(obj,this,1.0f,1); } } -void JMG_Metroid_Lockdown_Controller::Destroyed(GameObject *obj) -{ - char msg[220]; - sprintf(msg,"msg controller destroyed %d",Get_Int_Parameter("LockDownZoneID")); - Console_Input(msg); -} void JMG_Metroid_Lockdown_Lockdown_Object::Created(GameObject *obj) { RoomLockdownControl[Get_Int_Parameter("LockDownZoneID")].AddLockdownBlocker(obj); diff -uwrN sourceold/scripts/jmgMetroid.h source/scripts/jmgMetroid.h --- sourceold/scripts/jmgMetroid.h 2017-05-08 20:26:23.666009000 +1000 +++ source/scripts/jmgMetroid.h 2017-11-21 06:08:14.894400000 +1000 @@ -3530,7 +3530,6 @@ class JMG_Metroid_Lockdown_Controller : public ScriptImpClass { void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); - void Destroyed(GameObject *obj); }; class JMG_Metroid_Lockdown_Lockdown_Object : public ScriptImpClass { diff -uwrN sourceold/scripts/jmgUtility.cpp source/scripts/jmgUtility.cpp --- sourceold/scripts/jmgUtility.cpp 2017-09-29 06:54:46.829200000 +1000 +++ source/scripts/jmgUtility.cpp 2017-11-21 06:09:16.897400000 +1000 @@ -331,6 +331,7 @@ { if (!clientNetworkObjectPositionSyncControl) { + if (!The_Game()->Is_Game_Over()) Console_Input("msg JMG_Utility_Sync_System_Object ERROR: Make sure there is a JMG_Utility_Sync_System_Controller on the map!"); return; } @@ -553,7 +554,7 @@ { if (!canFight) return; - if (seen->As_SmartGameObj() && seen->As_SmartGameObj()->Is_Stealthed() && JmgUtility::SimpleDistance(Commands->Get_Position(obj),Commands->Get_Position(seen)) > 900) + if (!JmgUtility::CanSeeStealth(0,obj,seen)) return; if (targetId && targetUpdate) return; @@ -2460,6 +2461,7 @@ EnemyID = 0; EnemyTimeOutTime = 0; LastPos = Commands->Get_Position(obj); + stealthModeOverride = Get_Int_Parameter("StealthModeOverride"); Commands->Enable_Enemy_Seen(obj,true); Commands->Enable_Engine(obj,true); Commands->Start_Timer(obj,this,1.0f,1); @@ -2498,6 +2500,8 @@ { if (Is_Script_Attached(seen,"JMG_Utility_AI_Guardian_Ignored")) return; + if (!JmgUtility::CanSeeStealth(stealthModeOverride,obj,seen)) + return; if (!EnemyID || !EnemyTimeOutTime) { EnemyID = Commands->Get_ID(seen); @@ -3436,7 +3440,9 @@ MoveablePhysClass *mphys = sender->As_PhysicalGameObj() ? sender->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL; if (mphys && mphys->Find_Teleport_Location(TargetPos,Get_Float_Parameter("MaxDistance"),&TargetPos)) { + Toggle_Fly_Mode(sender); Commands->Set_Position(sender,TargetPos); + Toggle_Fly_Mode(sender); Force_Position_Update(sender); float facing = Get_Float_Parameter("Facing"); if (Is_Script_Attached(sender,"JMG_Utility_Delay_Then_Rotate_Camera")) @@ -3935,6 +3941,7 @@ EnemyID = 0; EnemyTimeOutTime = 0; LastPos = Commands->Get_Position(obj); + stealthModeOverride = Get_Int_Parameter("StealthModeOverride"); Commands->Enable_Enemy_Seen(obj,true); Commands->Enable_Engine(obj,true); Commands->Start_Timer(obj,this,1.0f,1); @@ -3975,6 +3982,8 @@ { if (Is_Script_Attached(seen,"JMG_Utility_AI_Guardian_Ignored")) return; + if (!JmgUtility::CanSeeStealth(stealthModeOverride,obj,seen)) + return; if (!EnemyID || !EnemyTimeOutTime) { EnemyID = Commands->Get_ID(seen); @@ -4452,8 +4461,10 @@ MoveablePhysClass *mphys = enter->As_PhysicalGameObj() ? enter->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL; if (mphys && mphys->Find_Teleport_Location(targetPos,safeTeleportDistance,&targetPos)) { + Toggle_Fly_Mode(enter); Commands->Set_Position(enter,targetPos); Force_Position_Update(enter); + Toggle_Fly_Mode(enter); char params[220]; sprintf(params,"0.1,%.2f",facing); Commands->Attach_Script(enter,"JMG_Utility_Delay_Then_Rotate_Camera",params); @@ -4482,8 +4493,10 @@ MoveablePhysClass *mphys = obj->As_PhysicalGameObj() ? obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL; if (mphys && mphys->Find_Teleport_Location(targetPos,safeTeleportDistance,&targetPos)) { + Toggle_Fly_Mode(obj); Commands->Set_Position(obj,targetPos); Force_Position_Update(obj); + Toggle_Fly_Mode(obj); char params[220]; sprintf(params,"0.1,%.2f",facing); Commands->Attach_Script(obj,"JMG_Utility_Delay_Then_Rotate_Camera",params); @@ -4679,8 +4692,10 @@ MoveablePhysClass *mphys = player->As_PhysicalGameObj() ? player->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL; if (mphys && mphys->Find_Teleport_Location(targetPos,safeTeleportDistance,&targetPos)) { + Toggle_Fly_Mode(player); Commands->Set_Position(player,targetPos); Force_Position_Update(player); + Toggle_Fly_Mode(player); char params[220]; sprintf(params,"0.1,%.2f",facing); Commands->Attach_Script(player,"JMG_Utility_Delay_Then_Rotate_Camera",params); @@ -5852,6 +5867,7 @@ EnemyID = 0; EnemyTimeOutTime = 0; LastPos = Commands->Get_Position(obj); + stealthModeOverride = Get_Int_Parameter("StealthModeOverride"); Commands->Enable_Enemy_Seen(obj,true); Commands->Enable_Engine(obj,true); Commands->Start_Timer(obj,this,1.0f,1); @@ -5922,6 +5938,8 @@ { if (Is_Script_Attached(seen,"JMG_Utility_AI_Guardian_Ignored")) return; + if (!JmgUtility::CanSeeStealth(stealthModeOverride,obj,seen)) + return; if (!EnemyID || !EnemyTimeOutTime) { EnemyID = Commands->Get_ID(seen); @@ -6310,6 +6328,7 @@ { if (!JMG_Utility_Set_Screen_Color_Fade_Controller::controllerPlaced) { + if (!The_Game()->Is_Game_Over()) Console_Input("msg JMG_Utility_Set_Screen_Color_Fade_On_Enter ERROR: You need to place JMG_Utility_Set_Screen_Color_Fade_Controller on an object in order to use this script!"); return; } @@ -6479,7 +6498,6 @@ bool JMG_Utility_HUD_Count_Down::controllerPlaced = false; void JMG_Utility_HUD_Count_Down::Created(GameObject *obj) { - sendCustomOnSecondController = NULL; seconds = Get_Int_Parameter("TimeInSeconds"); stringId = Get_Int_Parameter("StringID"); color = Get_Vector3_Parameter("Color"); @@ -6512,9 +6530,7 @@ JmgUtility::SetHUDHelpText(stringId,formatReminderString(warningMessage,seconds/60,seconds/60 == 1 ? minuteSingular : minutePlural),color); else if (seconds && (seconds <= 10 || seconds == 30 || seconds == 20)) JmgUtility::SetHUDHelpText(stringId,formatReminderString(warningMessage,seconds,seconds == 1 ? secondSingular : secondPlural),color); - SendCustomOnSecondNode *node = FindSecondNode(seconds); - if (node) - Commands->Send_Custom_Event(obj,Commands->Find_Object(node->id),node->custom,node->param,node->delay); + NodeSendCustom(obj,seconds); } Commands->Start_Timer(obj,this,1.0f,1); } @@ -7400,9 +7416,9 @@ { if (debug) { - char debug[220]; - sprintf(debug,"msg %s",Commands->Get_Preset_Name(o)); - Console_Input(debug); + char debugMsg[220]; + sprintf(debugMsg,"msg %s",Commands->Get_Preset_Name(o)); + Console_Input(debugMsg); } found = true; break; @@ -7725,6 +7741,7 @@ EnemyID = 0; EnemyTimeOutTime = 0; LastPos = Commands->Get_Position(obj); + stealthModeOverride = Get_Int_Parameter("StealthModeOverride"); Commands->Enable_Enemy_Seen(obj,true); Commands->Enable_Engine(obj,true); Commands->Start_Timer(obj,this,1.0f,1); @@ -7766,6 +7783,8 @@ { if (Is_Script_Attached(seen,"JMG_Utility_AI_Guardian_Ignored")) return; + if (!JmgUtility::CanSeeStealth(stealthModeOverride,obj,seen)) + return; if (!EnemyID || !EnemyTimeOutTime) { EnemyID = Commands->Get_ID(seen); @@ -8892,7 +8911,6 @@ if (points != -1) Set_Damage_Points(obj,points); } - bool JMG_Utility_Detect_AFK_Controller::controllerPlaced = false; bool JMG_Utility_Detect_AFK_Controller::isAFK[128] = {false}; void JMG_Utility_Detect_AFK_Controller::Created(GameObject *obj) @@ -9069,7 +9087,7 @@ ScriptRegistrant JMG_Utility_Zone_Enable_Spawners_In_Range_Registrant("JMG_Utility_Zone_Enable_Spawners_In_Range","StartID:int,EndID:int,PlayerType=2:int,Enable=1:int,TriggerOnce=1:int"); ScriptRegistrant JMG_Utility_Display_Message_On_Vehicle_Enter_Registrant("JMG_Utility_Display_Message_On_Vehicle_Enter","StringId:int,MessageOverride=null:string,Color[R|G|B]=0.0 1.0 0.0:vector3,DriverOnly=1:int,ShowOnce=1:int,PlayerType=2:int"); ScriptRegistrant JMG_Utility_Zone_Apply_Damage_On_Enter_Registrant("JMG_Utility_Zone_Apply_Damage_On_Enter","ID:int,DamageAmount:float,Warhead=None:string,DamageOccupants=1:int,PlayerType=2:int,OnlyOnce=0:int"); -ScriptRegistrant JMG_Utility_AI_Guardian_Aircraft_Registrant("JMG_Utility_AI_Guardian_Aircraft","WanderingAIGroupID:int,FlightHeight=25.0:float,FireRange=100.0:float,FaceTarget=1:int"); +ScriptRegistrant JMG_Utility_AI_Guardian_Aircraft_Registrant("JMG_Utility_AI_Guardian_Aircraft","WanderingAIGroupID:int,FlightHeight=25.0:float,FireRange=100.0:float,FaceTarget=1:int,StealthModeOverride=0:int"); ScriptRegistrant JMG_Utility_Switch_Weapon_While_Primary_Empty_Registrant("JMG_Utility_Switch_Weapon_While_Primary_Empty","PrimaryWeapon=null:string,SecondaryWeapon=null:string,ReloadTime=0.0:float,PrimaryToSecondaryTime=-1.0:float,SecondaryToPrimaryTime=-1.0:float,IdlePrimaryAnim=null:string,IdleSecondaryAnim=null:string,PrimaryToSecondaryAnim=null:string,SecondaryToPrimaryAnim=null:string,PrimaryToSecondarySound=null:string,SecondaryToPrimarySound=null:string"); ScriptRegistrant JMG_Utility_Send_Custom_When_Near_Building_Registrant("JMG_Utility_Send_Custom_When_Near_Building","SendCustomObjectID=0:int,NearToBuildingCustom:int,FarFromBuildingCustom:int,CloseToBuildingDistance=1.0:float,BuildingPlayerType=2:int,CheckDeadBuildings=1:int,CheckRate=0.25:float"); ScriptRegistrant JMG_Utility_AI_Engineer_Repair_Target_Registrant("JMG_Utility_AI_Engineer_Repair_Target",""); @@ -9104,7 +9122,7 @@ ScriptRegistrant JMG_Utility_Regen_HitPoints_Registrant("JMG_Utility_Regen_HitPoints","RegenHealth=1:int,HealthAmount=1.0:float,HealthPerPlayer=0.0:float,RegenArmor=1:int,ArmorAmount=1.0:float,ArmorPerPlayer=0.0:float,Rate=1.0:float,DamageDelay=0.0:float"); ScriptRegistrant JMG_Utility_Toggle_Flight_On_Delay_Registrant("JMG_Utility_Toggle_Flight_On_Delay","Delay:float"); ScriptRegistrant JMG_Utility_Fainting_Soldier_Registrant("JMG_Utility_Fainting_Soldier","FaintAnimation:string,LayAnimation:string,StandAnimation:string,FaintSound=null:string,StandSound=null:string,ChangeArmorTypeWhenKnockedOut=0:int,ArmorTypeWhileKnockedOut=Blamo:string,TeamWhileKnockedOut=-2:int"); -ScriptRegistrant JMG_Utility_AI_Guardian_Infantry_Registrant("JMG_Utility_AI_Guardian_Infantry","WanderingAIGroupID:int,WanderSpeed=1.0:float,FireRange=100.0:float,FaceTarget=1:int,CheckBlocked=1:int"); +ScriptRegistrant JMG_Utility_AI_Guardian_Infantry_Registrant("JMG_Utility_AI_Guardian_Infantry","WanderingAIGroupID:int,WanderSpeed=1.0:float,FireRange=100.0:float,FaceTarget=1:int,CheckBlocked=1:int,StealthModeOverride=0:int"); ScriptRegistrant JMG_Utility_Set_Innate_Max_Wander_Distance_Registrant("JMG_Utility_Set_Innate_Max_Wander_Distance","Distance:float"); ScriptRegistrant JMG_Utility_Switch_Weapon_To_Empty_Hands_Until_Custom_Registrant("JMG_Utility_Switch_Weapon_To_Empty_Hands_Until_Custom","Custom:int"); ScriptRegistrant JMG_Utility_Set_Skin_And_Shield_Type_On_Custom_Registrant("JMG_Utility_Set_Skin_And_Shield_Type_On_Custom","Custom:int,SkinType=None:string,ShieldType=None:string"); @@ -9156,7 +9174,7 @@ ScriptRegistrant JMG_Utility_Custom_Send_Custom_Registrant("JMG_Utility_Custom_Send_Custom","Custom:int,ID=0:int,SendCustom:int,Param:int,Delay:float"); ScriptRegistrant JMG_Utility_Damage_Unoccupied_Vehicle_Registrant("JMG_Utility_Damage_Unoccupied_Vehicle","Rate=0.1:float,Delay=60.0:float,DecreaseTick=0.1:float,IncreaseTick=0.1:float,Damage=1.0:float,Warhead=None:string"); ScriptRegistrant JMG_Utility_Custom_Damage_All_Soldiers_On_Team_Registrant("JMG_Utility_Custom_Damage_All_Soldiers_On_Team","Custom:int,Team:int,Damage:float,Warhead=None:string"); -ScriptRegistrant JMG_Utility_AI_Guardian_Vehicle_Registrant("JMG_Utility_AI_Guardian_Vehicle","WanderingAIGroupID:int,WanderSpeed=1.0:float,FireRange=100.0:float,FaceTarget=1:int,CheckBlocked=1:int,AimAtFeet=1:int,TurnOffEngineOnArrival=1:int"); +ScriptRegistrant JMG_Utility_AI_Guardian_Vehicle_Registrant("JMG_Utility_AI_Guardian_Vehicle","WanderingAIGroupID:int,WanderSpeed=1.0:float,FireRange=100.0:float,FaceTarget=1:int,CheckBlocked=1:int,AimAtFeet=1:int,TurnOffEngineOnArrival=1:int,StealthModeOverride=0:int"); ScriptRegistrant JMG_Utility_Custom_Destroy_Closest_Model_To_Position_Registrant("JMG_Utility_Custom_Destroy_Closest_Model_To_Position","Custom:int,Model:string,Position:Vector3,MaxDistance=0.0:float"); ScriptRegistrant JMG_Utility_Send_Custom_On_Deaths_Controller_Registrant("JMG_Utility_Send_Custom_On_Deaths_Controller","MaxDeaths=100:int,DeathReminder=25:int,UrgentDeathReminder=10:int,StringID=12628:int,ReminderMessage=%d %s^ only %d more %s allowed!:string,Delim=^:string,ReminderMessageOrder=0:int,DeathSingular=casualty:string,DeathPlural=casualties:string,RemainingSingular=death:string,RemainingPlural=deaths:string,ReminderColor=1.0 0.0 0.0:Vector3,ID=0:int,Custom=0:int,Param=0:int,Delay=0:int,ReminderCustom=0:int,AddDeathsWhenNoPlayers=0.0:float,NoPlayersAddDeathSaftyTime=0:int"); ScriptRegistrant JMG_Utility_Send_Custom_On_Deaths_Reporter_Registrant("JMG_Utility_Send_Custom_On_Deaths_Reporter",""); @@ -9211,7 +9229,7 @@ ScriptRegistrant JMG_Utility_Objective_System_Objective_Status_Update_Custom_Registrant("JMG_Utility_Objective_System_Objective_Status_Update_Custom","Custom:int,ObjectiveID:int,NewObjectiveStringID:int,NewObjectiveMarkerObjectID:int"); ScriptRegistrant JMG_Utility_Objective_System_Objective_Failed_Custom_Registrant("JMG_Utility_Objective_System_Objective_Failed_Custom","Custom:int,ObjectiveID:int"); ScriptRegistrant JMG_Utility_Force_Player_Team_At_Gameover_Registrant("JMG_Utility_Force_Player_Team_At_Gameover","Team:int"); -ScriptRegistrant JMG_Utility_AI_Guardian_Generic_Registrant("JMG_Utility_AI_Guardian_Generic","WanderingAIGroupID:int,WanderSpeed=1.0:float,FireRange=100.0:float,FaceTarget=1:int,CheckBlocked=1:int,ArriveDistance=1.0:float,FlightHeight=0.0:float,TurnOffEngineOnArrival=1:int,UseSecondaryAttack=0:int"); +ScriptRegistrant JMG_Utility_AI_Guardian_Generic_Registrant("JMG_Utility_AI_Guardian_Generic","WanderingAIGroupID:int,WanderSpeed=1.0:float,FireRange=100.0:float,FaceTarget=1:int,CheckBlocked=1:int,ArriveDistance=1.0:float,FlightHeight=0.0:float,TurnOffEngineOnArrival=1:int,UseSecondaryAttack=0:int,StealthModeOverride=0:int"); ScriptRegistrant JMG_Utility_Custom_Create_Object_In_Front_Of_Self_Registrant("JMG_Utility_Custom_Create_Object_In_Front_Of_Self","Custom:int,PresetName:string,Distance:float,Height:float,Rotation:float"); ScriptRegistrant JMG_Utility_Send_Custom_When_No_More_Units_On_Team_Exist_Ignore_Registrant("JMG_Utility_Send_Custom_When_No_More_Units_On_Team_Exist_Ignore","Ignore:int"); ScriptRegistrant JMG_Utility_Custom_Damage_All_Vehicles_On_Team_Registrant("JMG_Utility_Custom_Damage_All_Vehicles_On_Team","Custom:int,Team:int,Damage:float,Warhead=None:string"); diff -uwrN sourceold/scripts/jmgUtility.h source/scripts/jmgUtility.h --- sourceold/scripts/jmgUtility.h 2017-09-29 06:54:46.830200000 +1000 +++ source/scripts/jmgUtility.h 2017-11-21 06:09:16.621400000 +1000 @@ -8,6 +8,7 @@ #include "SoldierGameObj.h" #include "PhysicsSceneClass.h" #include "MoveablePhysClass.h" +#include "VehicleGameObj.h" #define PI 3.14159265f #define PI180 PI/180 @@ -730,6 +731,22 @@ return true; return false; } + static bool CanSeeStealth(int stealthModeOverride,GameObject *obj,GameObject *seen) + { + if (stealthModeOverride == -1) + return false; + if (!stealthModeOverride && seen->As_SmartGameObj() && seen->As_SmartGameObj()->Is_Stealthed()) + { + float dist = JmgUtility::SimpleDistance(Commands->Get_Position(obj),Commands->Get_Position(seen)); + if (seen->As_SoldierGameObj() && dist > seen->As_SoldierGameObj()->Get_Stealth_Fade_Distance()*seen->As_SoldierGameObj()->Get_Stealth_Fade_Distance()) + return false; + else if (seen->As_VehicleGameObj() && dist > seen->As_VehicleGameObj()->Get_Stealth_Fade_Distance()*seen->As_VehicleGameObj()->Get_Stealth_Fade_Distance()) + return false; + else if (dist > seen->As_SmartGameObj()->Get_Stealth_Fade_Distance()*seen->As_SmartGameObj()->Get_Stealth_Fade_Distance()) + return false; + } + return true; + } }; class NewObjectiveSystem @@ -2120,6 +2137,7 @@ * \WanderingAIGroupID - Group of points to wander between * \FlightHeight - How high it should stay above the points * \FireRange - Max range that it can use it's guns +* \StealthModeOverride - 0 = normal stealth detection, 1 = sees everything, -1 = can't see any stealthed enemies * \author jgray * \ingroup JmgUtility */ @@ -2128,6 +2146,7 @@ int EnemyID; int EnemyTimeOutTime; Vector3 LastPos; + int stealthModeOverride; void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); void Enemy_Seen(GameObject *obj,GameObject *seen); @@ -2938,6 +2957,7 @@ * \WanderSpeed - Speed the unit moves at * \FireRange - Max range that it can use it's guns * \CheckBlocked - Whether to check if the target spot is blocked before firing +* \StealthModeOverride - 0 = normal stealth detection, 1 = sees everything, -1 = can't see any stealthed enemies * \author jgray * \ingroup JmgUtility */ @@ -2946,6 +2966,7 @@ int EnemyID; int EnemyTimeOutTime; Vector3 LastPos; + int stealthModeOverride; void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); void Enemy_Seen(GameObject *obj,GameObject *seen); @@ -3755,6 +3776,10 @@ this->attack = attack; this->overrideLocation = overrideLocation; } + bool operator == (LastAction l) + { + return (targetId == l.targetId && JmgUtility::SimpleDistance(location,l.location) <= 0.0f && speed == l.speed && distance == l.distance && attack == l.attack && overrideLocation == l.overrideLocation); + } }; LastAction lastAction; aiState state; @@ -3947,6 +3972,7 @@ * \CheckBlocked - Whether to check if the target spot is blocked before firing * \AimAtFeet - Should the vehicle aim at the feet of infantry * \TurnOffEngineOnArrival - Should the vehicle turn off its engine when it gets to its points (useful for wheeled vehicles that roll away) +* \StealthModeOverride - 0 = normal stealth detection, 1 = sees everything, -1 = can't see any stealthed enemies * \author jgray * \ingroup JmgUtility */ @@ -3958,6 +3984,7 @@ Vector3 LastPos; int backward; int stuckTime; + int stealthModeOverride; void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); void Enemy_Seen(GameObject *obj,GameObject *seen); @@ -4302,6 +4329,7 @@ public: struct SendCustomOnSecondNode { + bool hasTriggered; int triggerSecond; int id; int custom; @@ -4310,6 +4338,7 @@ struct SendCustomOnSecondNode *next; SendCustomOnSecondNode(int triggerSecond,int id,int custom,int param,float delay) { + this->hasTriggered = false; this->triggerSecond = triggerSecond; this->id = id; this->custom = custom; @@ -4326,7 +4355,7 @@ sendCustomOnSecondController = new SendCustomOnSecondNode(triggerSecond,id,custom,param,delay); while (current) { - if (current->triggerSecond == triggerSecond) + if (triggerSecond == current->triggerSecond && id == current->id && custom == current->custom && param == current->param) { Console_Input("msg ERROR: A custom for this trigger second already exists!"); return; @@ -4356,18 +4385,20 @@ void Destroyed(GameObject *obj); char *formatReminderString(const char *format,...); - SendCustomOnSecondNode *FindSecondNode(int second) + void NodeSendCustom(GameObject *obj,int second) { if (!sendCustomOnSecondController) - return NULL; + return; SendCustomOnSecondNode *current = sendCustomOnSecondController; while (current) { - if (current->triggerSecond == second) - return current; + if (current->triggerSecond == second && !current->hasTriggered) + { + current->hasTriggered = true; + Commands->Send_Custom_Event(obj,Commands->Find_Object(current->id),current->custom,current->param,current->delay); + } current = current->next; } - return NULL; } void CleanupSecondNodes() { @@ -4378,10 +4409,13 @@ temp = temp->next; delete die; } + sendCustomOnSecondController = NULL; } }; /*! -* \brief Sends a custom when TimeInSeconds (on JMG_Utility_HUD_Count_Down) matches the TriggerTime +* \brief Sends a custom when TimeInSeconds (on JMG_Utility_HUD_Count_Down) matches the TriggerTime, only will trigger once even if multiple JMG_Utility_HUD_Count_Downs are placed +* \ Can be placed before JMG_Utility_HUD_Count_Down is placed. +* \ If an object with JMG_Utility_HUD_Count_Down is destroyed all currently placed JMG_Utility_HUD_Count_Down_Send_Customs will be removed. * \TriggerTime - Time in which to send the custom * \ID - ID to send the custom to, if 0 it sends it to the object this script is attached too * \Custom - Custom to send @@ -5061,6 +5095,7 @@ * \FlightHeight - How high should the aircraft fly (use 0 if not an aircraft) * \TurnOffEngineOnArrival - Should the vehicle kill its engine when it arrives * \UseSecondaryAttack - Should the unit attack with its secondary fire instead +* \StealthModeOverride - 0 = normal stealth detection, 1 = sees everything, -1 = can't see any stealthed enemies * \author jgray * \ingroup JmgUtility */ @@ -5073,6 +5108,7 @@ int EnemyTimeOutTime; Vector3 LastPos; bool primaryFire; + int stealthModeOverride; void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); void Enemy_Seen(GameObject *obj,GameObject *seen);