Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // mobmanager.
- //=============================================================================
- class mobmanager expands Mutator Config(mobmanager);
- /*
- Struct gconfig
- {
- var() config bool EnableLimiter;
- var() config bool EnableAbilities;
- var() config bool EnableBounty;
- var() config bool EnableSpawner;
- var() config bool EnableVersionCheck;
- var() config bool EnableAutoUpdater;
- var() config int version;
- };
- Struct aconfig
- {
- var() config string EnabledWorlds[50];
- var() config bool LimitBonusSpawns;
- var() config int BonusSpawnRange;
- var() config int BonusSpawnHeightRange;
- var() config int CommandPSpawnMinRange;
- var() config bool UseCircleLocationGeneration;
- var() config bool BonusSpawnUseRadius;
- var() config bool CommandSpawnUseRadius;
- var() config bool CommandPSpawnUseRadius;
- var() config bool CommandPSpawnRadiusAllowCenter;
- var() config string AbilitySets[4];
- var() config string EnabledSpawnReasons[40];
- };
- Struct lconfig
- {
- var() config string EnabledWorlds[50];
- var() config bool DisableWarnings;
- var() config bool UseAsyncDespawnScanner;
- var() config bool IgnoreCreativePlayers;
- var() config bool RemoveTamedAnimals;
- var() config bool CountTamedAnimals;
- var() config bool EnableAnimalDespawning;
- var() config bool EnableAnimalTracking;
- var() config int DaysTillFarmAnimalCleanup;
- var() config int ProtectedFarmAnimalSaveInterval;
- var() config int TicksPerRecount;
- var() config int TicksPerDespawnScan;
- var() config int MinTicksLivedForDespawn;
- var() config string IgnoredMobs[50];
- var() config string disabledMobs[50];
- var() config string EnabledSpawnReasons[50];
- var() config int DespawnSearchDistance;
- var() config int DespawnSearchHeight;
- var() config int FlyingMobAditionalBlockDepth;
- };
- var(globalconfiguation) config gconfig globalconf;
- var(abilityconfiguation) config aconfig aconf;
- var(limiterconfiguation) config lconfig lconf;
- */
- Struct initpawnlist
- {
- var() string pawnname;
- var() int pawncount;
- var() bool hate;
- };
- var config initpawnlist initlist[200];
- var float Count,Count2;
- var int pawncnt,basecnt, tempint, tempilit,intenemy;
- var scriptedpawn s_pawn;
- var scriptedpawn base_pawn[1024];
- auto state manage
- {
- function BeginState()
- { log("Loading MobManager v0.0.0",'MobManager');
- // Trasnfer the entire maps monsters to this array initaly.
- foreach AllActors(Class'scriptedpawn',s_pawn)
- {
- if ( s_pawn != None )
- {
- // Count everything
- basecnt=(basecnt+1);
- // clone it. do this so we know what pawns are the baseline after the spawner kicks in
- base_pawn[basecnt] = s_pawn;
- if (s_pawn.AttitudeToPlayer == ATTITUDE_Friendly)
- {
- // log ("found a freindly!");
- initlist[findpawnentry( string(base_pawn[basecnt].class))].hate = false;
- }else{
- initlist[findpawnentry( string(base_pawn[basecnt].class))].hate = true;
- intenemy ++;
- }
- // lookup the pawn name in the table and add to its count
- initlist[findpawnentry( string(base_pawn[basecnt].class))].pawncount ++;
- }
- }
- Log("Base Monstercount is " $ basecnt $" of witch " $ intenemy $ " are enemy enity",'MobManager');
- Log("Spread:",'MobManager');
- // Dump the spread
- For( tempilit = 0; tempilit < 200 ; tempilit++ )
- {
- if ( initlist[tempilit].pawnname != "")
- {
- if ( initlist[tempilit].hate )
- {
- log ("Found " $ initlist[tempilit].pawncount $ " Of Enemy Entity " $ initlist[tempilit].pawnname ,'MobManager');
- }else{
- log ("Found " $ initlist[tempilit].pawncount $ " Of Freindly Entity " $ initlist[tempilit].pawnname ,'MobManager');
- }
- }
- }
- }
- function Tick (float DeltaTime)
- {
- Count += DeltaTime;
- if ( Count > 20 )
- {
- reloadthemap();
- Count = 0.0;
- }
- }
- function Boom ()
- {
- }
- }
- function int findpawnentry(string pawnnametar)
- {
- // search the array and add the pawns name to the array if it is not present
- local int i, this;
- local bool befound;
- For( i = 0; i < 200 ; i++ )
- {
- if(pawnnametar == initlist[i].pawnname)
- {
- // log ("find entry " $ i $ " with pawn " $ pawnnametar);
- befound = true;
- this = i; // our pawn name is at %THIS%
- return i; // break
- }
- }
- // we may be found , but before we leave...
- if (!befound)
- {
- // if we look and didnt find
- For( i = 0; i < 200 ; i++ )
- {
- if (initlist[i].pawnname == "" && !befound)
- {
- // log ("add entry " $ i $ " with pawn " $ pawnnametar);
- initlist[i].pawnname = pawnnametar;
- befound = true;
- return i; // break out our pawn name is added at I
- }
- }
- }else{
- return this; // we use what was original there
- }
- }
- function reloadthemap()
- {
- local int ll;
- local class<ScriptedPawn> sw;
- local ScriptedPawn readypawn;
- Log("reloading the entire pawn list",'MobManager');
- For( ll = 0; ll < 1024 ; ll++ )
- {
- if ( base_pawn[ll] != None )
- {
- sw = class<ScriptedPawn>( DynamicLoadObject(string(base_pawn[ll].class), class'Class' ) );
- readypawn = Spawn(sw,,, base_pawn[ll].Location);
- if (readypawn !=none)
- {
- duppy(base_pawn[ll],readypawn);
- ba("respawned :" $ string(base_pawn[ll].name) $ base_pawn[ll].Location $ " as " $ string(readypawn.name) $ readypawn.Location);
- }else{
- }
- }
- }
- }
- function duppy(scriptedpawn p,scriptedpawn duppyp)
- { // Copy info from p to duppyp
- // This is why its called a "copier" (it assumes any changes or customization , i.e. rys pawns.)
- //duppyp.tag = 'copy'; // avoid the looping (Copies wont get copied)
- duppyp.Health=p.health ;
- duppyp.DropWhenKilled=p.DropWhenKilled;
- duppyp.rangedprojectile=p.rangedprojectile;
- duppyp.lightbrightness=p.lightbrightness;
- duppyp.lighthue=p.lighthue;
- duppyp.lightsaturation=p.lightsaturation;
- duppyp.lightcone=p.lightcone;
- duppyp.lighteffect=p.lighteffect;
- duppyp.lightperiod=p.lightperiod;
- duppyp.lightphase=p.lightphase;
- duppyp.lightradius=p.lightradius;
- duppyp.lighttype=p.lighttype;
- duppyp.Style=p.Style;
- duppyp.DrawType=p.DrawType;
- duppyp.Skin=p.Skin;
- duppyp.MultiSkins[0]=p.MultiSkins[0];
- duppyp.MultiSkins[1]=p.MultiSkins[1];
- duppyp.MultiSkins[2]=p.MultiSkins[2];
- duppyp.MultiSkins[3]=p.MultiSkins[3];
- duppyp.MultiSkins[4]=p.MultiSkins[4];
- duppyp.MultiSkins[5]=p.MultiSkins[5];
- duppyp.MultiSkins[6]=p.MultiSkins[6];
- duppyp.MultiSkins[7]=p.MultiSkins[7];
- }
- function mmcommand(string commandstring)
- {
- Log("Recive command " $ commandstring,'MobManager');
- if (caps(commandstring) == caps("help")) {ba("count / butcher/spawn/ spawnset / respawnbase");};
- if (caps(commandstring) == caps("")) {ba("count / butcher/spawn/ spawnset / respawnbase");};
- if (caps(commandstring) == caps("count")) { };
- if (caps(commandstring) == caps("butcher")) { };
- if (caps(commandstring) == caps("spawn")) { };
- if (caps(commandstring) == caps("spawnset")) { };
- if (caps(commandstring) == caps("pspawn")) { };
- if (caps(commandstring) == caps("pspawnset")) { };
- if (caps(commandstring) == caps("mobtypes")) { };
- if (caps(commandstring) == caps("reload")) { };
- if (caps(commandstring) == caps("version")) { };
- // extra
- if (caps(commandstring) == caps("respawnbase")) {reloadthemap();};
- if (caps(commandstring) == caps("respawnall")) { };
- }
- function ba(string what)
- {
- local PlayerPawn p;
- log(what,'MobManager');
- foreach AllActors(class'PlayerPawn',p)
- {
- if (p.bAdmin) {p.ClientMessage( what,'pickup',false);}
- }
- }
- defaultproperties
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement