Jump to content

[WIP] Small Bases God Mode


Recommended Posts

THE IDEA:
Have god mode only on small bases.
 
WHAT WAS REACHED:
Small bases still dies, but it is not removed from the data base, so it back on the next restart.
 
THE CODE TO DO THAT:
One server function need to be changed on the file init\server_functions.sqf.
Function object_handleServerKilled changes from:

object_handleServerKilled = {
	private["_unit","_objectID","_objectUID","_killer"];
	_unit = _this select 0;
	_killer = _this select 1;
	
	_objectID =	 _unit getVariable ["ObjectID","0"];
	_objectUID = _unit getVariable ["ObjectUID","0"];
	
	[_objectID,_objectUID,_killer] call server_deleteObj;
		
	_unit removeAllMPEventHandlers "MPKilled";
	_unit removeAllEventHandlers "Killed";
	_unit removeAllEventHandlers "HandleDamage";
	_unit removeAllEventHandlers "GetIn";
	_unit removeAllEventHandlers "GetOut";
};

To:

object_handleServerKilled = {
	private["_unit","_objectID","_objectUID","_killer"];
	_unit = _this select 0;
	_killer = _this select 1;
	
	_objectID =	 _unit getVariable ["ObjectID","0"];
	_objectUID = _unit getVariable ["ObjectUID","0"];
	
	//===============================================================
	//DONN Small Bases God Mode - Begin =============================
	//===============================================================
	
	_limitToGod = 30; //Max Limite for God Mode Base
	_radSearch = (DZE_PlotPole select 0) + 2;
	_plots = nearestObjects [_unit,"Plastic_Pole_EP1_DZ",_radSearch];
	_delOnDb = false;
	if (count _plots > 0) then {
		_plot = _plots select 0;
		_plotRad = DZE_PlotPole select 0;
		_modules = nearestObjects [_plot,DZE_maintainClasses,_plotRad];
		_numModules = count _modules;
		if (_numModules > _limitToGod) then {
			_delOnDb = true;
		};
	} else {
		_delOnDb = true;
	};
	if (_delOnDb) then {[_objectID,_objectUID,_killer] call server_deleteObj;};
	
	//===============================================================
	//DONN Small Bases God Mode - End ===============================
	//===============================================================
	
	//[_objectID,_objectUID,_killer] call server_deleteObj;
		
	_unit removeAllMPEventHandlers "MPKilled";
	_unit removeAllEventHandlers "Killed";
	_unit removeAllEventHandlers "HandleDamage";
	_unit removeAllEventHandlers "GetIn";
	_unit removeAllEventHandlers "GetOut";
};

IT WORKS?
It was not tested, but if you have interest in that, and want to help testing it, i apreciate and we can have something nice fastely.

 

INFISTAR COMPATIBLE?

This is something to test too.

Link to comment
Share on other sites

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...