Skip to content

Commit

Permalink
Merge branch 'BlackDeluxeCat:master' into yzh
Browse files Browse the repository at this point in the history
  • Loading branch information
YaeSakuraQvQ authored Jul 18, 2023
2 parents f9ae676 + e763783 commit ba30711
Show file tree
Hide file tree
Showing 15 changed files with 310 additions and 135 deletions.
20 changes: 14 additions & 6 deletions assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ai.config.follow = Co-Build
ai.config.autorebuild = Auto Rebuild
ai.config.attack = Attack
ai.config.heal = Heal
ai.config.oneTime = One-Time
ai.config.oneTime = One-Time Pick

main.MI2U = MI2U
logicHelper.MI2U = Logic Helper
Expand Down Expand Up @@ -103,6 +103,7 @@ settings.main.disableBullet = Disable Bullet Render
settings.main.disableBuilding = Disable Building Render
settings.main.blockHpBar = Building Hp
settings.main.unitHpBar = Unit Hp
settings.main.unitHpBarStyle = Unit Hpbar Style
settings.main.unitHpBarDamagedOnly = Unit Hpbar Damaged Only
settings.main.unitHitbox = Unit Hitbox
settings.main.unitLogic = Unit Logic
Expand All @@ -124,19 +125,20 @@ settings.main.container = Custom UI Container(Debug)
settings.main.speedctrl = Speed Controller Options
settings.main.speedctrl.basefps = Logical FPS(FPS that game will slow down to simulate when lagging)
settings.main.speedctrl.cutoff = Cut Off FPS(Lowest FPS that controller supports, too low makes UI stuck)
settings.main.maxSchematicSize = Max Schematic Size
settings.main.instantBuild = Instantly Build On Sandbox
settings.main.modifyBlockSelectTable = Modify Block Select Table
settings.main.blockSelectTableHeight = Block Select Table Height(Vanilla = 194)(Reload World)
settings.main.blockSelectTableHeight = Block Select Table Height(Def = 194)(Reload World)
settings.main.rtsFormDoubleTap = RTS Formation Double Tap Interval
settings.main.modifyBlockBars = Replace Vanilla Block Bars(Restart App)
settings.main.modifyTopTable = Replace Vanilla Top Bars Table(Restart App)
settings.main.topTableFollowMouse = Stats Table Follows Cursor(Reload World)
settings.main.inputReplace = Replace Vanilla InputHandler(AI Request)(Restart App)
settings.main.forceTapTile = Tapping Tile Skips Team Check
settings.main.edgePanning = Screen Edge Pans Camera
settings.main.enableUpdate = Update Check On Start
settings.main.updateCheck = Update Check
settings.main.enableUpdate = Update Check
settings.main.maxSchematicSize = Max Schematic Size
settings.main.maxZoom = Max Zoom In(Def = 6)
settings.main.minZoom = Min Zoom Out(Def = 1.5)
settings.coreInfo.showCoreItems = Show Core Items
settings.coreInfo.showUnits = Show Unit Counter
settings.coreInfo.showPowerGraphs = Show Power Graphs Bar
Expand Down Expand Up @@ -195,4 +197,10 @@ coreInfo.help = Detailed core info. Check core item(also its fluctuation), unit
\nHas a team select button, which changes the team this ui displays for.\
\nClicking item icons, hovering power bars to observe resource changes.\
\nClicking unit icons or power bars to pan between all units.
customContainer.help = For fun and play at ur own risk. [scarlet]A ui container, can capture other ui elements and move them into its inner. [green]Any ui changes will not be saved.
customContainer.help = For fun and play at ur own risk. [scarlet]A ui container, can capture other ui elements and move them into its inner. [green]Any ui changes will not be saved.

