public static void JumpSpeed(Player mountedPlayer, Mount.MountData mount, ref float jumpSpeed, float xVelocity) { if (IsModMountData(mount)) { mount.modMountData.JumpSpeed(mountedPlayer, ref jumpSpeed, xVelocity); } }
internal static void SetupMount(Mount.MountData mount) { if (IsModMountData(mount)) { GetMount(mount.modMountData.Type).SetupMount(mount); } }
public static void JumpHeight(Player mountedPlayer, Mount.MountData mount, ref int jumpHeight, float xVelocity) { if (IsModMountData(mount)) { mount.modMountData.JumpHeight(mountedPlayer, ref jumpHeight, xVelocity); } }
//todo: this is never called, why is this in here? internal static bool CustomBodyFrame(Mount.MountData mount) { if (IsModMountData(mount) && mount.modMountData.CustomBodyFrame()) { return(true); } return(false); }
internal void SetupMount(Mount.MountData mountData) { ModMountData newMountData = (ModMountData)MemberwiseClone(); newMountData.mountData = mountData; mountData.modMountData = newMountData; newMountData.mod = mod; newMountData.SetDefaults(); }
internal void SetupMount(Mount.MountData mountData) { ModMountData newMountData = (ModMountData)Activator.CreateInstance(GetType()); newMountData.mountData = mountData; mountData.modMountData = newMountData; newMountData.mod = mod; newMountData.SetDefaults(); }
public override void SetDefaults() { Mount.MountData mount = this.mountData; mount.buff = ModContent.BuffType <SquirrelTransformationBuff>(); mount.heightBoost = -26; mount.fallDamage = 0.25f; mount.runSpeed = 4.0f; mount.dashSpeed = 5.0f; mount.flightTimeMax = 0; mount.fatigueMax = 0; mount.jumpHeight = 12; mount.acceleration = 0.25f; mount.jumpSpeed = 4.0f; mount.blockExtraJumps = false; mount.totalFrames = 6; mount.constantJump = false; int[] numArray = new int[mount.totalFrames]; for (int index = 0; index < numArray.Length; ++index) { numArray[index] = 0; } mount.playerYOffsets = numArray; mount.xOffset = 0; mount.bodyFrame = 0; mount.yOffset = -4; mount.playerHeadOffset = -24; mount.standingFrameCount = 1; mount.standingFrameDelay = 10; mount.standingFrameStart = 0; mount.runningFrameCount = 5; mount.runningFrameDelay = 15; mount.runningFrameStart = 1; mount.flyingFrameCount = 1; mount.flyingFrameDelay = 0; mount.flyingFrameStart = 2; mount.inAirFrameCount = 1; mount.inAirFrameDelay = 0; mount.inAirFrameStart = 2; mount.idleFrameCount = 1; mount.idleFrameDelay = 10; mount.idleFrameStart = 0; mount.idleFrameLoop = true; mount.swimFrameCount = mount.inAirFrameCount; mount.swimFrameDelay = mount.inAirFrameDelay; mount.swimFrameStart = mount.inAirFrameStart; if (Main.netMode == NetmodeID.Server) { return; } mount.textureWidth = mount.backTexture.Width; mount.textureHeight = mount.backTexture.Height; }
/// <summary> /// Constructor /// </summary> public ModMountData() { mountData = new Mount.MountData(); }
void CopyDefToEntity(MountDef def, ref Mount.MountData mount) { if (mount == null) { mount = new Mount.MountData(); } mount.abilityChargeMax = def.MaxAbilityCharge; mount.abilityCooldown = def.AbilityCooldown; mount.abilityDuration = def.AbilityDuration; mount.heightBoost = def.AdditionalHeight; mount.playerHeadOffset = def.PlayerHeadOffset; mount.fatigueMax = def.MaxFatigue; mount.flightTimeMax = def.MaxFlightTime; mount.jumpHeight = def.JumpHeight; mount.spawnDust = def.SpawnDust; mount.bodyFrame = def.BodyFrame; mount.totalFrames = def.TotalFrames; mount.fallDamage = def.FallDamageMult; mount.acceleration = def.Acceleration; mount.dashSpeed = def.DashSpeed; mount.jumpSpeed = def.JumpSpeed; mount.runSpeed = def.RunSpeed; mount.swimSpeed = def.SwimSpeed; mount.blockExtraJumps = def.BlockExtraJumps; mount.constantJump = def.ConstantJump; mount.emitsLight = def.EmitsLight; mount.idleFrameLoop = def.IdleFrameLoop; mount.Minecart = def.IsMinecart; mount.MinecartDirectional = def.IsDirectionalMinecart; mount.spawnDustNoGravity = def.SpawnDustNoGravity; mount.usesHover = def.UsesHover; mount.playerYOffsets = def.PlayerYOffset; mount.MinecartDust = def.MinecartDust; mount.xOffset = def.Offset.X; mount.yOffset = def.Offset.Y; mount.lightColor = def.LightColour.ToVector3(); mount.dashingFrameCount = def.Dashing.Count; mount.dashingFrameDelay = def.Dashing.Delay; mount.dashingFrameStart = def.Dashing.Start; mount.flyingFrameCount = def.Flying.Count; mount.flyingFrameDelay = def.Flying.Delay; mount.flyingFrameStart = def.Flying.Start; mount.idleFrameCount = def.Idle.Count; mount.idleFrameDelay = def.Idle.Delay; mount.idleFrameStart = def.Idle.Start; mount.inAirFrameCount = def.InAir.Count; mount.inAirFrameDelay = def.InAir.Delay; mount.inAirFrameStart = def.InAir.Start; mount.runningFrameCount = def.Running.Count; mount.runningFrameDelay = def.Running.Delay; mount.runningFrameStart = def.Running.Start; mount.standingFrameCount = def.Standing.Count; mount.standingFrameDelay = def.Standing.Delay; mount.standingFrameStart = def.Standing.Start; mount.swimFrameCount = def.Swim.Count; mount.swimFrameDelay = def.Swim.Delay; mount.swimFrameStart = def.Swim.Start; mount.buff = def.Buff.Resolve().Type; mount.extraBuff = (def.ExpertBuff ?? def.Buff).Resolve().Type; mount.frontTexture = def.Front.GetNormal(); mount.frontTextureExtra = def.Front.GetExtra(); mount.frontTextureGlow = def.Front.GetGlow(); mount.frontTextureExtraGlow = def.Front.GetExtraGlow(); mount.backTexture = def.Back.GetNormal(); mount.backTextureExtra = def.Back.GetExtra(); mount.backTextureGlow = def.Back.GetGlow(); mount.backTextureExtraGlow = def.Back.GetExtraGlow(); mount.textureWidth = def.texSize.X; mount.textureHeight = def.texSize.Y; }
void CopyEntityToDef(int id, Mount.MountData mount, MountDef def) { def.Type = id; def.MaxAbilityCharge = mount.abilityChargeMax; def.AbilityCooldown = mount.abilityCooldown; def.AbilityDuration = mount.abilityDuration; def.AdditionalHeight = mount.heightBoost; def.PlayerHeadOffset = mount.playerHeadOffset; def.MaxFatigue = mount.fatigueMax; def.MaxFlightTime = mount.flightTimeMax; def.JumpHeight = mount.jumpHeight; def.SpawnDust = mount.spawnDust; def.BodyFrame = mount.bodyFrame; def.TotalFrames = mount.totalFrames; def.FallDamageMult = mount.fallDamage; def.Acceleration = mount.acceleration; def.DashSpeed = mount.dashSpeed; def.JumpSpeed = mount.jumpSpeed; def.RunSpeed = mount.runSpeed; def.SwimSpeed = mount.swimSpeed; def.BlockExtraJumps = mount.blockExtraJumps; def.ConstantJump = mount.constantJump; def.EmitsLight = mount.emitsLight; def.IdleFrameLoop = mount.idleFrameLoop; def.IsMinecart = mount.Minecart | MountSets.Cart[id]; def.IsDirectionalMinecart = mount.MinecartDirectional; def.SpawnDustNoGravity = mount.spawnDustNoGravity; def.UsesHover = mount.usesHover; def.PlayerYOffset = mount.playerYOffsets; def.MinecartDust = mount.MinecartDust; def.Offset = new Point(mount.xOffset, mount.yOffset); def.LightColour = new Color(mount.lightColor); def.Dashing = new MountFrameData(mount.dashingFrameCount, mount.dashingFrameDelay, mount.dashingFrameStart); def.Flying = new MountFrameData(mount.flyingFrameCount, mount.flyingFrameDelay, mount.flyingFrameStart); def.Idle = new MountFrameData(mount.idleFrameCount, mount.idleFrameDelay, mount.idleFrameStart); def.InAir = new MountFrameData(mount.inAirFrameCount, mount.inAirFrameDelay, mount.inAirFrameStart); def.Running = new MountFrameData(mount.runningFrameCount, mount.runningFrameDelay, mount.runningFrameStart); def.Standing = new MountFrameData(mount.standingFrameCount, mount.standingFrameDelay, mount.standingFrameStart); def.Swim = new MountFrameData(mount.swimFrameCount, mount.swimFrameDelay, mount.swimFrameStart); def.Buff = new BuffRef(mount.buff); def.ExpertBuff = new BuffRef(mount.extraBuff); def.Front = new MountTextureData( () => mount.frontTexture, () => mount.frontTextureExtra, () => mount.frontTextureGlow, () => mount.frontTextureExtraGlow ); def.Back = new MountTextureData( () => mount.backTexture, () => mount.backTextureExtra, () => mount.backTextureGlow, () => mount.backTextureExtraGlow ); }
internal static bool IsModMountData(Mount.MountData mountData) { return(mountData.modMountData != null); }
internal void SetupContent() { foreach (ModItem item in items.Values) { Main.itemTexture[item.item.type] = ModLoader.GetTexture(item.texture); Main.itemName[item.item.type] = item.item.name; EquipLoader.SetSlot(item.item); item.SetDefaults(); DrawAnimation animation = item.GetAnimation(); if (animation != null) { Main.RegisterItemAnimation(item.item.type, animation); ItemLoader.animations.Add(item.item.type); } if (item.flameTexture.Length > 0) { Main.itemFlameTexture[item.item.type] = ModLoader.GetTexture(item.flameTexture); } } foreach (ModDust dust in dusts.Values) { dust.SetDefaults(); } foreach (ModTile tile in tiles.Values) { Main.tileTexture[tile.Type] = ModLoader.GetTexture(tile.texture); TileLoader.SetDefaults(tile); } foreach (GlobalTile globalTile in globalTiles.Values) { globalTile.SetDefaults(); } foreach (ModWall wall in walls.Values) { Main.wallTexture[wall.Type] = ModLoader.GetTexture(wall.texture); wall.SetDefaults(); } foreach (GlobalWall globalWall in globalWalls.Values) { globalWall.SetDefaults(); } foreach (ModProjectile projectile in projectiles.Values) { Main.projectileTexture[projectile.projectile.type] = ModLoader.GetTexture(projectile.texture); Main.projFrames[projectile.projectile.type] = 1; projectile.SetDefaults(); if (projectile.projectile.hostile) { Main.projHostile[projectile.projectile.type] = true; } if (projectile.projectile.aiStyle == 7) { Main.projHook[projectile.projectile.type] = true; } } foreach (ModNPC npc in npcs.Values) { Main.npcTexture[npc.npc.type] = ModLoader.GetTexture(npc.texture); Main.npcName[npc.npc.type] = npc.npc.name; npc.SetDefaults(); if (npc.npc.lifeMax > 32767 || npc.npc.boss) { Main.npcLifeBytes[npc.npc.type] = 4; } else if (npc.npc.lifeMax > 127) { Main.npcLifeBytes[npc.npc.type] = 2; } else { Main.npcLifeBytes[npc.npc.type] = 1; } } foreach (ModMountData modMountData in mountDatas.Values) { Mount.MountData temp = modMountData.mountData; temp.modMountData = modMountData; MountLoader.SetupMount(modMountData.mountData); Mount.mounts[modMountData.Type] = temp; } foreach (ModBuff buff in buffs.Values) { Main.buffTexture[buff.Type] = ModLoader.GetTexture(buff.texture); Main.buffName[buff.Type] = buff.Name; buff.SetDefaults(); } }