MDT模組炮臺制作
源碼->json代碼
duo/ItemTurret/雙管炮/物品炮臺

duo = new ItemTurret("duo"){{
? ?requirements(Category.turret, with(Items.copper, 35), true);
? ?ammo(
? ? ? ?Items.copper, Bullets.standardCopper,
? ? ? ?Items.graphite, Bullets.standardDense,
? ? ? ?Items.pyratite, Bullets.standardIncendiary,
? ? ? ?Items.silicon, Bullets.standardHoming
? ?);
? ?spread = 4f;
? ?shots = 2;
? ?alternate = true;
? ?reloadTime = 20f;
? ?restitution = 0.03f;
? ?range = 100;
? ?shootCone = 15f;
? ?ammoUseEffect = Fx.casing1;
? ?health = 250;
? ?inaccuracy = 2f;
? ?rotateSpeed = 10f;
}};
JSON轉(zhuǎn)換
{
? ?"type": "ItemTurret",
? ?"name": "duo",
? ?"category": "turret",
? ?"requirements": [
? ? ? ?"copper/35"
? ?],
? ?"ammoTypes": {
? ? ? ?"copper": "standardCopper",
? ? ? ?"graphite": "standardDense",
? ? ? ?"pyratite": "standardIncendiary",
? ? ? ?"silicon": "standardHoming"
? ?},
? ?"spread": 4.00,
? ?"shots": 2,
? ?"alternate": true,
? ?"reloadTime": 20.0,
? ?"restitution": 0.03,
? ?"range": 100,
? ?"shootCone": 15.00,
? ?"health": 250,
? ?"inaccuracy": 2.00,
? ?"rotateSpeed": 10.00
}
屬性解釋
type: !必須!,用于區(qū)分每個方塊的類型
category: 在建筑界面的分類(見后)
requirements: !必須!,建造所消耗的資源,特定類型ItemStack[](見后)
ammoTypes: !必須!,子彈類型(見后)
spread: 多發(fā)子彈的分散程度(shots>1)
shots: 1彈藥=?子彈實體
alternate: 輪流發(fā)射(而非霰彈槍效果)(shots>1)
reloadTime: 裝填時間(幀)
restitution: 不知道
range: 檢測范圍(而非射程范圍),計算:?8r,其中r為檢測半徑
shootCone: 不知道
health: 生命值
inaccuracy: 偏差角度
rotateSpeed: 轉(zhuǎn)速

wave/LiquidTurret/浪涌/液體炮臺

wave = new LiquidTurret("wave"){{
? ?requirements(Category.turret, with(Items.metaglass, 45, Items.lead, 75));
? ?ammo(
? ? ? ?Liquids.water, Bullets.waterShot,
? ? ? ?Liquids.slag, Bullets.slagShot,
? ? ? ?Liquids.cryofluid, Bullets.cryoShot,
? ? ? ?Liquids.oil, Bullets.oilShot
? ?);
? ?size = 2;
? ?recoilAmount = 0f;
? ?reloadTime = 2f;
? ?inaccuracy = 5f;
? ?shootCone = 50f;
? ?liquidCapacity = 10f;
? ?shootEffect = Fx.shootLiquid;
? ?range = 110f;
? ?health = 250 * size * size;
? ?flags = EnumSet.of(BlockFlag.turret, BlockFlag.extinguisher);
}};
JSON轉(zhuǎn)換
{
? ?"type": "LiquidTurret",
? ?"name": "json-wave",
? ?"requirements": [
? ? ? ?"metaglass/45","lead/75"
? ?],
? ?"ammoTypes": {
? ? ? ?"water": "waterShot",
? ? ? ?"slag": "slagShot",
? ? ? ?"cryofluid": "cryoShot",
? ? ? ?"oil": "oilShot"
? ?},
? ?"size": 2,
? ?"recoliAmount": 0.00,
? ?"reloadTime": 2.00,
? ?"inaccuracy": 5.00,
? ?"shootCone": 50.00,
? ?"liquidCapacity": 10.00,
? ?"range": 110.00,
? ?"health": 1000
}
屬性解釋
size: 方塊大小
recoliAmount: 后坐力
liquidCapacity: 液體容量,類似于彈夾容量

arc/PowerTurret/電弧/電能炮塔

