Skip to content

Commit

Permalink
update guides
Browse files Browse the repository at this point in the history
  • Loading branch information
direwolf420 committed Apr 16, 2022
1 parent cdb8616 commit 869c73b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
21 changes: 9 additions & 12 deletions Guides/Cute Slimes how to add more.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
(0) Prerequisites

* Do the usual stuff when adding a pet (item, buff, projectile). Naming conventions:
* Item name: `CuteSlimeColorNew`
* Buff name: `CuteSlimeColorNewBuff`
* Projectile name: `CuteSlimeColorNewProj`
* In PetPlayer and Buff: `public bool CuteSlimeColorNew = false;`, the `CuteSlimeColorNew` is used
in the Buff class like this: `mPlayer.CuteSlimeColorNew`
* Item name: `CuteSlimeColor`
* Buff name: `CuteSlimeColorBuff`
* Projectile name: `CuteSlimeColorProj`
* In PetPlayer and Buff: `public bool CuteSlimeColor = false;`, the `CuteSlimeColor` is used
in the Buff class like this: `mPlayer.CuteSlimeColor`

* For the buff, use the template of previous cute slimes.

Expand All @@ -17,19 +17,16 @@ in the Buff class like this: `mPlayer.CuteSlimeColorNew`
(1) SlimePets.cs

* In LoadPets(): (all adds recommended in alphabetic order)
* Add the NPC to `slimePetNPCs`
* Add the pet to `slimePetList` **<-MUST HAVE FOR ACCESSORIES TO WORK**
* Follow the "TEMPLATE EXPLANATION" comment or copypaste a similar pet and adjust that
* Add the NPC to `slimePetRegularNPCs` (if applicable)
* Add the pet via `Add(SlimePet.NewSlimePet())` **<-MUST HAVE FOR ACCESSORIES TO WORK**
* Follow the "TEMPLATE EXPLANATION" comments or copypaste a similar pet and adjust that

***


(2) Items/PetAccessories/PetAccessoryClass.cs

* if you want to add alternative textures based on the pet they are on (Suffixed with `_Draw<identifyingNumber>`), call AddPetVariation()
on the PetAccessory object (watch the brackets) and assign each pet a texture to use
(-1 is "not rendered", 0 is "default, > 0 is "use `_Draw<identifyingNumber>` texture")
you can leave the other pet types out if you only need to adjust the texture of one pet
* read the "ADD PET ACCESSORY PROPERTIES HERE" comments


***
Expand Down
25 changes: 14 additions & 11 deletions Guides/Pet Alts How To Implement.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@
>For pets that don't have alt textures yet, do everything from scratch besides the declaration of
>the `public bool ClassName = false;` thing that you should already have
* "ClassName" excludes the "Proj" suffix, it will be mentioned in the guide when you need to add it
* if the projectile doesn't have "Proj" in its name, you don't need to include it manually, but for things like
classNameType, there should be no "Proj" in it
* for things like classNameType, there should be no "Proj" in it
* in PetPlayer.cs: `public bool ClassName = false;` and `ClassName = false;` in ResetEffects()
* in each step after the second, the place where you need to add stuff is marked via `//ALTERNATE`,
please don't remove the commented out sample code, instead, add your stuff between the existing code and the sample code
* Example 1: `ClassName == YoungWyvern` (no Proj), `classNameType == youngWyvernType`
* Example 2: `ClassName == PetFishronProj`, `classNameType == petFishronType`
* Example: `ClassName == PetFishronProj`, `classNameType == petFishronType`

***

Expand Down Expand Up @@ -48,14 +45,14 @@ public override string Texture
//using AssortecCrazyThings.Base;
public override bool PreDraw(ref Color lightColor)
{
PetPlayer mPlayer = projectile.GetOwner().GetModPlayer<PetPlayer>();
SpriteEffects effects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Texture2D image = mod.GetTexture("Projectiles/Pets/ClassNameProj_" + mPlayer.classNameType).Value;
PetPlayer mPlayer = Projectile.GetOwner().GetModPlayer<PetPlayer>();
SpriteEffects effects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Texture2D image = Mod.Assets.Request<Texture2D>("Projectiles/Pets/ClassNameProj_" + mPlayer.classNameType).Value;
Rectangle bounds = image.Frame(1, Main.projFrames[Projectile.type], frameY: Projectile.frame);

Vector2 stupidOffset = new Vector2(projectile.width / 2, projectile.height / 2 + projectile.gfxOffY);

Main.spriteBatch.Draw(image, projectile.position - Main.screenPosition + stupidOffset, bounds, lightColor, projectile.rotation, bounds.Size() / 2, projectile.scale, effects, 0f);
Main.EntitySpriteDraw(image, Projectile.position - Main.screenPosition + stupidOffset, bounds, lightColor, Projectile.rotation, bounds.Size() / 2, Projectile.scale, effects, 0);

return false;
}
Expand All @@ -75,7 +72,13 @@ public byte classNameType = 0;

[...]

public void GetFromClonedTypes(string mp = "")
public override void Initialize()
{
[..all the other pet types..]
classNameType = 0;
}

public void GetFromClonedTypes()
{
[..all the other pet types..]
classNameType = ClonedTypes[index++];
Expand All @@ -92,7 +95,7 @@ public void SetClonedTypes()

* At this point, the pet will render with its _0 texture selected.
Check with Modder's Toolkit if the hitbox aligns with the texture, if not,
adjust `stupidOffset` accordingly in PreDraw() (example: YoungWyvern.cs)
adjust `stupidOffset` accordingly in PreDraw() (example: YoungWyvernProj.cs)


***
Expand Down
2 changes: 1 addition & 1 deletion Guides/Pet Vanity how to add more.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Everything is done in the Items/PetAccessories/PetAccessoryClass.cs file
```
public class PetAccessoryThing : PetAccessoryItem
{
public override void SetStaticDefaults()
public override void SafeSetStaticDefaults()
{
DisplayName.SetDefault("Cute Thing");
Tooltip.SetDefault("'A thing for your cute slime to wear on a certain body part'");
Expand Down

0 comments on commit 869c73b

Please sign in to comment.