void MDB_SSGM_Beacon::Created(GameObject *obj) { Commands->Start_Timer(obj, this, 5.0f, 1); IsDisarmed = false; GameObject *Placer = Get_Beacon_Planter(obj); InvisObjCont = Commands->Create_Object("Invisible_Object",Commands->Get_Position(obj)); if (stricmp(Commands->Get_Preset_Name(obj),"Nuclear_Strike") == 0) { Commands->Attach_Script(InvisObjCont,"MDB_SSGM_Beacon_CreateControl",StrFormat("%s,%ls","Nuclear_Strike",Get_Wide_Player_Name(Placer)).c_str()); } else { Commands->Attach_Script(InvisObjCont,"MDB_SSGM_Beacon_CreateControl",StrFormat("%s,%ls",Translate_Preset(obj).c_str(),Get_Wide_Player_Name(Placer)).c_str()); } FDSMessage(StrFormat("%s",Commands->Get_Preset_Name(obj)),"_Beacon"); } void MDB_SSGM_Beacon::Destroyed(GameObject *obj) { if (Commands->Get_ID(InvisObjCont) != 0) { Commands->Destroy_Object(InvisObjCont); } } void MDB_SSGM_Beacon::Damaged(GameObject *obj, GameObject *damager, float damage) { if (damage < 0.0f) { Commands->Apply_Damage(obj,(damage * -1.0f),"Shrapnel",false); } } void MDB_SSGM_Beacon::Killed(GameObject *obj, GameObject *shooter) { if (IsDisarmed == false) { Vector3 DeathPlace = Commands->Get_Position(obj); GameObject *BackpackScript = 0; BackpackScript = Commands->Create_Object(Commands->Get_Preset_Name(obj),DeathPlace); Commands->Attach_Script(BackpackScript,"MDB_SSGM_Drop_Weapon",""); IsDisarmed = true; FDSMessage(StrFormat("%ls disarmed a %s",Get_Wide_Player_Name(shooter),Translate_Preset(obj).c_str()),"_BEACON"); } } //Workaround for timers not working on beacons void MDB_SSGM_Beacon_CreateControl::Created(GameObject *obj) { if (stricmp(Get_Parameter("Beacon"),"Nuclear_Strike") == 0) { Commands->Start_Timer(obj,this,5,10); Commands->Start_Timer(obj,this,18,20); } else { Commands->Start_Timer(obj,this,5,3); Commands->Start_Timer(obj,this,55,5); } } void MDB_SSGM_Beacon_CreateControl::Timer_Expired(GameObject *obj, int number) { if (number == 3) { FDSMessage(StrFormat("%s deployed a %s",Get_Parameter("Planter"),Get_Parameter("Beacon")),"_BEACON"); } else if (number == 5) { FDSMessage(StrFormat("%s has detonated",Get_Parameter("Beacon")),"_BEACON"); } else if (number == 10) { FDSMessage(StrFormat("%s deployed an EMP",Get_Parameter("Planter")),"_BEACON"); } else if (number == 20) { FDSMessage(StrFormat("EMP has detonated"),"_BEACON"); //Commands->Start_Timer(obj,this,2,30); //Commands->Start_Timer(obj,this,4,30); //Commands->Start_Timer(obj,this,6,30); Commands->Start_Timer(obj,this,8,30); Commands->Start_Timer(obj,this,10,30); Commands->Start_Timer(obj,this,12,30); Commands->Start_Timer(obj,this,14,30); } else if (number == 30) { //FDSMessage(StrFormat("EMP Test"),"_BEACON"); //Vector3 pos = Commands->Get_Position(obj); //GenericSLNode *x = BaseGameObjList->HeadNode; //while (x) { //GameObject *o = (GameObject *)x->NodeData; //if (o && Is_Soldier(o)) { // if (Commands->Get_Distance(Commands->Get_Position(o),pos) < 200) { // Commands->Apply_Damage(o,2.0f,"Laser_NoBuilding",false); // } //} // x = x->NodeNext; // } } }