Skip to content

Commit c47b425

Browse files
committed
Add "Always Spawn" option to Silver Berries (closes #110)
1 parent a5eae8a commit c47b425

File tree

6 files changed

+13
-4
lines changed

6 files changed

+13
-4
lines changed

Ahorn/entities/silverBerry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module CollabUtils2SilverBerry
22

33
using ..Ahorn, Maple
44

5-
@mapdef Entity "CollabUtils2/SilverBerry" SilverBerry(x::Integer, y::Integer)
5+
@mapdef Entity "CollabUtils2/SilverBerry" SilverBerry(x::Integer, y::Integer, alwaysSpawn::Bool=false)
66

77
const placements = Ahorn.PlacementDict(
88
"Silver Berry (Collab Utils 2 / READ DOCS)" => Ahorn.EntityPlacement(

Ahorn/lang/en_gb.lang

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ placements.entities.CollabUtils2/FakeMiniHeart.tooltips.playPulseSound=Whether t
2828
placements.entities.CollabUtils2/FakeMiniHeart.tooltips.playBreakSound=Whether the heart should play a refill sound when broken.
2929
placements.entities.CollabUtils2/FakeMiniHeart.tooltips.flagOnBreak=If filled out, the given flag will be set when the fake mini heart is broken.
3030

31+
# Silver Berry
32+
placements.entities.CollabUtils2/SilverBerry.tooltips.alwaysSpawn=If checked, the silver berry will always spawn, even if the player did not complete the map yet.
33+
3134
# Rainbow Berry
3235
placements.entities.CollabUtils2/RainbowBerry.tooltips.levelSet=The rainbow berry will only spawn if all silver berries in this level set have been collected.
3336
placements.entities.CollabUtils2/RainbowBerry.tooltips.maps=This setting allows to restrict which maps in the level set this rainbow berry takes into account. To do this, list the map names (.bin names only) separated by commas.\nLeave empty if you want the player to collect all silver berries in the level set to make the rainbow berry spawn.

Entities/SilverBerry.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ public class SilverBerry : Strawberry {
1616
private static ParticleType P_OrigGhostGlow;
1717

1818
private bool spawnedThroughGiveSilver = false;
19+
private readonly bool alwaysSpawn;
1920

2021
public SilverBerry(EntityData data, Vector2 offset, EntityID gid) : base(data, offset, gid) {
2122
new DynData<Strawberry>(this)["Golden"] = true;
23+
alwaysSpawn = data.Bool("alwaysSpawn");
2224

2325
if (P_SilverGlow == null) {
2426
P_SilverGlow = new ParticleType(P_Glow) {
@@ -39,7 +41,7 @@ public override void Added(Scene scene) {
3941

4042
Session session = (scene as Level).Session;
4143
if (!spawnedThroughGiveSilver && ((session.FurthestSeenLevel != session.Level && session.Deaths != 0) ||
42-
(!SaveData.Instance.CheatMode && !SaveData.Instance.Areas_Safe[session.Area.ID].Modes[(int) session.Area.Mode].Completed))) {
44+
(!alwaysSpawn && !SaveData.Instance.CheatMode && !SaveData.Instance.Areas_Safe[session.Area.ID].Modes[(int) session.Area.Mode].Completed))) {
4345

4446
// we went in a further screen and die, or didn't complete the level once yet: don't have the berry spawn.
4547
RemoveSelf();

Loenn/entities/silverBerry.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ silverBerry.name = "CollabUtils2/SilverBerry"
33
silverBerry.depth = -100
44
silverBerry.placements = {
55
{
6-
name = "default"
6+
name = "default",
7+
data = {
8+
alwaysSpawn = false
9+
}
710
}
811
}
912

Loenn/lang/en_gb.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ entities.CollabUtils2/RainbowBerry.attributes.description.requires=The amount of
4040

4141
# Silver Berry
4242
entities.CollabUtils2/SilverBerry.placements.name.default=Silver Berry
43+
entities.CollabUtils2/SilverBerry.attributes.description.alwaysSpawn=If checked, the silver berry will always spawn, even if the player did not complete the map yet.
4344

4445
# Silver Block
4546
entities.CollabUtils2/SilverBlock.placements.name.default=Silver Block

everest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- Name: CollabUtils2
2-
Version: 1.10.13
2+
Version: 1.10.14
33
DLL: bin/Release/net452/CollabUtils2.dll
44
Dependencies:
55
- Name: Everest

0 commit comments

Comments
 (0)