- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCensorSystem.cs
More file actions
Latest commit
63 lines (57 loc) · 2.28 KB
/
Copy pathCensorSystem.cs
File metadata and controls
63 lines (57 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
usingTerraria;
usingTerraria.ModLoader;
usingMicrosoft.Xna.Framework.Graphics;
usingMicrosoft.Xna.Framework;
namespaceTSC
{
publicstaticclassCensorLogic
{
publicstaticboolShouldCensor(Modmod)
{
if(mod==null)returnfalse;
varconfig=ModContent.GetInstance<TSCConfig>();
if(config!=null&&config.CensoredMods!=null)
{
if(config.CensoredMods.TryGetValue(mod.Name,outintstate)&&state>0)
{
// Censor IF the mod's target rating is stricter (higher) than your currently allowed mode
if(state>(int)config.CurrentSpiceLevel)
{
returntrue;
}
}
}
returnfalse;
}
}
publicclassCensorItems:GlobalItem
{
publicoverrideboolPreDrawInInventory(Itemitem,SpriteBatchspriteBatch,Vector2position,Rectangleframe,
ColordrawColor,ColoritemColor,Vector2origin,floatscale)
{
if(CensorLogic.ShouldCensor(item.ModItem?.Mod))returnfalse;
returnbase.PreDrawInInventory(item,spriteBatch,position,frame,drawColor,itemColor,origin,scale);
}
publicoverrideboolPreDrawInWorld(Itemitem,SpriteBatchspriteBatch,ColorlightColor,ColoralphaColor,reffloatrotation,reffloatscale,intwhoAmI)
{
if(CensorLogic.ShouldCensor(item.ModItem?.Mod))returnfalse;
returnbase.PreDrawInWorld(item,spriteBatch,lightColor,alphaColor,refrotation,refscale,whoAmI);
}
}
publicclassCensorNPCs:GlobalNPC
{
publicoverrideboolPreDraw(NPCnpc,SpriteBatchspriteBatch,Vector2screenPos,ColordrawColor)
{
if(CensorLogic.ShouldCensor(npc.ModNPC?.Mod))returnfalse;
returnbase.PreDraw(npc,spriteBatch,screenPos,drawColor);
}
}
publicclassCensorProjectiles:GlobalProjectile
{
publicoverrideboolPreDraw(Projectileprojectile,refColorlightColor)
{
if(CensorLogic.ShouldCensor(projectile.ModProjectile?.Mod))returnfalse;
returnbase.PreDraw(projectile,reflightColor);
}
}
}