fullAI.help = Logic Custom AI can control player unit with processor code. After learning the basics of logic, you need to understand several changes that this AI makes to regular logic: \
\n\n[accent]@unit[] Permanently automatically bind player units, cannot be changed. So [accent]Ucontrol, Ulocate, etc.[], can be used directly.\
\n\nPlayer actions are divided into two parts: move, attack, and two timers are independent. 10s without control or using [accent]idle|stop[] will release the control to other AIs.\
\n\nLogic is based on world processor and can use world-sense instructions, but world-modifying and unsimulable instructions only work in single-player sandbox, such as [accent]SetProp, Write, SetBlock, etc.[] \
\n\nAlternative implementations by simulating player for some instructions, such as [accent]Control-config[].
20 changes: 14 additions & 6 deletions assets/bundles/bundle_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ai.config.follow = 协助建造
ai.config.autorebuild = 自动重建
ai.config.attack = 攻击敌人
ai.config.heal = 修理建筑
ai.config.oneTime = 一次性
ai.config.oneTime = 一次性抓取

main.MI2U = 
logicHelper.MI2U = 
Expand Down Expand Up @@ -103,6 +103,7 @@ settings.main.disableBullet = 关闭子弹渲染
settings.main.disableBuilding = 关闭建筑渲染
settings.main.blockHpBar = 建筑血条
settings.main.unitHpBar = 单位血条
settings.main.unitHpBarStyle = 单位血条样式
settings.main.unitHpBarDamagedOnly = 血条仅损伤单位
settings.main.unitHitbox = 单位碰撞箱
settings.main.unitLogic = 逻辑线
Expand All @@ -124,19 +125,20 @@ settings.main.container = UI容器(测试功能)
settings.main.speedctrl = 自动变速器选项
settings.main.speedctrl.basefps = 逻辑帧数(卡顿时,变速器调整时间流动来模拟这个帧数)
settings.main.speedctrl.cutoff = 截止帧数(变速器支持的最低帧数,过低将使UI卡顿)
settings.main.maxSchematicSize = 蓝图尺寸上限
settings.main.instantBuild = 沙盒模式瞬间建造
settings.main.modifyBlockSelectTable = 修改建筑选择面板
settings.main.blockSelectTableHeight = 建筑选择面板高度(原版=194)(重进存档生效)
settings.main.blockSelectTableHeight = 建筑选择面板高度(默认=194)(重进存档生效)
settings.main.rtsFormDoubleTap = RTS编队双击判定时长(毫秒)
settings.main.modifyBlockBars = 替换原版方块数值条(重启生效)
settings.main.modifyTopTable = 替换原版方块信息面板(重启生效)
settings.main.topTableFollowMouse = 方块信息面板跟随鼠标(重进存档生效)
settings.main.inputReplace = 替换原版输入处理(AI需要此功能)(重启生效)
settings.main.forceTapTile = 跨队点击建筑
settings.main.edgePanning = 屏边移动视角
settings.main.enableUpdate = 启动时检查更新
settings.main.updateCheck = 更新检查
settings.main.enableUpdate = 更新检查
settings.main.maxSchematicSize = 蓝图尺寸上限
settings.main.maxZoom = 视野最大放大(默认=6)
settings.main.minZoom = 视野最小缩小(默认=1.5)
settings.coreInfo.showCoreItems = 显示核心物品
settings.coreInfo.showUnits = 显示单位计数
settings.coreInfo.showPowerGraphs = 显示电网条
Expand Down Expand Up @@ -195,4 +197,10 @@ coreInfo.help = 一个更详细的核心信息板。可以检视核心物品数
\n有队伍选择按钮,可以更换核心信息板所显示的队伍。\
\n点击物品图标、悬停于电网条以观察资源变化。\
\n点击单位图标或电网条以移动镜头到各个单位。
customContainer.help = 仅供娱乐,责任自负。[scarlet]一个ui容器,可以捕捉其他ui元素转移到自己内部。 [green]容器对ui的任何改动都不会保存。
customContainer.help = 仅供娱乐,责任自负。[scarlet]一个ui容器,可以捕捉其他ui元素转移到自己内部。 [green]容器对ui的任何改动都不会保存。