arc = new PowerTurret("arc"){{
? ?requirements(Category.turret, with(Items.copper, 50, Items.lead, 50));
? ?shootType = new LightningBulletType(){{
? ? ? ?damage = 20;
? ? ? ?lightningLength = 25;
? ? ? ?collidesAir = false;
? ?}};
? ?reloadTime = 35f;
? ?shootCone = 40f;
? ?rotateSpeed = 8f;
? ?powerUse = 3.3f;
? ?targetAir = false;
? ?range = 90f;
? ?shootEffect = Fx.lightningShoot;
? ?heatColor = Color.red;
? ?recoilAmount = 1f;
? ?size = 1;
? ?health = 260;
? ?shootSound = Sounds.spark;
}};
JSON轉(zhuǎn)換
{
? ?"type": "PowerTurret",
? ?"name": "json-arc",
? ?"category": "turret",
? ?"requirements": [
? ? ? ?"copper/50","lead/50"
? ?],
? ?"shootType": {
? ? ? ?"type": "damageLightning",
? ? ? ?"damage": 20,
? ? ? ?"lightningLength": 25,
? ? ? ?"collidesAir": false
? ?},
? ?"reloadTime": 35.00,
? ?"shootCone": 40.00,
? ?"rotateSpeed": 8.00,
? ?"powerUse": 3.30,
? ?"targetAir": false,
? ?"range": 90.00,
? ?"recoliAmount": 1.00,
? ?"size": 1,
? ?"health": 260
}
屬性解釋
shootType: 對于特殊彈藥輸入的方法,內(nèi)部字段type!必須!,其余非本期討論內(nèi)容,只需理解
powerUse: 能量的使用,電量計算方式:60w
targetAir: 瞄準空軍(true為瞄準,false相反)
接上: targetGround: 瞄準陸軍

parallax/TractorBeamTurret/差擾光束/?

parallax = new TractorBeamTurret("parallax"){{
? ?requirements(Category.turret, with(Items.silicon, 120, Items.titanium, 90, Items.graphite, 30));
? ?hasPower = true;
? ?size = 2;
? ?force = 8f;
? ?scaledForce = 7f;
? ?range = 230f;
? ?damage = 0.3f;
? ?health = 160 * size * size;
? ?rotateSpeed = 10;
? ?consumes.powerCond(3f, (TractorBeamBuild e) -> e.target != null);
}};
JSON轉(zhuǎn)換
{
? ?"type": "TractorBeamTurret",
? ?"name": "json-parallax",
? ?"category": "turret",
? ?"requirements": [
? ? ? ?"silicon/120","titanium/90","graphite/30"
? ?],
? ?
? ?"hasPower": true,
? ?"size": 2,
? ?"force": 8.00,
? ?"scaledForce": 7.00,
? ?"range": 230.00,
? ?"damage": 0.30,
? ?"health": 640,
? ?"rotateSpeed": 10,
? ?"consumes": {
? ? ? ?"power": 3.00
? ?}
}
屬性解釋
force: 牽引力
scaledForce: 等比縮放牽引力(?)
damage: 每幀傷害,即60 * damage
consumes: 消耗器,在工廠最為常用

segment/PointDefenseTurret/裂解光束/防御炮臺(?)

segment = new PointDefenseTurret("segment"){{
? ?requirements(Category.turret, with(Items.silicon, 130, Items.thorium, 80, Items.phaseFabric, 40));
? ?health = 250 * size * size;
? ?range = 180f;
? ?hasPower = true;
? ?consumes.powerCond(8f, (PointDefenseBuild b) -> b.target != null);
? ?size = 2;
? ?shootLength = 5f;
? ?bulletDamage = 30f;
? ?reloadTime = 9f;
}};
JSON轉(zhuǎn)換
{
? ?"type": "PointDefenseTurret",
? ?"name": "json-segment",
? ?"category": "turret",
? ?"requirements": [
? ? ? ?"silicon/130","thorium/80","phaseFabric/40"
? ?],
? ?"health": 1000,
? ?"range": 180.00,
? ?"hasPower": true,
? ?"consumes": {
? ? ? ?"power": 8.00
? ?},
? ?"size": 2,
? ?"shootLength": 5.00,
? ?"bulletDamage": 30.00,
? ?"reloadTime": 9.00
}
屬性解釋
shootLength: 射擊長度(?)
bulletDamage: 子彈傷害

meltdown/LaserTurret/融毀/激光炮塔

