Modding:Commands: Difference between revisions

From Vintage Story Wiki
no edit summary
m (VeryGoodDog moved page Mod:Commands to Modding:Commands: clean up main namespace)
No edit summary
Line 50: Line 50:
                 (IServerPlayer player, int groupId, CmdArgs args) =>
                 (IServerPlayer player, int groupId, CmdArgs args) =>
                     {
                     {
                         IEntityPlayer byEntity = player.Entity;
                         EntityPlayer byEntity = player.Entity;
                         byEntity.World.PlaySoundAt(sound, byEntity); // Play sound
                         byEntity.World.PlaySoundAt(sound, byEntity); // Play sound


                         Vec3d pos = byEntity.Pos.XYZ.Add(0, byEntity.EyeHeight(), 0); // Setting up position to spawn particles
                         Vec3d pos = byEntity.Pos.XYZ.Add(0, byEntity.EyeHeight, 0); // Setting up position to spawn particles
                         Random rand = new Random();
                         Random rand = new Random();
                         for (int i = 0; i < 100; i++) // Spawn 100 particles
                         for (int i = 0; i < 100; i++) // Spawn 100 particles
Line 59: Line 59:
                             Vec3d realPos = pos.AddCopy(-0.1 + rand.NextDouble() * 0.2, 0, -0.1 + rand.NextDouble() * 0.2);
                             Vec3d realPos = pos.AddCopy(-0.1 + rand.NextDouble() * 0.2, 0, -0.1 + rand.NextDouble() * 0.2);
                             Vec3f velocity = new Vec3f(-0.2F + (float) rand.NextDouble() * 0.4F, 0.4F + (float) rand.NextDouble() * 2F, -0.2F + (float) rand.NextDouble() * 0.4F);
                             Vec3f velocity = new Vec3f(-0.2F + (float) rand.NextDouble() * 0.4F, 0.4F + (float) rand.NextDouble() * 2F, -0.2F + (float) rand.NextDouble() * 0.4F);
                             byEntity.World.SpawnParticles(1, ColorUtil.ColorFromArgb(255, rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255)),
                             byEntity.World.SpawnParticles(1, ColorUtil.ColorFromRgba(255, rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255)),
                                 realPos, realPos,
                                 realPos, realPos,
                                 velocity, velocity, (float) rand.NextDouble()*1 + 1, 0.01F,
                                 velocity, velocity, (float) rand.NextDouble()*1 + 1, 0.01F,
219

edits