@@ -67,6 +67,17 @@ internal static void SetClickerWeaponDefaults(Item item)
6767 ClickerClass ? . Call ( "SetClickerWeaponDefaults" , versionString , item ) ;
6868 }
6969
70+ /// <summary>
71+ /// Call in <see cref="ModItem.SetDefaults"/> to set important default fields for a "sfx button". Set fields:
72+ /// maxStack.
73+ /// Only change them afterwards if you know what you are doing!
74+ /// </summary>
75+ /// <param name="item">The <see cref="Item"/> to set the defaults for</param>
76+ internal static void SetSFXButtonDefaults ( Item item )
77+ {
78+ ClickerClass ? . Call ( "SetSFXButtonDefaults" , versionString , item ) ;
79+ }
80+
7081 /// <summary>
7182 /// Call in <see cref="ModProjectile.SetDefaults"/> to set important default fields for a clicker projectile. Set fields:
7283 /// DamageType.
@@ -108,7 +119,7 @@ internal static void RegisterClickerItem(ModItem modItem)
108119 }
109120
110121 /// <summary>
111- /// Call this in <see cref="ModType.SetStaticDefaults"/> to register this weapon into the "clicker class" category as a "clicker".
122+ /// Call this in <see cref="ModType.SetStaticDefaults"/> to register this weapon into the "clicker class" category as a "clicker".<br/>
112123 /// Do not call <see cref="RegisterClickerItem"/> with it as this method does this already by itself
113124 /// </summary>
114125 /// <param name="modItem">The <see cref="ModItem"/> that is to be registered</param>
@@ -118,6 +129,18 @@ internal static void RegisterClickerWeapon(ModItem modItem, string borderTexture
118129 ClickerClass ? . Call ( "RegisterClickerWeapon" , versionString , modItem , borderTexture ) ;
119130 }
120131
132+ /// <summary>
133+ /// Call this in <see cref="ModType.SetStaticDefaults"/> to register this item into the "sfx button" category.<br/>
134+ /// It will automatically contribute to the active "sfx buttons" when in the inventory<br/>
135+ /// Do not call <see cref="RegisterClickerItem"/> with it as this method does this already by itself
136+ /// </summary>
137+ /// <param name="modItem">The <see cref="ModItem"/> that is to be registered</param>
138+ /// <param name="playSoundAction">The method that runs that will play the sound</param>
139+ internal static void RegisterSFXButton ( ModItem modItem , Action < int > playSoundAction )
140+ {
141+ ClickerClass ? . Call ( "RegisterSFXButton" , versionString , modItem , playSoundAction ) ;
142+ }
143+
121144 /// <summary>
122145 /// Call this in <see cref="Mod.PostSetupContent"/> or <see cref="ModType.SetStaticDefaults"/> to register this click effect
123146 /// </summary>
@@ -263,6 +286,46 @@ internal static bool IsClickerItem(Item item)
263286 return ClickerClass ? . Call ( "IsClickerItem" , versionString , item ) as bool ? ?? false ;
264287 }
265288
289+ /// <summary>
290+ /// Call this to check if an item is an "sfx button"
291+ /// </summary>
292+ /// <param name="item">The item to be checked</param>
293+ /// <returns><see langword="true"/> if an "sfx button"</returns>
294+ internal static bool IsSFXButton ( Item item )
295+ {
296+ return ClickerClass ? . Call ( "IsSFXButton" , versionString , item ) as bool ? ?? false ;
297+ }
298+
299+ /// <summary>
300+ /// Call this to check if an item type is an "sfx button"
301+ /// </summary>
302+ /// <param name="type">The item type to be checked</param>
303+ /// <returns><see langword="true"/> if an "sfx button"</returns>
304+ internal static bool IsSFXButton ( int type )
305+ {
306+ return ClickerClass ? . Call ( "IsSFXButton" , versionString , type ) as bool ? ?? false ;
307+ }
308+
309+ /// <summary>
310+ /// Call this to get the sound playing method of an "sfx button"
311+ /// </summary>
312+ /// <param name="item">The item to be checked</param>
313+ /// <returns><see langword="null"/> if not "sfx button"</returns>
314+ internal static Action < int > GetSFXButton ( Item item )
315+ {
316+ return ClickerClass ? . Call ( "GetSFXButton" , versionString , item ) as Action < int > ?? null ;
317+ }
318+
319+ /// <summary>
320+ /// Call this to get the sound playing method of an "sfx button"
321+ /// </summary>
322+ /// <param name="type">The item type to be checked</param>
323+ /// <returns><see langword="null"/> if not "sfx button"</returns>
324+ internal static Action < int > GetSFXButton ( int type )
325+ {
326+ return ClickerClass ? . Call ( "GetSFXButton" , versionString , type ) as Action < int > ?? null ;
327+ }
328+
266329 /// <summary>
267330 /// Call this to check if an item type is a "clicker"
268331 /// </summary>
@@ -546,6 +609,40 @@ internal static bool HasClickEffect(Player player, string effect)
546609 return ClickerClass ? . Call ( "HasClickEffect" , versionString , player , effect ) as bool ? ?? false ;
547610 }
548611
612+ /// <summary>
613+ /// Returns all currently active "sfx button" stacks.<br/>
614+ /// Use with <see cref="GetSFXButton"/> to get the sound
615+ /// </summary>
616+ /// <param name="player">The player</param>
617+ /// <returns>Dictionary mapping item type to stack</returns>
618+ internal static IReadOnlyDictionary < int , int > GetAllSFXButtonStacks ( Player player )
619+ {
620+ return ClickerClass ? . Call ( "GetAllSFXButtonStacks" , versionString , player ) as IReadOnlyDictionary < int , int > ?? null ;
621+ }
622+
623+ /// <summary>
624+ /// Counts the stack of the given <paramref name="item"/> up by its stack<br/>
625+ /// </summary>
626+ /// <param name="player">The player</param>
627+ /// <param name="item">The item</param>
628+ /// <returns><see langword="true"/> it reached 5</returns>
629+ internal static bool AddSFXButtonStack ( Player player , Item item )
630+ {
631+ return ClickerClass ? . Call ( "AddSFXButtonStack" , versionString , player , item ) as bool ? ?? false ;
632+ }
633+
634+ /// <summary>
635+ /// Counts the stack of the given item type up by <paramref name="stack"/><br/>
636+ /// </summary>
637+ /// <param name="player">The player</param>
638+ /// <param name="type">The item type</param>
639+ /// <param name="stack">The stack to add</param>
640+ /// <returns><see langword="true"/> if it reached 5</returns>
641+ internal static bool AddSFXButtonStack ( Player player , int type , int stack )
642+ {
643+ return ClickerClass ? . Call ( "AddSFXButtonStack" , versionString , player , type , stack ) as bool ? ?? false ;
644+ }
645+
549646 /// <summary>
550647 /// Sets an auto-reuse effect to be applied to the player. Will apply the fastest one onto the player (if there are multiple active ones)
551648 /// </summary>
0 commit comments