meltdown = new LaserTurret("meltdown"){{
? ?requirements(Category.turret, with(Items.copper, 1200, Items.lead, 350, Items.graphite, 300, Items.surgeAlloy, 325, Items.silicon, 325));
? ?shootEffect = Fx.shootBigSmoke2;
? ?shootCone = 40f;
? ?recoilAmount = 4f;
? ?size = 4;
? ?shootShake = 2f;
? ?range = 190f;
? ?reloadTime = 90f;
? ?firingMoveFract = 0.5f;
? ?shootDuration = 220f;
? ?powerUse = 17f;
? ?shootSound = Sounds.laserbig;
? ?loopSound = Sounds.beam;
? ?loopSoundVolume = 2f;
? ?shootType = new ContinuousLaserBulletType(70){{
? ? ? ?length = 200f;
? ? ? ?hitEffect = Fx.hitMeltdown;
? ? ? ?hitColor = Pal.meltdownHit;
? ? ? ?drawSize = 420f;
? ? ? ?incendChance = 0.4f;
? ? ? ?incendSpread = 5f;
? ? ? ?incendAmount = 1;
? ?}};
? ?health = 200 * size * size;
? ?consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.5f)).update(false);
}};
JSON轉(zhuǎn)換
{
? ?"type": "LaserTurret",
? ?"name": "json-meltdown",
? ?"category": "turret",
? ?"requirements": [
? ? ? ?"copper/1200","lead/350","graphite/300","surgeAlloy/325","silicon/325"
? ?],
? ?"shootCone": 40.00,
? ?"recoliAmount": 4.00,
? ?"size": 4,
? ?"shootShake": 2.00,
? ?"range": 190.00,
? ?"reloadTime": 90.00,
? ?"firingMoveFract": 0.50,
? ?"shootDuration": 220.00,
? ?"powerUse": 17.00,
? ?"shootType": {
? ? ? ?"type": "ContinuousLaserBulletType",
? ? ? ?"length": 200.00,
? ? ? ?"drawSize": 420.00,
? ? ? ?"incendChance": 0.40,
? ? ? ?"incendSpread": 5.00,
? ? ? ?"incendAmount": 1
? ?},
? ?"health": 3200
? ?// 最后一項好像用json實現(xiàn)不了,具體是改變冷卻液體的條件
}
屬性解釋
shootShake: 射擊屏幕抖動幅度
firingMoveFract: ?
shootDuration: 持續(xù)時間(幀)

屬性分類
全部方塊可用
requirements: ItemStack[]
type: BlockType
category: Category
health: int
size: int
consumes: Consumer
全部炮塔可用
spread: float
shots: int
alternate: boolean
reloadTime: boolean
restitution: float
range: float
shootCone: float
inaccuracy: float
rotateSpeed: float
shootShake: float
ItemTurret
ammoTypes: ObejectMap
LiquidTurret
ammoTypes: ObejectMap
PowerTurret
shootType: BulletType
powerUse: float
TractorBeamTurret
force: float
scaledForce: float
damage: float
PointDefenseTurret
shootLength: float
bulletDamage: float
LaserTurret
可使用全部 PowerTurret 屬性
firingMoveFract: float
shootDuration: float

其他
Category
turret
?炮臺production
?產(chǎn)生基礎(chǔ)資源的方塊distribution
?移動物品的方塊liquid
?移動液體的方塊power
?產(chǎn)生或者傳輸電能的方塊defense
?墻和其他防御結(jié)構(gòu)crafting
?制作物品的方塊units
?制作單位的方塊logic
?邏輯方塊effect
?存儲或者增益方塊
ItemStack[]
可以是字符串也可以是一個obj.
字符串
[
"物品名/數(shù)量","或者更多,用半角逗號分隔"
]
obj.
[
? ?{"item": "物品名", "amount": 數(shù)量}, {或者更多,用半角逗號隔開}
]
內(nèi)建子彈類型
artilleryDense artilleryPlastic artilleryPlasticFrag artilleryHoming artilleryIncendiary artilleryExplosive
flakScrap?flakLead?flakGlass?flakGlassFrag
fragGlass?fragExplosive?fragPlastic?fragSurge?fragGlassFrag?fragPlasticFrag
missileExplosive?missileIncendiary?missileSurge
standardCopper?standardDense?standardThorium?standardHoming?standardIncendiary standardDenseBig?standardThoriumBig?standardIncendiaryBig
waterShot?cryoShot?slagShot?oilShot?heavyWaterShot?heavyCryoShot?heavySlagShot? heavyOilShot
damageLightning?damageLightningGround
fireball?basicFlame?pyraFlame

資源
https://1565619256.lanzoui.com/iGM08sixknc