public Zone(int xi, int zi) { /** Zone generated with reproducible randomness from: seed, size and (x,z)-position * - x,z are NW corner of the zone * - biome arg should be null (force it in debug mode) **/ this.seed = String.Format("Zone{0}_{1}_{2}_{3}", Zombiome.worldSeed, Zombiome.worldSize, xi, zi); // receives center /* Geometry */ this.x = Hashes.Rand(xi * ZoneSize, (xi + 1) * ZoneSize, seed, "xcenter"); this.z = Hashes.Rand(zi * ZoneSize, (zi + 1) * ZoneSize, seed, "zcenter"); this.radius = CSutils.Hashes.Rand(20, ZoneSize / 2, seed, "radius"); /* Biome (TODO:robustify: get at a few other points) */ biomeFromPlayer = false; if (true) // (biome == null) { { this.biomeDef = GetBiomeProvider(this.x, this.z); if (this.biomeDef == null) { Printer.Write("Error NULL BiomeDefinition at", this.x, this.z, " ", xi, zi); Printer.Print("Error NULL BiomeDefinition at", this.x, this.z, " ", xi, zi); Printer.Print("player at ", GameManager.Instance.World.GetLocalPlayers()[0].GetPosition()); } else { Printer.Print("GetBiomeProvider", this.x, this.z, this.biomeDef, this.biomeDef == null); } } this.biome = ZBiomeInfo.Get(this.biomeDef.ToString()); effect = ZombiomeActivitySelector.Random(this); Printer.Log(64, "Zone instantiated:", this.x, this.z, biome, "seed:", seed, "effect:", effect, " dif/int:", difficulty, intensity); this.Log(); }
public override void Configure() { base.Configure(); string blk = ZBiomeInfo.GetBlock(seed, biome.ToString()); opt.OptionBlock.SetBlocks("trapSpikesWoodDmg0"); // manage multi blocks opt.OptionItem.item = "woodSpikes"; // was using trapSpikesWoodDmg0 which is a block, not an item ! // opt.OptionItem.item = "" ironSpikes opt.OptionBlock.CallBack = biome.groundParticleEffect; opt.OptionBlock.RateCallBack = Peak.smokeFreq; }
private static bool IsInit = false; // prevent on 2nd game ? public static void Init(int playerId) { /* * Should be safe to do multiple calls ... * - Depends on Map so need re apply on game change * - Should only be called once per game (mostly because of thread start) * * - Check: multiplayer local * - Called twice with 2 local players -> if below * - Each player triggers on connect ? */ /* I should put this all in the buff ?? Anythin here may be duplicate */ if (IsInit) { Printer.Write("Zombiome is already init !", playerId); // if (AutoStart) { // ZombiomeManager.Reset(playerId, ""); // } return; } Printer.Write("Zombiome.Init():", playerId); CSutils.Routines.Sanitizer.Fixer = () => ZombiomeManager._Reset(-1); CSutils.Catcher.SwallowErrors = SwallowError; rand = GameRandomManager.Instance.CreateGameRandom(); worldSeed = GamePrefs.GetString(EnumGamePrefs.WorldGenSeed); worldSize = GamePrefs.GetInt(EnumGamePrefs.WorldGenSize); ZBiomeInfo.Define(); if (nz4) { Zone.Get = Zone.GetFour; } else { Zone.Get = position => new Zone[] { Zone.GetSingle(position) } }; ZBActivity.ZombiomeActivitySelector.Initialize(); if (AutoStart) { ZombiomeManager.Reset(playerId, ""); } IsInit = true; // bugs on restart new game coz no one set to none - use World hash ? Printer.Write("Zombiome..Init: Done"); // ZombiomeManager.Start(playerId); // manually until release }
public override void Configure() { Cycler.Set(2.5f); // molotov duration => permanent Repeater.Set(-1f); // this.opt.OptionItem.item = "ZBProj_fire"; this.opt.OptionItem.item = ZBiomeInfo.Weighted5(this.biome.envProj, Hashes.Rand(seed, "eproj")); this.name = String.Format("{0}-{1}", this.name, this.opt.OptionItem.item); // NB I have opt.OptionShape.direction opt.OptionShape.shape.x = Hashes.Rand(1, 3, seed, "len"); opt.OptionShape.shape.y = Hashes.Rand(1, 3, seed, "heigth"); opt.OptionShape.shape.z = Hashes.Rand(1, 3, seed, "width"); Printer.Log(60, "Fire Configure: done"); }
public override void Configure() { Repeater.Set(int.MaxValue, 1f); // Line enumerator limits it, vitesse propagation // this.opt.OptionItem.item = this.biome.envProj; this.opt.OptionItem.item = ZBiomeInfo.Weighted5(this.biome.envProj, Hashes.Rand(seed, "eproj")); this.name = String.Format("{0}-{1}", this.name, this.opt.OptionItem.item); // NB I have opt.OptionShape.direction opt.OptionShape.shape.x = Hashes.Rand(1, 3, seed, "len"); opt.OptionShape.shape.y = Hashes.Rand(1, 3, seed, "heigth"); opt.OptionShape.shape.z = Hashes.Rand(1, 3, seed, "width"); Printer.Log(60, "FireStorm Configure: done"); }
public override void Configure() { Repeater.Set(10); // 10 blocks Cycler.Set(40); opt.OptionBlock.avoidBlock = true; if (Hashes.Rand(0.1f, "rainSlime")) { opt.OptionBlock.SetBlocks("waterSlime"); } else { opt.OptionBlock.SetBlocks(ZBiomeInfo.GetBlock(seed, biome.ToString())); } Printer.Log(60, "BlockRain Configure: done"); }
public static string GetDecoProj(string seed, string biome) { Printer.Log(50, "GetDecoProj", seed, biome); ZBiomeInfo Biome = ZBiomeInfo.Get(biome); Printer.Log(50, "GetDecoProj", seed, biome, "->", Biome); String[] decoration = Biome.decoProj.Split(','); if (decoration.Length == 0) { return(null); } if (decoration.Length == 1) { return(decoration[0]); } return(decoration[Random.Next(0, decoration.Length)]); }
public override void Configure() { opt.OptionShape.shape.x = Hashes.Rand(10, 30, seed, "len"); opt.OptionShape.shape.z = Hashes.Rand(1, 4, seed, "width"); opt.OptionShape.shape.y = Hashes.Rand(1, 3, seed, "heigth"); opt.OptionShape.pace = Hashes.Rand(0.01f, 3f, seed, "pace"); opt.OptionShape.reverse = ""; opt.OptionShape.reverse = opt.OptionShape.reverse + (Hashes.Rand(0.7f, seed, "reverse") ? "R" : ""); string blk = ZBiomeInfo.GetBlock(seed, biome.ToString()); opt.OptionBlock.SetBlocks(blk); // manage multi blocks Options.MaybeFloatingObject(seed, opt); Options.Physics(seed, biomeDef, opt.OptionBlock); opt.OptionBlock.CallBack = biome.groundParticleEffect; opt.OptionBlock.RateCallBack = Peak.smokeFreq; }
public static string GetBlock(string seed, string biome) { /* * NB: cactus make no sense for peak etc - a la limite block superieur de la forme ? */ Printer.Log(50, "GetBlock", seed, biome); ZBiomeInfo Biome = ZBiomeInfo.Get(biome); Printer.Log(50, "GetBlock", seed, biome, "->", Biome); // FIXME! water seems to alter performance. Only use in fast reverse (eg geyser) // if (Hashes.Rand(seed, "water") <= 0.1 * Biome.water) return "water"; // only in reverse, maybe only in geyser ? if (Hashes.Rand(0.2f, seed, "rock")) { return(Biome.blockRock); } // if (Hashes.Rand(0.1f, seed, "trap")) return Biome.blockTrap; // should not use multiblock cactus if (Hashes.Rand(0.1f, seed, "build")) { return(Biome.blockBuild); } return(Biome.blockSoil); }
public override void Configure() { int w = Hashes.Rand(1, 4, seed, "width"); opt.OptionShape.shape.x = opt.OptionShape.shape.z = w; opt.OptionShape.shape.y = Hashes.Rand(1, 5, seed, "heigth"); // opt.OptionShape.pace = Hashes.Rand(0.01f,3f, seed,"pace"); opt.OptionShape.pace = Hashes.Rand(new float[] { 0.005f, 0.1f, 0.2f, 0.5f, 1f, 3f }, seed, "pace"); opt.OptionShape.reverse = ""; opt.OptionShape.reverse = opt.OptionShape.reverse + (Hashes.Rand(0.7f, seed, "reverse") ? "U" : ""); Printer.Log(60, "PeakAt Configure: Shape done"); string blk = ZBiomeInfo.GetBlock(seed, biome.ToString()); Printer.Log(60, "PeakAt Configure: Block=", blk); opt.OptionBlock.SetBlocks(blk); // manage multi blocks Printer.Log(60, "PeakAt Configure: Block done"); Options.Physics(seed, biomeDef, opt.OptionBlock); Printer.Log(60, "PeakAt Configure: Physics done"); // seems the random index is evaluated only once in the lambda opt.OptionBlock.CallBack = biome.groundParticleEffect; opt.OptionBlock.RateCallBack = Peak.smokeFreq; }
/* * TODO: buffZBRadiating on ghost disactivated due to Mesh warning * test on chickenV2 ? */ public static void _Define() { Printer.Print("BiomeInfo._Define()"); ZBiomeInfo desert = new ZBiomeInfo("desert", 0f); desert.blockSoil = "terrDesertGround,terrSand,terrSandStone"; desert.blockTrap = ZBiomeInfo.Blocks.cactus; desert.buffGhost = "buffZBShoking"; desert.decoProj = "rockFragment,ZBProj_treePlainsTree,Boulder,ZBProj_treeCactus03"; desert.blockRock = "terrStone,terrGravel,terrSandStoneUnstable"; desert.blockBuild = "brickBlock"; desert.zombies = "zombieYo"; desert.animals = "animalZombieVulture,animalSnake"; desert.fillBag = "resourceBrokenGlass,resourceCrushedSand,terrDirt,terrSand"; desert.envProj = "ZBProj_sand,ZBProj_electric,ZBProj_eject,ZBProj_ragdoll,ZBProj_poison"; desert.groundSmokeProjectile = "p_impact_stone_on_plant,p_impact_stone_on_earth"; desert.groundColor = new Color(218f / 255, 165f / 255, 32f / 255); desert.particleStorm = GhostData.ssandEffect; desert.waterBlock = "waterBoil,waterBoil"; desert.Ghost = Weighted <GhostData> .Of( GhostData.fbolt, 0.2f, GhostData.fghost, 0.2f, GhostData.fbomb, 0.2f, GhostData.ebolt, 2f, GhostData.eghost, 2f, GhostData.ebomb, 2f, GhostData.ybolt, 0.5f, GhostData.yghost, 0.5f, GhostData.ybomb, 0.5f, GhostData.lbolt, 0.5f, GhostData.lbomb, 0.5f, GhostData.bbolt, 1f ); ZBiomeInfo burnt_forest = new ZBiomeInfo("burnt_forest", 0.5f); burnt_forest.blockSoil = "terrBurntForestGround,terrDirt"; burnt_forest.blockTrap = "woodLogSpike1"; burnt_forest.buffGhost = "buffZBFiring"; burnt_forest.decoProj = "rockFragment,ZBProj_treePlainsTree,Boulder,ZBProj_treeShrub,ZBProj_treeDeadTree01"; burnt_forest.blockRock = "terrStone,terrDirt"; burnt_forest.blockBuild = "burntWoodBlock1,burntWoodBlock2,burntWoodBlock3,burntWoodBlock4"; burnt_forest.zombies = "zombieMoe"; burnt_forest.animals = "animalZombieBear"; burnt_forest.fillBag = "terrDirt,terrSand"; burnt_forest.envProj = "ZBProj_fire,ZBProj_fireHuman,ZBProj_fireHuman,ZBProj_eject,ZBProj_ragdoll"; burnt_forest.groundSmokeProjectile = "p_blockdestroy_stone,p_impact_stone_on_earth"; burnt_forest.particleStorm = GhostData.ssmokeEffect; burnt_forest.groundColor = new Color(139f / 255, 69f / 255, 19f / 255); burnt_forest.waterBlock = "waterBoil,waterBoil"; burnt_forest.Ghost = Weighted <GhostData> .Of( GhostData.fbolt, 2f, GhostData.fghost, 2f, GhostData.fbomb, 2f, GhostData.ebolt, 0.1f, GhostData.ybolt, 0.5f, GhostData.yghost, 0.5f, GhostData.ybomb, 0.5f, GhostData.lbolt, 0.3f, GhostData.lbomb, 0.3f, GhostData.bbolt, 1f ); ZBiomeInfo pine_forest = new ZBiomeInfo("pine_forest"); pine_forest.blockSoil = "terrForestGround"; pine_forest.blockTrap = ZBiomeInfo.Blocks.woodtrap; pine_forest.buffGhost = "buffZBRadiating,buffZBShoking,buffZBFiring"; pine_forest.decoProj = "rockFragment,ZBProj_treePlainsTree,Boulder,ZBProj_treeShrub,ZBProj_treeOakSml01,ZBProj_treeOakLrg01,ZBProj_treePlantedOak41m,ZBProj_treeMountainPine12m"; pine_forest.blockRock = "terrStone"; pine_forest.blockBuild = "woodFrameMaster"; pine_forest.zombies = "zombieFarmer"; pine_forest.animals = "animalWolf,animalMountainLion"; pine_forest.fillBag = "resourceWood,resourceClayLump"; pine_forest.envProj = "ZBProj_fire,ZBProj_eject,ZBProj_sand,ZBProj_ragdoll,ZBProj_poison"; pine_forest.groundSmokeProjectile = "p_treeGib_birch_small,p_impact_stone_on_plant,p_impact_stone_on_plant"; // p_treeGib_birch_6m is too big ? pine_forest.particleStorm = GhostData.ssmokeEffect; pine_forest.groundColor = new Color(34f / 255, 139f / 255, 34f / 255); pine_forest.waterBlock = "terrWaterPOI,terrWaterPOI,terrWaterPOI,terrWaterPOI,waterBoil"; pine_forest.Ghost = Weighted <GhostData> .Of( GhostData.fbolt, 1f, GhostData.fghost, 1f, GhostData.fbomb, 1f, GhostData.ybolt, 1f, GhostData.yghost, 1f, GhostData.ybomb, 1f, GhostData.lbolt, 1f, GhostData.lbomb, 1f, GhostData.bbolt, 1f ); ZBiomeInfo snow = new ZBiomeInfo("snow", 2f); snow.blockSoil = "terrSnow"; snow.blockTrap = "snowStalagmite"; snow.buffGhost = "buffZBRadiating,buffZBShoking"; snow.decoProj = "rockFragment,ZBProj_treePlainsTree,Boulder,ZBProj_treeShrub,ZBProj_treeWinterPine13m,ZBProj_treeWinterPine28m"; snow.blockRock = "terrStone,terrAsphalt"; snow.blockBuild = "flagstoneBlock"; snow.zombies = "zombieSnow"; snow.animals = "animalBear"; snow.fillBag = "resourceSnowBall"; snow.envProj = "ZBProj_freeze,ZBProj_electric,ZBProj_eject,ZBProj_ragdoll,ZBProj_freeze"; snow.groundSmokeProjectile = "p_treeGib_winter01,p_paint_splash2,p_impact_bullet_on_snow,p_blockdestroy_snow"; snow.particleStorm = GhostData.ssnowEffect; snow.groundColor = new Color(176f / 255, 224f / 255, 230f / 255); snow.waterBlock = "waterFreeze,waterFreeze,waterFreeze,waterBoil,terrWaterPOI"; snow.Ghost = Weighted <GhostData> .Of( GhostData.ebolt, 1f, GhostData.eghost, 1f, GhostData.ebomb, 1f, GhostData.ybolt, 1f, GhostData.yghost, 1f, GhostData.ybomb, 1f, GhostData.lbolt, 1f, GhostData.lbomb, 1f ); ZBiomeInfo wasteland = new ZBiomeInfo("wasteland"); wasteland.blockSoil = "terrDestroyedStone"; wasteland.blockTrap = string.Join(",", ZBiomeInfo.Blocks.irontrap, "barbedWireSheet"); wasteland.buffGhost = "buffZBRadiating"; wasteland.decoProj = "rockFragment,ZBProj_treePlainsTree,Boulder,ZBProj_treeShrub,ZBProj_treeOakSml01,ZBProj_treeMountainPine12m,ZBProj_treeDeadTree01"; wasteland.blockRock = "terrStone,terrDestroyedStone,terrConcrete"; wasteland.blockBuild = "concreteBlock,scrapMetalPile"; wasteland.zombies = "zombieLab"; wasteland.animals = "animalZombieDog"; wasteland.fillBag = "resourceScrapPolymers"; wasteland.envProj = "ZBProj_spark,ZBProj_poison,ZBProj_spark,ZBProj_eject,ZBProj_sand"; wasteland.groundSmokeProjectile = "p_impact_wood_on_earth,p_blockdestroy_metal"; wasteland.particleStorm = GhostData.ssandEffect; wasteland.groundColor = new Color(188f / 255, 143f / 255, 143f / 255); wasteland.waterBlock = "terrWaterPOI,terrWaterPOI,waterSlime"; wasteland.Ghost = Weighted <GhostData> .Of( GhostData.fbolt, 0.2f, GhostData.fghost, 0.2f, GhostData.fbomb, 0.2f, GhostData.ebolt, 1f, GhostData.eghost, 1f, GhostData.ebomb, 1f, GhostData.ybolt, 1f, GhostData.yghost, 1f, GhostData.ybomb, 1f, GhostData.lbolt, 1f, GhostData.lbomb, 1f, GhostData.bbolt, 1f ); Defined = true; Printer.Print("ZBiomeInfo keys:", string.Join(",", List.Keys)); }