Modding:Block and Item Interactions: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
No edit summary
(One intermediate revision by the same user not shown)
Line 1: Line 1:
__FORCETOC__
__FORCETOC__
{{GameVersion|1.9}}
{{GameVersion|1.13}}


This tutorial should introduce you into the basics of custom interactions. We will create a magic wand which should spawn particles when holding right click.
This tutorial should introduce you into the basics of custom interactions. We will create a magic wand which should spawn particles when holding right click.
Line 66: Line 66:
         public static SimpleParticleProperties particles = new SimpleParticleProperties(
         public static SimpleParticleProperties particles = new SimpleParticleProperties(
                     1, 1,
                     1, 1,
                     ColorUtil.ColorFromArgb(50, 220, 220, 220),
                     ColorUtil.ColorFromRgba(220, 220, 220, 50),
                     new Vec3d(),
                     new Vec3d(),
                     new Vec3d(),
                     new Vec3d(),
Line 99: Line 99:
                     particles.MinVelocity = speedVec;
                     particles.MinVelocity = speedVec;
                     Random rand = new Random();
                     Random rand = new Random();
                     particles.Color = ColorUtil.ToRGBABytes(ColorUtil.ColorFromArgb(255, rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255)));
                     particles.Color = ColorUtil.ColorFromRgba(rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255), 255);
                     particles.MinPos = pos.AddCopy(-0.05, -0.05, -0.05);
                     particles.MinPos = pos.AddCopy(-0.05, -0.05, -0.05);
                     particles.AddPos.Set(0.1, 0.1, 0.1);
                     particles.AddPos.Set(0.1, 0.1, 0.1);
Line 131: Line 131:
                     particles.MinVelocity = speedVec;
                     particles.MinVelocity = speedVec;
                     Random rand = new Random();
                     Random rand = new Random();
                     particles.Color = ColorUtil.ToRgba(255, rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255));
                     particles.Color = ColorUtil.ColorFromRgba(rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255), 255);
                     particles.MinPos = pos.AddCopy(-0.05, -0.05, -0.05);
                     particles.MinPos = pos.AddCopy(-0.05, -0.05, -0.05);
                     particles.AddPos.Set(0.1, 0.1, 0.1);
                     particles.AddPos.Set(0.1, 0.1, 0.1);
Confirmedusers, Bureaucrats, editor, Administrators
1,778

edits