fullAI.help = 逻辑自定义AI可以用逻辑代码控制玩家单位行动. 在学会基本的逻辑知识以后, 你需要了解本AI对常规逻辑做出的几个改动:\
\n\n[accent]@unit[]永久自动绑定玩家单位, 不能换绑, 解绑. 所以[accent]Ucontrol, Ulocate[]等可以直接使用。\
\n\n玩家动作分为两部分: 移动, 攻击, 2个计时器相互独立. 10s不进行控制或者使用[accent]idle, stop[], 就会释放控制权给其他AI.\
\n\n逻辑基于世界处理器, 可以使用世处的感知世界的指令, 但不能模拟的, 修改世界的指令只能在单人沙盒生效, 例如[accent]SetProp, Write, SetBlock[]等. \
\n\n部分逻辑功能通过模拟玩家实现, 例如[accent]Control-config[].
2 changes: 1 addition & 1 deletion mod.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ displayName: "MI2-Utilities Java"
name: "MI2-Utilities-Java"

#the mod version
version: 1.3.2c
version: 1.3.5

#the minimum game build required to run this mod
minGameVersion: 145
Expand Down
4 changes: 3 additions & 1 deletion src/mi2u/MI2Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public MI2Utilities(){
MI2USettings.init();
InputUtils.init();

maxSchematicSize = MI2USettings.getInt("maxSchematicSize", 32);
maxSchematicSize = MI2USettings.getInt("maxSchematicSize", 64);
renderer.maxZoom = Strings.parseFloat(MI2USettings.getStr("maxZoom", "6"));
renderer.minZoom = Strings.parseFloat(MI2USettings.getStr("minZoom", "1.5"));
Time.runTask(40f, () -> {
mi2ui.addTo(Core.scene.root);
mi2ui.visible(() -> state.isGame() && ui.hudfrag.shown);
Expand Down
3 changes: 2 additions & 1 deletion src/mi2u/ModifyFuncs.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import mindustry.world.blocks.power.*;
import mindustry.world.blocks.production.*;
import mindustry.world.consumers.*;
import mindustry.world.meta.*;

import static mi2u.MI2UVars.*;
import static mindustry.Vars.*;
Expand Down Expand Up @@ -81,7 +82,7 @@ public static void modifyVanillaBlockBars(){
//do nothing
}else if(block.hasPower && block.consumesPower && block.consPower != null){
addBarToBlock(block, "power", entity -> new Bar(() -> block.consPower.buffered ? Core.bundle.format("bar.poweramount", Float.isNaN(entity.power.status * block.consPower.capacity) ? "<ERROR>" : UI.formatAmount((int)(entity.power.status * block.consPower.capacity))) :
Core.bundle.get("bar.power") + ":" + Strings.autoFixed(-entity.power.status * block.consPower.usage * 60f * (entity.canConsume()?entity.timeScale():0),2), () -> Pal.powerBar, () -> Mathf.zero(block.consPower.requestedPower(entity)) && entity.power.graph.getPowerProduced() + entity.power.graph.getBatteryStored() > 0f ? 1f : entity.power.status));
Core.bundle.get("bar.power") + ":" + Strings.autoFixed((entity.status() == BlockStatus.active ? 1f : 0f) * entity.efficiency() * -entity.power.status * block.consPower.usage * 60f * (entity.canConsume()?entity.timeScale():0),2), () -> Pal.powerBar, () -> Mathf.zero(block.consPower.requestedPower(entity)) && entity.power.graph.getPowerProduced() + entity.power.graph.getBatteryStored() > 0f ? 1f : entity.power.status));
}

if(block instanceof Turret) addBarToBlock(block, "logicTimer", (Turret.TurretBuild entity) -> new Bar(() -> "Logic Control: " + Strings.autoFixed(entity.logicControlTime, 1), () -> Pal.logicControl, () -> entity.logicControlTime / Turret.logicControlCooldown));
Expand Down
Loading

0 comments on commit ba30711

Please sign in to comment.