Advertisement
biu

mobmanager

biu
Oct 12th, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.61 KB | None | 0 0
  1. //=============================================================================
  2. // mobmanager.
  3. //=============================================================================
  4. class mobmanager expands Mutator Config(mobmanager);
  5.  
  6.  
  7. /*
  8. Struct gconfig
  9. {
  10.  
  11. var() config bool EnableLimiter;
  12. var() config bool EnableAbilities;
  13. var() config bool EnableBounty;
  14. var() config bool EnableSpawner;
  15. var() config bool EnableVersionCheck;
  16. var() config bool EnableAutoUpdater;
  17. var() config int version;
  18.  
  19. };
  20.  
  21.  
  22.  
  23. Struct aconfig
  24. {
  25. var() config string EnabledWorlds[50];
  26. var() config bool LimitBonusSpawns;
  27. var() config int BonusSpawnRange;
  28. var() config int BonusSpawnHeightRange;
  29. var() config int CommandPSpawnMinRange;
  30. var() config bool UseCircleLocationGeneration;
  31. var() config bool BonusSpawnUseRadius;
  32. var() config bool CommandSpawnUseRadius;
  33. var() config bool CommandPSpawnUseRadius;
  34. var() config bool CommandPSpawnRadiusAllowCenter;
  35. var() config string AbilitySets[4];
  36. var() config string EnabledSpawnReasons[40];
  37. };
  38.  
  39.  
  40. Struct lconfig
  41. {
  42. var() config string EnabledWorlds[50];
  43. var() config bool DisableWarnings;
  44. var() config bool UseAsyncDespawnScanner;
  45. var() config bool IgnoreCreativePlayers;
  46. var() config bool RemoveTamedAnimals;
  47. var() config bool CountTamedAnimals;
  48. var() config bool EnableAnimalDespawning;
  49. var() config bool EnableAnimalTracking;
  50. var() config int DaysTillFarmAnimalCleanup;
  51. var() config int ProtectedFarmAnimalSaveInterval;
  52. var() config int TicksPerRecount;
  53. var() config int TicksPerDespawnScan;
  54. var() config int MinTicksLivedForDespawn;
  55. var() config string IgnoredMobs[50];
  56. var() config string disabledMobs[50];
  57. var() config string EnabledSpawnReasons[50];
  58. var() config int DespawnSearchDistance;
  59. var() config int DespawnSearchHeight;
  60. var() config int FlyingMobAditionalBlockDepth;
  61. };
  62.  
  63. var(globalconfiguation) config gconfig globalconf;
  64. var(abilityconfiguation) config aconfig aconf;
  65. var(limiterconfiguation) config lconfig lconf;
  66.  
  67.  
  68. */
  69.  
  70.  
  71. Struct initpawnlist
  72. {
  73.  
  74.  
  75. var() string pawnname;
  76. var() int pawncount;
  77. var() bool hate;
  78.  
  79. };
  80.  
  81.  
  82.  
  83.  
  84. var config initpawnlist initlist[200];
  85.  
  86. var float Count,Count2;
  87. var int pawncnt,basecnt, tempint, tempilit,intenemy;
  88. var scriptedpawn s_pawn;
  89. var scriptedpawn base_pawn[1024];
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99. auto state manage
  100. {
  101. function BeginState()
  102. { log("Loading MobManager v0.0.0",'MobManager');
  103. // Trasnfer the entire maps monsters to this array initaly.
  104. foreach AllActors(Class'scriptedpawn',s_pawn)
  105. {
  106. if ( s_pawn != None )
  107. {
  108. // Count everything
  109. basecnt=(basecnt+1);
  110.  
  111. // clone it. do this so we know what pawns are the baseline after the spawner kicks in
  112. base_pawn[basecnt] = s_pawn;
  113.  
  114. if (s_pawn.AttitudeToPlayer == ATTITUDE_Friendly)
  115. {
  116. // log ("found a freindly!");
  117. initlist[findpawnentry( string(base_pawn[basecnt].class))].hate = false;
  118. }else{
  119. initlist[findpawnentry( string(base_pawn[basecnt].class))].hate = true;
  120. intenemy ++;
  121. }
  122.  
  123. // lookup the pawn name in the table and add to its count
  124. initlist[findpawnentry( string(base_pawn[basecnt].class))].pawncount ++;
  125. }
  126. }
  127.  
  128. Log("Base Monstercount is " $ basecnt $" of witch " $ intenemy $ " are enemy enity",'MobManager');
  129. Log("Spread:",'MobManager');
  130.  
  131. // Dump the spread
  132. For( tempilit = 0; tempilit < 200 ; tempilit++ )
  133. {
  134. if ( initlist[tempilit].pawnname != "")
  135. {
  136. if ( initlist[tempilit].hate )
  137. {
  138. log ("Found " $ initlist[tempilit].pawncount $ " Of Enemy Entity " $ initlist[tempilit].pawnname ,'MobManager');
  139. }else{
  140. log ("Found " $ initlist[tempilit].pawncount $ " Of Freindly Entity " $ initlist[tempilit].pawnname ,'MobManager');
  141. }
  142. }
  143. }
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155. }
  156.  
  157.  
  158.  
  159.  
  160. function Tick (float DeltaTime)
  161. {
  162.  
  163.  
  164. Count += DeltaTime;
  165. if ( Count > 20 )
  166. {
  167. reloadthemap();
  168. Count = 0.0;
  169. }
  170.  
  171.  
  172. }
  173.  
  174.  
  175.  
  176.  
  177.  
  178. function Boom ()
  179. {
  180.  
  181. }
  182.  
  183.  
  184.  
  185.  
  186. }
  187.  
  188.  
  189.  
  190.  
  191. function int findpawnentry(string pawnnametar)
  192. {
  193. // search the array and add the pawns name to the array if it is not present
  194. local int i, this;
  195. local bool befound;
  196.  
  197. For( i = 0; i < 200 ; i++ )
  198. {
  199.  
  200. if(pawnnametar == initlist[i].pawnname)
  201. {
  202. // log ("find entry " $ i $ " with pawn " $ pawnnametar);
  203. befound = true;
  204. this = i; // our pawn name is at %THIS%
  205. return i; // break
  206. }
  207. }
  208.  
  209. // we may be found , but before we leave...
  210. if (!befound)
  211. {
  212. // if we look and didnt find
  213. For( i = 0; i < 200 ; i++ )
  214. {
  215. if (initlist[i].pawnname == "" && !befound)
  216. {
  217. // log ("add entry " $ i $ " with pawn " $ pawnnametar);
  218. initlist[i].pawnname = pawnnametar;
  219. befound = true;
  220. return i; // break out our pawn name is added at I
  221. }
  222. }
  223.  
  224. }else{
  225. return this; // we use what was original there
  226. }
  227.  
  228.  
  229.  
  230. }
  231.  
  232.  
  233.  
  234. function reloadthemap()
  235. {
  236. local int ll;
  237. local class<ScriptedPawn> sw;
  238. local ScriptedPawn readypawn;
  239.  
  240. Log("reloading the entire pawn list",'MobManager');
  241.  
  242. For( ll = 0; ll < 1024 ; ll++ )
  243. {
  244.  
  245. if ( base_pawn[ll] != None )
  246. {
  247.  
  248. sw = class<ScriptedPawn>( DynamicLoadObject(string(base_pawn[ll].class), class'Class' ) );
  249. readypawn = Spawn(sw,,, base_pawn[ll].Location);
  250. if (readypawn !=none)
  251. {
  252. duppy(base_pawn[ll],readypawn);
  253. ba("respawned :" $ string(base_pawn[ll].name) $ base_pawn[ll].Location $ " as " $ string(readypawn.name) $ readypawn.Location);
  254.  
  255.  
  256. }else{
  257.  
  258.  
  259. }
  260. }
  261. }
  262. }
  263.  
  264.  
  265.  
  266.  
  267. function duppy(scriptedpawn p,scriptedpawn duppyp)
  268. { // Copy info from p to duppyp
  269. // This is why its called a "copier" (it assumes any changes or customization , i.e. rys pawns.)
  270.  
  271. //duppyp.tag = 'copy'; // avoid the looping (Copies wont get copied)
  272. duppyp.Health=p.health ;
  273. duppyp.DropWhenKilled=p.DropWhenKilled;
  274. duppyp.rangedprojectile=p.rangedprojectile;
  275. duppyp.lightbrightness=p.lightbrightness;
  276. duppyp.lighthue=p.lighthue;
  277. duppyp.lightsaturation=p.lightsaturation;
  278. duppyp.lightcone=p.lightcone;
  279. duppyp.lighteffect=p.lighteffect;
  280. duppyp.lightperiod=p.lightperiod;
  281. duppyp.lightphase=p.lightphase;
  282. duppyp.lightradius=p.lightradius;
  283. duppyp.lighttype=p.lighttype;
  284. duppyp.Style=p.Style;
  285. duppyp.DrawType=p.DrawType;
  286. duppyp.Skin=p.Skin;
  287. duppyp.MultiSkins[0]=p.MultiSkins[0];
  288. duppyp.MultiSkins[1]=p.MultiSkins[1];
  289. duppyp.MultiSkins[2]=p.MultiSkins[2];
  290. duppyp.MultiSkins[3]=p.MultiSkins[3];
  291. duppyp.MultiSkins[4]=p.MultiSkins[4];
  292. duppyp.MultiSkins[5]=p.MultiSkins[5];
  293. duppyp.MultiSkins[6]=p.MultiSkins[6];
  294. duppyp.MultiSkins[7]=p.MultiSkins[7];
  295. }
  296.  
  297.  
  298. function mmcommand(string commandstring)
  299. {
  300. Log("Recive command " $ commandstring,'MobManager');
  301. if (caps(commandstring) == caps("help")) {ba("count / butcher/spawn/ spawnset / respawnbase");};
  302. if (caps(commandstring) == caps("")) {ba("count / butcher/spawn/ spawnset / respawnbase");};
  303. if (caps(commandstring) == caps("count")) { };
  304. if (caps(commandstring) == caps("butcher")) { };
  305. if (caps(commandstring) == caps("spawn")) { };
  306. if (caps(commandstring) == caps("spawnset")) { };
  307. if (caps(commandstring) == caps("pspawn")) { };
  308. if (caps(commandstring) == caps("pspawnset")) { };
  309. if (caps(commandstring) == caps("mobtypes")) { };
  310. if (caps(commandstring) == caps("reload")) { };
  311. if (caps(commandstring) == caps("version")) { };
  312. // extra
  313. if (caps(commandstring) == caps("respawnbase")) {reloadthemap();};
  314. if (caps(commandstring) == caps("respawnall")) { };
  315. }
  316.  
  317.  
  318. function ba(string what)
  319. {
  320. local PlayerPawn p;
  321. log(what,'MobManager');
  322. foreach AllActors(class'PlayerPawn',p)
  323. {
  324. if (p.bAdmin) {p.ClientMessage( what,'pickup',false);}
  325. }
  326. }
  327.  
  328. defaultproperties
  329. {
  330. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement