欢迎光临散文网 会员登陆 & 注册

MDT模组炮台制作

2021-08-12 10:44 作者:NullPointerErr  | 我要投稿

源码->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转换

{
    "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: !必须!用于区分每个方块的类型

  • category: 在建筑界面的分类(见后)

  • requirements: !必须!建造所消耗的资源特定类型ItemStack[](见后)

  • ammoTypes: !必须!,子弹类型(见后)

  • spread: 多发子弹的分散程度(shots>1)

  • shots: 1弹药=?子弹实体

  • alternate: 轮流发射(而非霰弹枪效果)(shots>1)

  • reloadTime: 装填时间(帧)

  • restitution: 不知道

  • range: 检测范围(而非射程范围),计算: 8r,其中r为检测半径

  • shootCone: 不知道

  • health: 生命值

  • inaccuracy: 偏差角度

  • rotateSpeed: 转速

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转换

{
    "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转换

{
    "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: 对于特殊弹药输入的方法,内部字段type!必须!,其余非本期讨论内容,只需理解

  • 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转换

{
    "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转换

{
    "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转换

{
    "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实现不了,具体是改变冷却液体的条件
}

属性解释

  • shootShake: 射击屏幕抖动幅度

  • firingMoveFract: ?

  • shootDuration: 持续时间(帧)

属性分类

全部方块可用

  • 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 产生基础资源的方块

  • distribution 移动物品的方块

  • liquid 移动液体的方块

  • power 产生或者传输电能的方块

  • defense 墙和其他防御结构

  • crafting 制作物品的方块

  • units 制作单位的方块

  • logic 逻辑方块

  • effect 存储或者增益方块

ItemStack[]

可以是字符串也可以是一个obj.

字符串

[
	"物品名/数量","或者更多,用半角逗号分隔"
]

obj.

[
    {"item": "物品名", "amount": 数量}, {或者更多,用半角逗号隔开}
]

内建子弹类型

  • 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

MDT模组炮台制作的评论 (共 条)

分享到微博请遵守国家法律