Skip to content

Commit 15dcbdf

Browse files
committed
✨ 渲染卡顿自动关闭特效
1 parent 3c06971 commit 15dcbdf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/mindustryX/features/RenderExt.java

+7
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ public static void init(){
9999
unitHideMinHealth = Core.settings.getInt("unitDrawMinHealth");
100100
unitWeaponTargetLine = Core.settings.getBool("unitWeaponTargetLine");
101101
unitItemCarried = Core.settings.getBool("unitItemCarried");
102+
103+
if(renderer.enableEffects && Time.nanosToMillis(DebugUtil.rendererTime) > 200){
104+
renderer.enableEffects = false;
105+
Core.settings.put("effects", false);
106+
UIExt.announce("[yellow]渲染耗时过长,自动关闭特效");
107+
}
102108
});
103109
Events.run(Trigger.draw, RenderExt::draw);
104110
Events.on(TileChangeEvent.class, RenderExt::onSetBlock);
@@ -134,6 +140,7 @@ private static void draw(){
134140

135141
public static void onGroupDraw(Drawc t){
136142
if(!bulletShow && t instanceof Bulletc) return;
143+
if(!renderer.enableEffects && t instanceof EffectState) return;
137144
if(t instanceof Unitc u) hide:{
138145
if(u.isPlayer() && (u.isLocal() || unitHideExcludePlayers)) break hide;
139146
if(unitHide || u.maxHealth() + u.shield() < unitHideMinHealth) return;

0 commit comments

Comments
 (0)