Public block fields / Better scripting
This commit is contained in:
@@ -299,6 +299,7 @@ project(":tools"){
|
|||||||
|
|
||||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||||
|
compile "org.reflections:reflections:0.9.11"
|
||||||
|
|
||||||
compile arcModule("backends:backend-sdl")
|
compile arcModule("backends:backend-sdl")
|
||||||
}
|
}
|
||||||
|
|||||||
360
core/assets/scripts/global.js
Executable file
360
core/assets/scripts/global.js
Executable file
@@ -0,0 +1,360 @@
|
|||||||
|
//Generated class. Do not modify.
|
||||||
|
const Core = Java.type('io.anuke.arc.Core')
|
||||||
|
const Draw = Java.type('io.anuke.arc.graphics.g2d.Draw')
|
||||||
|
const TextureAtlas = Java.type('io.anuke.arc.graphics.g2d.TextureAtlas')
|
||||||
|
const TextureRegion = Java.type('io.anuke.arc.graphics.g2d.TextureRegion')
|
||||||
|
const Vars = Java.type('io.anuke.mindustry.Vars')
|
||||||
|
const BlockIndexer = Java.type('io.anuke.mindustry.ai.BlockIndexer')
|
||||||
|
const Pathfinder = Java.type('io.anuke.mindustry.ai.Pathfinder')
|
||||||
|
const WaveSpawner = Java.type('io.anuke.mindustry.ai.WaveSpawner')
|
||||||
|
const Blocks = Java.type('io.anuke.mindustry.content.Blocks')
|
||||||
|
const Bullets = Java.type('io.anuke.mindustry.content.Bullets')
|
||||||
|
const Fx = Java.type('io.anuke.mindustry.content.Fx')
|
||||||
|
const Items = Java.type('io.anuke.mindustry.content.Items')
|
||||||
|
const Liquids = Java.type('io.anuke.mindustry.content.Liquids')
|
||||||
|
const Loadouts = Java.type('io.anuke.mindustry.content.Loadouts')
|
||||||
|
const Mechs = Java.type('io.anuke.mindustry.content.Mechs')
|
||||||
|
const StatusEffects = Java.type('io.anuke.mindustry.content.StatusEffects')
|
||||||
|
const TechTree = Java.type('io.anuke.mindustry.content.TechTree')
|
||||||
|
const TypeIDs = Java.type('io.anuke.mindustry.content.TypeIDs')
|
||||||
|
const UnitTypes = Java.type('io.anuke.mindustry.content.UnitTypes')
|
||||||
|
const Zones = Java.type('io.anuke.mindustry.content.Zones')
|
||||||
|
const ContentLoader = Java.type('io.anuke.mindustry.core.ContentLoader')
|
||||||
|
const Control = Java.type('io.anuke.mindustry.core.Control')
|
||||||
|
const FileTree = Java.type('io.anuke.mindustry.core.FileTree')
|
||||||
|
const GameState = Java.type('io.anuke.mindustry.core.GameState')
|
||||||
|
const Logic = Java.type('io.anuke.mindustry.core.Logic')
|
||||||
|
const Platform = Java.type('io.anuke.mindustry.core.Platform')
|
||||||
|
const Renderer = Java.type('io.anuke.mindustry.core.Renderer')
|
||||||
|
const UI = Java.type('io.anuke.mindustry.core.UI')
|
||||||
|
const Version = Java.type('io.anuke.mindustry.core.Version')
|
||||||
|
const World = Java.type('io.anuke.mindustry.core.World')
|
||||||
|
const Content = Java.type('io.anuke.mindustry.ctype.Content')
|
||||||
|
const ContentList = Java.type('io.anuke.mindustry.ctype.ContentList')
|
||||||
|
const MappableContent = Java.type('io.anuke.mindustry.ctype.MappableContent')
|
||||||
|
const UnlockableContent = Java.type('io.anuke.mindustry.ctype.UnlockableContent')
|
||||||
|
const DrawOperation = Java.type('io.anuke.mindustry.editor.DrawOperation')
|
||||||
|
const EditorTile = Java.type('io.anuke.mindustry.editor.EditorTile')
|
||||||
|
const EditorTool = Java.type('io.anuke.mindustry.editor.EditorTool')
|
||||||
|
const MapEditor = Java.type('io.anuke.mindustry.editor.MapEditor')
|
||||||
|
const MapRenderer = Java.type('io.anuke.mindustry.editor.MapRenderer')
|
||||||
|
const OperationStack = Java.type('io.anuke.mindustry.editor.OperationStack')
|
||||||
|
const Damage = Java.type('io.anuke.mindustry.entities.Damage')
|
||||||
|
const Effects = Java.type('io.anuke.mindustry.entities.Effects')
|
||||||
|
const Entities = Java.type('io.anuke.mindustry.entities.Entities')
|
||||||
|
const EntityCollisions = Java.type('io.anuke.mindustry.entities.EntityCollisions')
|
||||||
|
const EntityGroup = Java.type('io.anuke.mindustry.entities.EntityGroup')
|
||||||
|
const Predict = Java.type('io.anuke.mindustry.entities.Predict')
|
||||||
|
const TargetPriority = Java.type('io.anuke.mindustry.entities.TargetPriority')
|
||||||
|
const Units = Java.type('io.anuke.mindustry.entities.Units')
|
||||||
|
const ArtilleryBulletType = Java.type('io.anuke.mindustry.entities.bullet.ArtilleryBulletType')
|
||||||
|
const BasicBulletType = Java.type('io.anuke.mindustry.entities.bullet.BasicBulletType')
|
||||||
|
const BombBulletType = Java.type('io.anuke.mindustry.entities.bullet.BombBulletType')
|
||||||
|
const BulletType = Java.type('io.anuke.mindustry.entities.bullet.BulletType')
|
||||||
|
const FlakBulletType = Java.type('io.anuke.mindustry.entities.bullet.FlakBulletType')
|
||||||
|
const HealBulletType = Java.type('io.anuke.mindustry.entities.bullet.HealBulletType')
|
||||||
|
const LiquidBulletType = Java.type('io.anuke.mindustry.entities.bullet.LiquidBulletType')
|
||||||
|
const MassDriverBolt = Java.type('io.anuke.mindustry.entities.bullet.MassDriverBolt')
|
||||||
|
const MissileBulletType = Java.type('io.anuke.mindustry.entities.bullet.MissileBulletType')
|
||||||
|
const Decal = Java.type('io.anuke.mindustry.entities.effect.Decal')
|
||||||
|
const Fire = Java.type('io.anuke.mindustry.entities.effect.Fire')
|
||||||
|
const GroundEffectEntity = Java.type('io.anuke.mindustry.entities.effect.GroundEffectEntity')
|
||||||
|
const ItemTransfer = Java.type('io.anuke.mindustry.entities.effect.ItemTransfer')
|
||||||
|
const Lightning = Java.type('io.anuke.mindustry.entities.effect.Lightning')
|
||||||
|
const Puddle = Java.type('io.anuke.mindustry.entities.effect.Puddle')
|
||||||
|
const RubbleDecal = Java.type('io.anuke.mindustry.entities.effect.RubbleDecal')
|
||||||
|
const ScorchDecal = Java.type('io.anuke.mindustry.entities.effect.ScorchDecal')
|
||||||
|
const AbsorbTrait = Java.type('io.anuke.mindustry.entities.traits.AbsorbTrait')
|
||||||
|
const BelowLiquidTrait = Java.type('io.anuke.mindustry.entities.traits.BelowLiquidTrait')
|
||||||
|
const BuilderMinerTrait = Java.type('io.anuke.mindustry.entities.traits.BuilderMinerTrait')
|
||||||
|
const BuilderTrait = Java.type('io.anuke.mindustry.entities.traits.BuilderTrait')
|
||||||
|
const DamageTrait = Java.type('io.anuke.mindustry.entities.traits.DamageTrait')
|
||||||
|
const DrawTrait = Java.type('io.anuke.mindustry.entities.traits.DrawTrait')
|
||||||
|
const Entity = Java.type('io.anuke.mindustry.entities.traits.Entity')
|
||||||
|
const HealthTrait = Java.type('io.anuke.mindustry.entities.traits.HealthTrait')
|
||||||
|
const KillerTrait = Java.type('io.anuke.mindustry.entities.traits.KillerTrait')
|
||||||
|
const MinerTrait = Java.type('io.anuke.mindustry.entities.traits.MinerTrait')
|
||||||
|
const MoveTrait = Java.type('io.anuke.mindustry.entities.traits.MoveTrait')
|
||||||
|
const SaveTrait = Java.type('io.anuke.mindustry.entities.traits.SaveTrait')
|
||||||
|
const Saveable = Java.type('io.anuke.mindustry.entities.traits.Saveable')
|
||||||
|
const ScaleTrait = Java.type('io.anuke.mindustry.entities.traits.ScaleTrait')
|
||||||
|
const ShooterTrait = Java.type('io.anuke.mindustry.entities.traits.ShooterTrait')
|
||||||
|
const SolidTrait = Java.type('io.anuke.mindustry.entities.traits.SolidTrait')
|
||||||
|
const SpawnerTrait = Java.type('io.anuke.mindustry.entities.traits.SpawnerTrait')
|
||||||
|
const SyncTrait = Java.type('io.anuke.mindustry.entities.traits.SyncTrait')
|
||||||
|
const TargetTrait = Java.type('io.anuke.mindustry.entities.traits.TargetTrait')
|
||||||
|
const TeamTrait = Java.type('io.anuke.mindustry.entities.traits.TeamTrait')
|
||||||
|
const TimeTrait = Java.type('io.anuke.mindustry.entities.traits.TimeTrait')
|
||||||
|
const TypeTrait = Java.type('io.anuke.mindustry.entities.traits.TypeTrait')
|
||||||
|
const VelocityTrait = Java.type('io.anuke.mindustry.entities.traits.VelocityTrait')
|
||||||
|
const BaseEntity = Java.type('io.anuke.mindustry.entities.type.BaseEntity')
|
||||||
|
const BaseUnit = Java.type('io.anuke.mindustry.entities.type.BaseUnit')
|
||||||
|
const Bullet = Java.type('io.anuke.mindustry.entities.type.Bullet')
|
||||||
|
const DestructibleEntity = Java.type('io.anuke.mindustry.entities.type.DestructibleEntity')
|
||||||
|
const EffectEntity = Java.type('io.anuke.mindustry.entities.type.EffectEntity')
|
||||||
|
const Player = Java.type('io.anuke.mindustry.entities.type.Player')
|
||||||
|
const SolidEntity = Java.type('io.anuke.mindustry.entities.type.SolidEntity')
|
||||||
|
const TileEntity = Java.type('io.anuke.mindustry.entities.type.TileEntity')
|
||||||
|
const TimedEntity = Java.type('io.anuke.mindustry.entities.type.TimedEntity')
|
||||||
|
const Unit = Java.type('io.anuke.mindustry.entities.type.Unit')
|
||||||
|
const BaseDrone = Java.type('io.anuke.mindustry.entities.type.base.BaseDrone')
|
||||||
|
const BuilderDrone = Java.type('io.anuke.mindustry.entities.type.base.BuilderDrone')
|
||||||
|
const Crawler = Java.type('io.anuke.mindustry.entities.type.base.Crawler')
|
||||||
|
const Dagger = Java.type('io.anuke.mindustry.entities.type.base.Dagger')
|
||||||
|
const Draug = Java.type('io.anuke.mindustry.entities.type.base.Draug')
|
||||||
|
const Eruptor = Java.type('io.anuke.mindustry.entities.type.base.Eruptor')
|
||||||
|
const FlyingUnit = Java.type('io.anuke.mindustry.entities.type.base.FlyingUnit')
|
||||||
|
const Fortress = Java.type('io.anuke.mindustry.entities.type.base.Fortress')
|
||||||
|
const Ghoul = Java.type('io.anuke.mindustry.entities.type.base.Ghoul')
|
||||||
|
const GroundUnit = Java.type('io.anuke.mindustry.entities.type.base.GroundUnit')
|
||||||
|
const MinerDrone = Java.type('io.anuke.mindustry.entities.type.base.MinerDrone')
|
||||||
|
const Phantom = Java.type('io.anuke.mindustry.entities.type.base.Phantom')
|
||||||
|
const RepairDrone = Java.type('io.anuke.mindustry.entities.type.base.RepairDrone')
|
||||||
|
const Revenant = Java.type('io.anuke.mindustry.entities.type.base.Revenant')
|
||||||
|
const Spirit = Java.type('io.anuke.mindustry.entities.type.base.Spirit')
|
||||||
|
const Titan = Java.type('io.anuke.mindustry.entities.type.base.Titan')
|
||||||
|
const Wraith = Java.type('io.anuke.mindustry.entities.type.base.Wraith')
|
||||||
|
const StateMachine = Java.type('io.anuke.mindustry.entities.units.StateMachine')
|
||||||
|
const Statuses = Java.type('io.anuke.mindustry.entities.units.Statuses')
|
||||||
|
const UnitCommand = Java.type('io.anuke.mindustry.entities.units.UnitCommand')
|
||||||
|
const UnitDrops = Java.type('io.anuke.mindustry.entities.units.UnitDrops')
|
||||||
|
const UnitState = Java.type('io.anuke.mindustry.entities.units.UnitState')
|
||||||
|
const DefaultWaves = Java.type('io.anuke.mindustry.game.DefaultWaves')
|
||||||
|
const Difficulty = Java.type('io.anuke.mindustry.game.Difficulty')
|
||||||
|
const EventType = Java.type('io.anuke.mindustry.game.EventType')
|
||||||
|
const Gamemode = Java.type('io.anuke.mindustry.game.Gamemode')
|
||||||
|
const GlobalData = Java.type('io.anuke.mindustry.game.GlobalData')
|
||||||
|
const LoopControl = Java.type('io.anuke.mindustry.game.LoopControl')
|
||||||
|
const MusicControl = Java.type('io.anuke.mindustry.game.MusicControl')
|
||||||
|
const Objective = Java.type('io.anuke.mindustry.game.Objective')
|
||||||
|
const Objectives = Java.type('io.anuke.mindustry.game.Objectives')
|
||||||
|
const Rules = Java.type('io.anuke.mindustry.game.Rules')
|
||||||
|
const Saves = Java.type('io.anuke.mindustry.game.Saves')
|
||||||
|
const Schematic = Java.type('io.anuke.mindustry.game.Schematic')
|
||||||
|
const Schematics = Java.type('io.anuke.mindustry.game.Schematics')
|
||||||
|
const SoundLoop = Java.type('io.anuke.mindustry.game.SoundLoop')
|
||||||
|
const SpawnGroup = Java.type('io.anuke.mindustry.game.SpawnGroup')
|
||||||
|
const Stats = Java.type('io.anuke.mindustry.game.Stats')
|
||||||
|
const Team = Java.type('io.anuke.mindustry.game.Team')
|
||||||
|
const Teams = Java.type('io.anuke.mindustry.game.Teams')
|
||||||
|
const Tutorial = Java.type('io.anuke.mindustry.game.Tutorial')
|
||||||
|
const BlockRenderer = Java.type('io.anuke.mindustry.graphics.BlockRenderer')
|
||||||
|
const Bloom = Java.type('io.anuke.mindustry.graphics.Bloom')
|
||||||
|
const CacheLayer = Java.type('io.anuke.mindustry.graphics.CacheLayer')
|
||||||
|
const Drawf = Java.type('io.anuke.mindustry.graphics.Drawf')
|
||||||
|
const FloorRenderer = Java.type('io.anuke.mindustry.graphics.FloorRenderer')
|
||||||
|
const IndexedRenderer = Java.type('io.anuke.mindustry.graphics.IndexedRenderer')
|
||||||
|
const Layer = Java.type('io.anuke.mindustry.graphics.Layer')
|
||||||
|
const LightRenderer = Java.type('io.anuke.mindustry.graphics.LightRenderer')
|
||||||
|
const MenuRenderer = Java.type('io.anuke.mindustry.graphics.MenuRenderer')
|
||||||
|
const MinimapRenderer = Java.type('io.anuke.mindustry.graphics.MinimapRenderer')
|
||||||
|
const MultiPacker = Java.type('io.anuke.mindustry.graphics.MultiPacker')
|
||||||
|
const OverlayRenderer = Java.type('io.anuke.mindustry.graphics.OverlayRenderer')
|
||||||
|
const Pal = Java.type('io.anuke.mindustry.graphics.Pal')
|
||||||
|
const Pixelator = Java.type('io.anuke.mindustry.graphics.Pixelator')
|
||||||
|
const Shaders = Java.type('io.anuke.mindustry.graphics.Shaders')
|
||||||
|
const Binding = Java.type('io.anuke.mindustry.input.Binding')
|
||||||
|
const DesktopInput = Java.type('io.anuke.mindustry.input.DesktopInput')
|
||||||
|
const InputHandler = Java.type('io.anuke.mindustry.input.InputHandler')
|
||||||
|
const MobileInput = Java.type('io.anuke.mindustry.input.MobileInput')
|
||||||
|
const PlaceMode = Java.type('io.anuke.mindustry.input.PlaceMode')
|
||||||
|
const Placement = Java.type('io.anuke.mindustry.input.Placement')
|
||||||
|
const Map = Java.type('io.anuke.mindustry.maps.Map')
|
||||||
|
const Maps = Java.type('io.anuke.mindustry.maps.Maps')
|
||||||
|
const BlendFilter = Java.type('io.anuke.mindustry.maps.filters.BlendFilter')
|
||||||
|
const ClearFilter = Java.type('io.anuke.mindustry.maps.filters.ClearFilter')
|
||||||
|
const DistortFilter = Java.type('io.anuke.mindustry.maps.filters.DistortFilter')
|
||||||
|
const FilterOption = Java.type('io.anuke.mindustry.maps.filters.FilterOption')
|
||||||
|
const GenerateFilter = Java.type('io.anuke.mindustry.maps.filters.GenerateFilter')
|
||||||
|
const MedianFilter = Java.type('io.anuke.mindustry.maps.filters.MedianFilter')
|
||||||
|
const MirrorFilter = Java.type('io.anuke.mindustry.maps.filters.MirrorFilter')
|
||||||
|
const NoiseFilter = Java.type('io.anuke.mindustry.maps.filters.NoiseFilter')
|
||||||
|
const OreFilter = Java.type('io.anuke.mindustry.maps.filters.OreFilter')
|
||||||
|
const OreMedianFilter = Java.type('io.anuke.mindustry.maps.filters.OreMedianFilter')
|
||||||
|
const RiverNoiseFilter = Java.type('io.anuke.mindustry.maps.filters.RiverNoiseFilter')
|
||||||
|
const ScatterFilter = Java.type('io.anuke.mindustry.maps.filters.ScatterFilter')
|
||||||
|
const TerrainFilter = Java.type('io.anuke.mindustry.maps.filters.TerrainFilter')
|
||||||
|
const BasicGenerator = Java.type('io.anuke.mindustry.maps.generators.BasicGenerator')
|
||||||
|
const Generator = Java.type('io.anuke.mindustry.maps.generators.Generator')
|
||||||
|
const MapGenerator = Java.type('io.anuke.mindustry.maps.generators.MapGenerator')
|
||||||
|
const RandomGenerator = Java.type('io.anuke.mindustry.maps.generators.RandomGenerator')
|
||||||
|
const DesertWastesGenerator = Java.type('io.anuke.mindustry.maps.zonegen.DesertWastesGenerator')
|
||||||
|
const OvergrowthGenerator = Java.type('io.anuke.mindustry.maps.zonegen.OvergrowthGenerator')
|
||||||
|
const Category = Java.type('io.anuke.mindustry.type.Category')
|
||||||
|
const ContentType = Java.type('io.anuke.mindustry.type.ContentType')
|
||||||
|
const Item = Java.type('io.anuke.mindustry.type.Item')
|
||||||
|
const ItemStack = Java.type('io.anuke.mindustry.type.ItemStack')
|
||||||
|
const ItemType = Java.type('io.anuke.mindustry.type.ItemType')
|
||||||
|
const Liquid = Java.type('io.anuke.mindustry.type.Liquid')
|
||||||
|
const LiquidStack = Java.type('io.anuke.mindustry.type.LiquidStack')
|
||||||
|
const Mech = Java.type('io.anuke.mindustry.type.Mech')
|
||||||
|
const Publishable = Java.type('io.anuke.mindustry.type.Publishable')
|
||||||
|
const StatusEffect = Java.type('io.anuke.mindustry.type.StatusEffect')
|
||||||
|
const TypeID = Java.type('io.anuke.mindustry.type.TypeID')
|
||||||
|
const UnitType = Java.type('io.anuke.mindustry.type.UnitType')
|
||||||
|
const Weapon = Java.type('io.anuke.mindustry.type.Weapon')
|
||||||
|
const WeatherEvent = Java.type('io.anuke.mindustry.type.WeatherEvent')
|
||||||
|
const Zone = Java.type('io.anuke.mindustry.type.Zone')
|
||||||
|
const Cicon = Java.type('io.anuke.mindustry.ui.Cicon')
|
||||||
|
const ContentDisplay = Java.type('io.anuke.mindustry.ui.ContentDisplay')
|
||||||
|
const Fonts = Java.type('io.anuke.mindustry.ui.Fonts')
|
||||||
|
const IconSize = Java.type('io.anuke.mindustry.ui.IconSize')
|
||||||
|
const IntFormat = Java.type('io.anuke.mindustry.ui.IntFormat')
|
||||||
|
const Links = Java.type('io.anuke.mindustry.ui.Links')
|
||||||
|
const Styles = Java.type('io.anuke.mindustry.ui.Styles')
|
||||||
|
const BlockConfigFragment = Java.type('io.anuke.mindustry.ui.fragments.BlockConfigFragment')
|
||||||
|
const BlockInventoryFragment = Java.type('io.anuke.mindustry.ui.fragments.BlockInventoryFragment')
|
||||||
|
const FadeInFragment = Java.type('io.anuke.mindustry.ui.fragments.FadeInFragment')
|
||||||
|
const Fragment = Java.type('io.anuke.mindustry.ui.fragments.Fragment')
|
||||||
|
const HudFragment = Java.type('io.anuke.mindustry.ui.fragments.HudFragment')
|
||||||
|
const LoadingFragment = Java.type('io.anuke.mindustry.ui.fragments.LoadingFragment')
|
||||||
|
const MenuFragment = Java.type('io.anuke.mindustry.ui.fragments.MenuFragment')
|
||||||
|
const OverlayFragment = Java.type('io.anuke.mindustry.ui.fragments.OverlayFragment')
|
||||||
|
const PlacementFragment = Java.type('io.anuke.mindustry.ui.fragments.PlacementFragment')
|
||||||
|
const PlayerListFragment = Java.type('io.anuke.mindustry.ui.fragments.PlayerListFragment')
|
||||||
|
const BranchTreeLayout = Java.type('io.anuke.mindustry.ui.layout.BranchTreeLayout')
|
||||||
|
const RadialTreeLayout = Java.type('io.anuke.mindustry.ui.layout.RadialTreeLayout')
|
||||||
|
const TreeLayout = Java.type('io.anuke.mindustry.ui.layout.TreeLayout')
|
||||||
|
const Block = Java.type('io.anuke.mindustry.world.Block')
|
||||||
|
const BlockStorage = Java.type('io.anuke.mindustry.world.BlockStorage')
|
||||||
|
const Build = Java.type('io.anuke.mindustry.world.Build')
|
||||||
|
const CachedTile = Java.type('io.anuke.mindustry.world.CachedTile')
|
||||||
|
const DirectionalItemBuffer = Java.type('io.anuke.mindustry.world.DirectionalItemBuffer')
|
||||||
|
const Edges = Java.type('io.anuke.mindustry.world.Edges')
|
||||||
|
const ItemBuffer = Java.type('io.anuke.mindustry.world.ItemBuffer')
|
||||||
|
const LegacyColorMapper = Java.type('io.anuke.mindustry.world.LegacyColorMapper')
|
||||||
|
const Pos = Java.type('io.anuke.mindustry.world.Pos')
|
||||||
|
const StaticTree = Java.type('io.anuke.mindustry.world.StaticTree')
|
||||||
|
const Tile = Java.type('io.anuke.mindustry.world.Tile')
|
||||||
|
const WorldContext = Java.type('io.anuke.mindustry.world.WorldContext')
|
||||||
|
const Attributes = Java.type('io.anuke.mindustry.world.blocks.Attributes')
|
||||||
|
const Autotiler = Java.type('io.anuke.mindustry.world.blocks.Autotiler')
|
||||||
|
const BlockPart = Java.type('io.anuke.mindustry.world.blocks.BlockPart')
|
||||||
|
const BuildBlock = Java.type('io.anuke.mindustry.world.blocks.BuildBlock')
|
||||||
|
const DoubleOverlayFloor = Java.type('io.anuke.mindustry.world.blocks.DoubleOverlayFloor')
|
||||||
|
const Floor = Java.type('io.anuke.mindustry.world.blocks.Floor')
|
||||||
|
const ItemSelection = Java.type('io.anuke.mindustry.world.blocks.ItemSelection')
|
||||||
|
const LiquidBlock = Java.type('io.anuke.mindustry.world.blocks.LiquidBlock')
|
||||||
|
const OreBlock = Java.type('io.anuke.mindustry.world.blocks.OreBlock')
|
||||||
|
const OverlayFloor = Java.type('io.anuke.mindustry.world.blocks.OverlayFloor')
|
||||||
|
const PowerBlock = Java.type('io.anuke.mindustry.world.blocks.PowerBlock')
|
||||||
|
const RespawnBlock = Java.type('io.anuke.mindustry.world.blocks.RespawnBlock')
|
||||||
|
const Rock = Java.type('io.anuke.mindustry.world.blocks.Rock')
|
||||||
|
const StaticWall = Java.type('io.anuke.mindustry.world.blocks.StaticWall')
|
||||||
|
const TreeBlock = Java.type('io.anuke.mindustry.world.blocks.TreeBlock')
|
||||||
|
const DeflectorWall = Java.type('io.anuke.mindustry.world.blocks.defense.DeflectorWall')
|
||||||
|
const Door = Java.type('io.anuke.mindustry.world.blocks.defense.Door')
|
||||||
|
const ForceProjector = Java.type('io.anuke.mindustry.world.blocks.defense.ForceProjector')
|
||||||
|
const MendProjector = Java.type('io.anuke.mindustry.world.blocks.defense.MendProjector')
|
||||||
|
const OverdriveProjector = Java.type('io.anuke.mindustry.world.blocks.defense.OverdriveProjector')
|
||||||
|
const ShockMine = Java.type('io.anuke.mindustry.world.blocks.defense.ShockMine')
|
||||||
|
const SurgeWall = Java.type('io.anuke.mindustry.world.blocks.defense.SurgeWall')
|
||||||
|
const Wall = Java.type('io.anuke.mindustry.world.blocks.defense.Wall')
|
||||||
|
const ArtilleryTurret = Java.type('io.anuke.mindustry.world.blocks.defense.turrets.ArtilleryTurret')
|
||||||
|
const BurstTurret = Java.type('io.anuke.mindustry.world.blocks.defense.turrets.BurstTurret')
|
||||||
|
const ChargeTurret = Java.type('io.anuke.mindustry.world.blocks.defense.turrets.ChargeTurret')
|
||||||
|
const CooledTurret = Java.type('io.anuke.mindustry.world.blocks.defense.turrets.CooledTurret')
|
||||||
|
const DoubleTurret = Java.type('io.anuke.mindustry.world.blocks.defense.turrets.DoubleTurret')
|
||||||
|
const ItemTurret = Java.type('io.anuke.mindustry.world.blocks.defense.turrets.ItemTurret')
|
||||||
|
const LaserTurret = Java.type('io.anuke.mindustry.world.blocks.defense.turrets.LaserTurret')
|
||||||
|
const LiquidTurret = Java.type('io.anuke.mindustry.world.blocks.defense.turrets.LiquidTurret')
|
||||||
|
const PowerTurret = Java.type('io.anuke.mindustry.world.blocks.defense.turrets.PowerTurret')
|
||||||
|
const Turret = Java.type('io.anuke.mindustry.world.blocks.defense.turrets.Turret')
|
||||||
|
const ArmoredConveyor = Java.type('io.anuke.mindustry.world.blocks.distribution.ArmoredConveyor')
|
||||||
|
const BufferedItemBridge = Java.type('io.anuke.mindustry.world.blocks.distribution.BufferedItemBridge')
|
||||||
|
const Conveyor = Java.type('io.anuke.mindustry.world.blocks.distribution.Conveyor')
|
||||||
|
const ExtendingItemBridge = Java.type('io.anuke.mindustry.world.blocks.distribution.ExtendingItemBridge')
|
||||||
|
const ItemBridge = Java.type('io.anuke.mindustry.world.blocks.distribution.ItemBridge')
|
||||||
|
const Junction = Java.type('io.anuke.mindustry.world.blocks.distribution.Junction')
|
||||||
|
const MassDriver = Java.type('io.anuke.mindustry.world.blocks.distribution.MassDriver')
|
||||||
|
const OverflowGate = Java.type('io.anuke.mindustry.world.blocks.distribution.OverflowGate')
|
||||||
|
const Router = Java.type('io.anuke.mindustry.world.blocks.distribution.Router')
|
||||||
|
const Sorter = Java.type('io.anuke.mindustry.world.blocks.distribution.Sorter')
|
||||||
|
const ArmoredConduit = Java.type('io.anuke.mindustry.world.blocks.liquid.ArmoredConduit')
|
||||||
|
const Conduit = Java.type('io.anuke.mindustry.world.blocks.liquid.Conduit')
|
||||||
|
const LiquidBridge = Java.type('io.anuke.mindustry.world.blocks.liquid.LiquidBridge')
|
||||||
|
const LiquidExtendingBridge = Java.type('io.anuke.mindustry.world.blocks.liquid.LiquidExtendingBridge')
|
||||||
|
const LiquidJunction = Java.type('io.anuke.mindustry.world.blocks.liquid.LiquidJunction')
|
||||||
|
const LiquidOverflowGate = Java.type('io.anuke.mindustry.world.blocks.liquid.LiquidOverflowGate')
|
||||||
|
const LiquidRouter = Java.type('io.anuke.mindustry.world.blocks.liquid.LiquidRouter')
|
||||||
|
const LiquidTank = Java.type('io.anuke.mindustry.world.blocks.liquid.LiquidTank')
|
||||||
|
const LogicBlock = Java.type('io.anuke.mindustry.world.blocks.logic.LogicBlock')
|
||||||
|
const MessageBlock = Java.type('io.anuke.mindustry.world.blocks.logic.MessageBlock')
|
||||||
|
const Battery = Java.type('io.anuke.mindustry.world.blocks.power.Battery')
|
||||||
|
const BurnerGenerator = Java.type('io.anuke.mindustry.world.blocks.power.BurnerGenerator')
|
||||||
|
const ConditionalConsumePower = Java.type('io.anuke.mindustry.world.blocks.power.ConditionalConsumePower')
|
||||||
|
const DecayGenerator = Java.type('io.anuke.mindustry.world.blocks.power.DecayGenerator')
|
||||||
|
const ImpactReactor = Java.type('io.anuke.mindustry.world.blocks.power.ImpactReactor')
|
||||||
|
const ItemLiquidGenerator = Java.type('io.anuke.mindustry.world.blocks.power.ItemLiquidGenerator')
|
||||||
|
const LightBlock = Java.type('io.anuke.mindustry.world.blocks.power.LightBlock')
|
||||||
|
const NuclearReactor = Java.type('io.anuke.mindustry.world.blocks.power.NuclearReactor')
|
||||||
|
const PowerDiode = Java.type('io.anuke.mindustry.world.blocks.power.PowerDiode')
|
||||||
|
const PowerDistributor = Java.type('io.anuke.mindustry.world.blocks.power.PowerDistributor')
|
||||||
|
const PowerGenerator = Java.type('io.anuke.mindustry.world.blocks.power.PowerGenerator')
|
||||||
|
const PowerGraph = Java.type('io.anuke.mindustry.world.blocks.power.PowerGraph')
|
||||||
|
const PowerNode = Java.type('io.anuke.mindustry.world.blocks.power.PowerNode')
|
||||||
|
const SingleTypeGenerator = Java.type('io.anuke.mindustry.world.blocks.power.SingleTypeGenerator')
|
||||||
|
const SolarGenerator = Java.type('io.anuke.mindustry.world.blocks.power.SolarGenerator')
|
||||||
|
const ThermalGenerator = Java.type('io.anuke.mindustry.world.blocks.power.ThermalGenerator')
|
||||||
|
const Cultivator = Java.type('io.anuke.mindustry.world.blocks.production.Cultivator')
|
||||||
|
const Drill = Java.type('io.anuke.mindustry.world.blocks.production.Drill')
|
||||||
|
const Fracker = Java.type('io.anuke.mindustry.world.blocks.production.Fracker')
|
||||||
|
const GenericCrafter = Java.type('io.anuke.mindustry.world.blocks.production.GenericCrafter')
|
||||||
|
const GenericSmelter = Java.type('io.anuke.mindustry.world.blocks.production.GenericSmelter')
|
||||||
|
const Incinerator = Java.type('io.anuke.mindustry.world.blocks.production.Incinerator')
|
||||||
|
const LiquidConverter = Java.type('io.anuke.mindustry.world.blocks.production.LiquidConverter')
|
||||||
|
const Pump = Java.type('io.anuke.mindustry.world.blocks.production.Pump')
|
||||||
|
const Separator = Java.type('io.anuke.mindustry.world.blocks.production.Separator')
|
||||||
|
const SolidPump = Java.type('io.anuke.mindustry.world.blocks.production.SolidPump')
|
||||||
|
const ItemSource = Java.type('io.anuke.mindustry.world.blocks.sandbox.ItemSource')
|
||||||
|
const ItemVoid = Java.type('io.anuke.mindustry.world.blocks.sandbox.ItemVoid')
|
||||||
|
const LiquidSource = Java.type('io.anuke.mindustry.world.blocks.sandbox.LiquidSource')
|
||||||
|
const PowerSource = Java.type('io.anuke.mindustry.world.blocks.sandbox.PowerSource')
|
||||||
|
const PowerVoid = Java.type('io.anuke.mindustry.world.blocks.sandbox.PowerVoid')
|
||||||
|
const CoreBlock = Java.type('io.anuke.mindustry.world.blocks.storage.CoreBlock')
|
||||||
|
const LaunchPad = Java.type('io.anuke.mindustry.world.blocks.storage.LaunchPad')
|
||||||
|
const StorageBlock = Java.type('io.anuke.mindustry.world.blocks.storage.StorageBlock')
|
||||||
|
const Unloader = Java.type('io.anuke.mindustry.world.blocks.storage.Unloader')
|
||||||
|
const Vault = Java.type('io.anuke.mindustry.world.blocks.storage.Vault')
|
||||||
|
const CommandCenter = Java.type('io.anuke.mindustry.world.blocks.units.CommandCenter')
|
||||||
|
const MechPad = Java.type('io.anuke.mindustry.world.blocks.units.MechPad')
|
||||||
|
const RallyPoint = Java.type('io.anuke.mindustry.world.blocks.units.RallyPoint')
|
||||||
|
const RepairPoint = Java.type('io.anuke.mindustry.world.blocks.units.RepairPoint')
|
||||||
|
const UnitFactory = Java.type('io.anuke.mindustry.world.blocks.units.UnitFactory')
|
||||||
|
const Consume = Java.type('io.anuke.mindustry.world.consumers.Consume')
|
||||||
|
const ConsumeItemFilter = Java.type('io.anuke.mindustry.world.consumers.ConsumeItemFilter')
|
||||||
|
const ConsumeItems = Java.type('io.anuke.mindustry.world.consumers.ConsumeItems')
|
||||||
|
const ConsumeLiquid = Java.type('io.anuke.mindustry.world.consumers.ConsumeLiquid')
|
||||||
|
const ConsumeLiquidBase = Java.type('io.anuke.mindustry.world.consumers.ConsumeLiquidBase')
|
||||||
|
const ConsumeLiquidFilter = Java.type('io.anuke.mindustry.world.consumers.ConsumeLiquidFilter')
|
||||||
|
const ConsumePower = Java.type('io.anuke.mindustry.world.consumers.ConsumePower')
|
||||||
|
const ConsumeType = Java.type('io.anuke.mindustry.world.consumers.ConsumeType')
|
||||||
|
const Consumers = Java.type('io.anuke.mindustry.world.consumers.Consumers')
|
||||||
|
const Attribute = Java.type('io.anuke.mindustry.world.meta.Attribute')
|
||||||
|
const BlockBars = Java.type('io.anuke.mindustry.world.meta.BlockBars')
|
||||||
|
const BlockFlag = Java.type('io.anuke.mindustry.world.meta.BlockFlag')
|
||||||
|
const BlockGroup = Java.type('io.anuke.mindustry.world.meta.BlockGroup')
|
||||||
|
const BlockStat = Java.type('io.anuke.mindustry.world.meta.BlockStat')
|
||||||
|
const BlockStats = Java.type('io.anuke.mindustry.world.meta.BlockStats')
|
||||||
|
const BuildVisibility = Java.type('io.anuke.mindustry.world.meta.BuildVisibility')
|
||||||
|
const PowerType = Java.type('io.anuke.mindustry.world.meta.PowerType')
|
||||||
|
const Producers = Java.type('io.anuke.mindustry.world.meta.Producers')
|
||||||
|
const StatCategory = Java.type('io.anuke.mindustry.world.meta.StatCategory')
|
||||||
|
const StatUnit = Java.type('io.anuke.mindustry.world.meta.StatUnit')
|
||||||
|
const StatValue = Java.type('io.anuke.mindustry.world.meta.StatValue')
|
||||||
|
const AmmoListValue = Java.type('io.anuke.mindustry.world.meta.values.AmmoListValue')
|
||||||
|
const BooleanValue = Java.type('io.anuke.mindustry.world.meta.values.BooleanValue')
|
||||||
|
const BoosterListValue = Java.type('io.anuke.mindustry.world.meta.values.BoosterListValue')
|
||||||
|
const ItemFilterValue = Java.type('io.anuke.mindustry.world.meta.values.ItemFilterValue')
|
||||||
|
const ItemListValue = Java.type('io.anuke.mindustry.world.meta.values.ItemListValue')
|
||||||
|
const LiquidFilterValue = Java.type('io.anuke.mindustry.world.meta.values.LiquidFilterValue')
|
||||||
|
const LiquidValue = Java.type('io.anuke.mindustry.world.meta.values.LiquidValue')
|
||||||
|
const NumberValue = Java.type('io.anuke.mindustry.world.meta.values.NumberValue')
|
||||||
|
const StringValue = Java.type('io.anuke.mindustry.world.meta.values.StringValue')
|
||||||
|
const BlockModule = Java.type('io.anuke.mindustry.world.modules.BlockModule')
|
||||||
|
const ConsumeModule = Java.type('io.anuke.mindustry.world.modules.ConsumeModule')
|
||||||
|
const ItemModule = Java.type('io.anuke.mindustry.world.modules.ItemModule')
|
||||||
|
const LiquidModule = Java.type('io.anuke.mindustry.world.modules.LiquidModule')
|
||||||
|
const PowerModule = Java.type('io.anuke.mindustry.world.modules.PowerModule')
|
||||||
|
const Produce = Java.type('io.anuke.mindustry.world.producers.Produce')
|
||||||
|
const ProduceItem = Java.type('io.anuke.mindustry.world.producers.ProduceItem')
|
||||||
9
core/assets/scripts/wrapper.js
Executable file
9
core/assets/scripts/wrapper.js
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
this["$SCRIPT_NAME$"] = function(){
|
||||||
|
$CODE$
|
||||||
|
};
|
||||||
|
|
||||||
|
try{
|
||||||
|
this["$SCRIPT_NAME$"]();
|
||||||
|
}catch(e){
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
package io.anuke.mindustry.input;
|
package io.anuke.mindustry.input;
|
||||||
|
|
||||||
enum PlaceMode{
|
public enum PlaceMode{
|
||||||
none, breaking, placing, schematicSelect
|
none, breaking, placing, schematicSelect
|
||||||
}
|
}
|
||||||
|
|||||||
8
core/src/io/anuke/mindustry/mod/ClassAccess.java
Normal file
8
core/src/io/anuke/mindustry/mod/ClassAccess.java
Normal file
File diff suppressed because one or more lines are too long
@@ -30,7 +30,7 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
public class Mods implements Loadable{
|
public class Mods implements Loadable{
|
||||||
private Json json = new Json();
|
private Json json = new Json();
|
||||||
private Scripts scripts = new Scripts();
|
private Scripts scripts;
|
||||||
private ContentParser parser = new ContentParser();
|
private ContentParser parser = new ContentParser();
|
||||||
private ObjectMap<String, Array<FileHandle>> bundles = new ObjectMap<>();
|
private ObjectMap<String, Array<FileHandle>> bundles = new ObjectMap<>();
|
||||||
private ObjectSet<String> specialFolders = ObjectSet.with("bundles", "sprites");
|
private ObjectSet<String> specialFolders = ObjectSet.with("bundles", "sprites");
|
||||||
@@ -373,7 +373,10 @@ public class Mods implements Loadable{
|
|||||||
|
|
||||||
for(FileHandle file : mod.scripts){
|
for(FileHandle file : mod.scripts){
|
||||||
try{
|
try{
|
||||||
scripts.run(file.readString());
|
if(scripts == null){
|
||||||
|
scripts = new Scripts();
|
||||||
|
}
|
||||||
|
scripts.run(mod, file);
|
||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
Core.app.post(() -> {
|
Core.app.post(() -> {
|
||||||
Log.err("Error loading script {0} for mod {1}.", file.name(), mod.meta.name);
|
Log.err("Error loading script {0} for mod {1}.", file.name(), mod.meta.name);
|
||||||
|
|||||||
@@ -1,18 +1,40 @@
|
|||||||
package io.anuke.mindustry.mod;
|
package io.anuke.mindustry.mod;
|
||||||
|
|
||||||
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.files.*;
|
import io.anuke.arc.files.*;
|
||||||
|
import io.anuke.arc.util.*;
|
||||||
|
import io.anuke.mindustry.mod.Mods.*;
|
||||||
import org.graalvm.polyglot.*;
|
import org.graalvm.polyglot.*;
|
||||||
|
|
||||||
public class Scripts{
|
public class Scripts{
|
||||||
//TODO allowHostAccess(...) is obviously insecure
|
private final Context context;
|
||||||
private Context context = Context.newBuilder("js").allowHostClassLookup(s -> s.startsWith("io.anuke.mindustry"))
|
private final String wrapper;
|
||||||
.allowHostAccess(HostAccess.newBuilder().allowPublicAccess(true).denyAccess(FileHandle.class).build()).build();
|
|
||||||
|
|
||||||
public Scripts(){
|
public Scripts(){
|
||||||
context.eval("js", "console.log(\"Initialized JS context.\")");
|
Time.mark();
|
||||||
|
Context.Builder builder = Context.newBuilder("js").allowHostClassLookup(ClassAccess.allowedClassNames::contains);
|
||||||
|
|
||||||
|
HostAccess.Builder hb = HostAccess.newBuilder();
|
||||||
|
for(Class c : ClassAccess.allowedClasses){
|
||||||
|
hb.allowImplementations(c);
|
||||||
|
Structs.each(hb::allowAccess, c.getConstructors());
|
||||||
|
Structs.each(hb::allowAccess, c.getFields());
|
||||||
|
Structs.each(hb::allowAccess, c.getMethods());
|
||||||
|
}
|
||||||
|
builder.allowHostAccess(hb.build());
|
||||||
|
|
||||||
|
context = builder.build();
|
||||||
|
wrapper = Core.files.internal("scripts/wrapper.js").readString();
|
||||||
|
|
||||||
|
run(Core.files.internal("scripts/global.js").readString());
|
||||||
|
Log.info("Time to load script engine: {0}", Time.elapsed());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run(String script){
|
public void run(LoadedMod mod, FileHandle file){
|
||||||
|
run(wrapper.replace("$SCRIPT_NAME$", mod.name + "_" +file.nameWithoutExtension().replace("-", "_").replace(" ", "_")).replace("$CODE$", file.readString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void run(String script){
|
||||||
context.eval("js", script);
|
context.eval("js", script);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class Door extends Wall{
|
public class Door extends Wall{
|
||||||
protected final Rectangle rect = new Rectangle();
|
protected final static Rectangle rect = new Rectangle();
|
||||||
|
|
||||||
protected int timerToggle = timers++;
|
public final int timerToggle = timers++;
|
||||||
protected Effect openfx = Fx.dooropen;
|
public Effect openfx = Fx.dooropen;
|
||||||
protected Effect closefx = Fx.doorclose;
|
public Effect closefx = Fx.doorclose;
|
||||||
|
|
||||||
protected TextureRegion openRegion;
|
protected TextureRegion openRegion;
|
||||||
|
|
||||||
|
|||||||
@@ -21,17 +21,17 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class ForceProjector extends Block{
|
public class ForceProjector extends Block{
|
||||||
protected int timerUse = timers++;
|
public final int timerUse = timers++;
|
||||||
protected float phaseUseTime = 350f;
|
public float phaseUseTime = 350f;
|
||||||
|
|
||||||
protected float phaseRadiusBoost = 80f;
|
public float phaseRadiusBoost = 80f;
|
||||||
protected float radius = 101.7f;
|
public float radius = 101.7f;
|
||||||
protected float breakage = 550f;
|
public float breakage = 550f;
|
||||||
protected float cooldownNormal = 1.75f;
|
public float cooldownNormal = 1.75f;
|
||||||
protected float cooldownLiquid = 1.5f;
|
public float cooldownLiquid = 1.5f;
|
||||||
protected float cooldownBrokenBase = 0.35f;
|
public float cooldownBrokenBase = 0.35f;
|
||||||
protected float basePowerDraw = 0.2f;
|
public float basePowerDraw = 0.2f;
|
||||||
protected TextureRegion topRegion;
|
public TextureRegion topRegion;
|
||||||
|
|
||||||
private static Tile paramTile;
|
private static Tile paramTile;
|
||||||
private static ForceProjector paramBlock;
|
private static ForceProjector paramBlock;
|
||||||
|
|||||||
@@ -18,19 +18,18 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class MendProjector extends Block{
|
public class MendProjector extends Block{
|
||||||
private static Color color = Color.valueOf("84f491");
|
private static final IntSet healed = new IntSet();
|
||||||
private static Color phase = Color.valueOf("ffd59e");
|
|
||||||
private static IntSet healed = new IntSet();
|
|
||||||
|
|
||||||
protected int timerUse = timers++;
|
public final int timerUse = timers++;
|
||||||
|
public Color baseColor = Color.valueOf("84f491");
|
||||||
protected TextureRegion topRegion;
|
public Color phaseColor = Color.valueOf("ffd59e");
|
||||||
protected float reload = 250f;
|
public TextureRegion topRegion;
|
||||||
protected float range = 60f;
|
public float reload = 250f;
|
||||||
protected float healPercent = 12f;
|
public float range = 60f;
|
||||||
protected float phaseBoost = 12f;
|
public float healPercent = 12f;
|
||||||
protected float phaseRangeBoost = 50f;
|
public float phaseBoost = 12f;
|
||||||
protected float useTime = 400f;
|
public float phaseRangeBoost = 50f;
|
||||||
|
public float useTime = 400f;
|
||||||
|
|
||||||
public MendProjector(String name){
|
public MendProjector(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -92,7 +91,7 @@ public class MendProjector extends Block{
|
|||||||
|
|
||||||
if(other.getTeamID() == tile.getTeamID() && !healed.contains(other.pos()) && other.entity != null && other.entity.health < other.entity.maxHealth()){
|
if(other.getTeamID() == tile.getTeamID() && !healed.contains(other.pos()) && other.entity != null && other.entity.health < other.entity.maxHealth()){
|
||||||
other.entity.healBy(other.entity.maxHealth() * (healPercent + entity.phaseHeat * phaseBoost) / 100f * entity.efficiency());
|
other.entity.healBy(other.entity.maxHealth() * (healPercent + entity.phaseHeat * phaseBoost) / 100f * entity.efficiency());
|
||||||
Effects.effect(Fx.healBlockFull, Tmp.c1.set(color).lerp(phase, entity.phaseHeat), other.drawx(), other.drawy(), other.block().size);
|
Effects.effect(Fx.healBlockFull, Tmp.c1.set(baseColor).lerp(phaseColor, entity.phaseHeat), other.drawx(), other.drawy(), other.block().size);
|
||||||
healed.add(other.pos());
|
healed.add(other.pos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +109,7 @@ public class MendProjector extends Block{
|
|||||||
MendEntity entity = tile.entity();
|
MendEntity entity = tile.entity();
|
||||||
float realRange = range + entity.phaseHeat * phaseRangeBoost;
|
float realRange = range + entity.phaseHeat * phaseRangeBoost;
|
||||||
|
|
||||||
Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, color);
|
Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, baseColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -120,7 +119,7 @@ public class MendProjector extends Block{
|
|||||||
MendEntity entity = tile.entity();
|
MendEntity entity = tile.entity();
|
||||||
float f = 1f - (Time.time() / 100f) % 1f;
|
float f = 1f - (Time.time() / 100f) % 1f;
|
||||||
|
|
||||||
Draw.color(color, phase, entity.phaseHeat);
|
Draw.color(baseColor, phaseColor, entity.phaseHeat);
|
||||||
Draw.alpha(entity.heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f);
|
Draw.alpha(entity.heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f);
|
||||||
//Draw.blend(Blending.additive);
|
//Draw.blend(Blending.additive);
|
||||||
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
||||||
@@ -135,7 +134,7 @@ public class MendProjector extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(Tile tile){
|
public void drawLight(Tile tile){
|
||||||
renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), color, 0.7f * tile.entity.efficiency());
|
renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), baseColor, 0.7f * tile.entity.efficiency());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MendEntity extends TileEntity{
|
class MendEntity extends TileEntity{
|
||||||
|
|||||||
@@ -16,19 +16,19 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class OverdriveProjector extends Block{
|
public class OverdriveProjector extends Block{
|
||||||
private static Color color = Color.valueOf("feb380");
|
private static final IntSet healed = new IntSet();
|
||||||
private static Color phase = Color.valueOf("ffd59e");
|
|
||||||
private static IntSet healed = new IntSet();
|
|
||||||
|
|
||||||
protected int timerUse = timers++;
|
public final int timerUse = timers++;
|
||||||
|
|
||||||
protected TextureRegion topRegion;
|
public TextureRegion topRegion;
|
||||||
protected float reload = 60f;
|
public float reload = 60f;
|
||||||
protected float range = 80f;
|
public float range = 80f;
|
||||||
protected float speedBoost = 1.5f;
|
public float speedBoost = 1.5f;
|
||||||
protected float speedBoostPhase = 0.75f;
|
public float speedBoostPhase = 0.75f;
|
||||||
protected float useTime = 400f;
|
public float useTime = 400f;
|
||||||
protected float phaseRangeBoost = 20f;
|
public float phaseRangeBoost = 20f;
|
||||||
|
public Color baseColor = Color.valueOf("feb380");
|
||||||
|
public Color phaseColor = Color.valueOf("ffd59e");
|
||||||
|
|
||||||
public OverdriveProjector(String name){
|
public OverdriveProjector(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -69,7 +69,7 @@ public class OverdriveProjector extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(Tile tile){
|
public void drawLight(Tile tile){
|
||||||
renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), color, 0.7f * tile.entity.efficiency());
|
renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), baseColor, 0.7f * tile.entity.efficiency());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -118,7 +118,7 @@ public class OverdriveProjector extends Block{
|
|||||||
OverdriveEntity entity = tile.entity();
|
OverdriveEntity entity = tile.entity();
|
||||||
float realRange = range + entity.phaseHeat * phaseRangeBoost;
|
float realRange = range + entity.phaseHeat * phaseRangeBoost;
|
||||||
|
|
||||||
Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, color);
|
Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, baseColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -128,7 +128,7 @@ public class OverdriveProjector extends Block{
|
|||||||
OverdriveEntity entity = tile.entity();
|
OverdriveEntity entity = tile.entity();
|
||||||
float f = 1f - (Time.time() / 100f) % 1f;
|
float f = 1f - (Time.time() / 100f) % 1f;
|
||||||
|
|
||||||
Draw.color(color, phase, entity.phaseHeat);
|
Draw.color(baseColor, phaseColor, entity.phaseHeat);
|
||||||
Draw.alpha(entity.heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f);
|
Draw.alpha(entity.heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f);
|
||||||
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
||||||
Draw.alpha(1f);
|
Draw.alpha(1f);
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ import io.anuke.mindustry.world.Block;
|
|||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
public class ShockMine extends Block{
|
public class ShockMine extends Block{
|
||||||
protected int timerDamage = timers++;
|
public final int timerDamage = timers++;
|
||||||
|
|
||||||
protected float cooldown = 80f;
|
public float cooldown = 80f;
|
||||||
protected float tileDamage = 5f;
|
public float tileDamage = 5f;
|
||||||
protected float damage = 13;
|
public float damage = 13;
|
||||||
protected int length = 10;
|
public int length = 10;
|
||||||
protected int tendrils = 6;
|
public int tendrils = 6;
|
||||||
|
|
||||||
public ShockMine(String name){
|
public ShockMine(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import io.anuke.mindustry.entities.type.TileEntity;
|
|||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.graphics.Pal;
|
||||||
|
|
||||||
public class SurgeWall extends Wall{
|
public class SurgeWall extends Wall{
|
||||||
protected float lightningChance = 0.05f;
|
public float lightningChance = 0.05f;
|
||||||
protected float lightningDamage = 15f;
|
public float lightningDamage = 15f;
|
||||||
protected int lightningLength = 17;
|
public int lightningLength = 17;
|
||||||
|
|
||||||
public SurgeWall(String name){
|
public SurgeWall(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import io.anuke.mindustry.world.Tile;
|
|||||||
import io.anuke.mindustry.world.meta.BlockGroup;
|
import io.anuke.mindustry.world.meta.BlockGroup;
|
||||||
|
|
||||||
public class Wall extends Block{
|
public class Wall extends Block{
|
||||||
protected int variants = 0;
|
public int variants = 0;
|
||||||
|
|
||||||
public Wall(String name){
|
public Wall(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import static io.anuke.mindustry.Vars.tilesize;
|
|||||||
* Artillery turrets have special shooting calculations done to hit targets.
|
* Artillery turrets have special shooting calculations done to hit targets.
|
||||||
*/
|
*/
|
||||||
public class ArtilleryTurret extends ItemTurret{
|
public class ArtilleryTurret extends ItemTurret{
|
||||||
protected float velocityInaccuracy = 0f;
|
public float velocityInaccuracy = 0f;
|
||||||
|
|
||||||
public ArtilleryTurret(String name){
|
public ArtilleryTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import io.anuke.mindustry.world.Tile;
|
|||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
public class BurstTurret extends ItemTurret{
|
public class BurstTurret extends ItemTurret{
|
||||||
protected float burstSpacing = 5;
|
public float burstSpacing = 5;
|
||||||
|
|
||||||
public BurstTurret(String name){
|
public BurstTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ import static io.anuke.mindustry.Vars.tilesize;
|
|||||||
|
|
||||||
public class ChargeTurret extends PowerTurret{
|
public class ChargeTurret extends PowerTurret{
|
||||||
|
|
||||||
protected float chargeTime = 30f;
|
public float chargeTime = 30f;
|
||||||
protected int chargeEffects = 5;
|
public int chargeEffects = 5;
|
||||||
protected float chargeMaxDelay = 10f;
|
public float chargeMaxDelay = 10f;
|
||||||
protected Effect chargeEffect = Fx.none;
|
public Effect chargeEffect = Fx.none;
|
||||||
protected Effect chargeBeginEffect = Fx.none;
|
public Effect chargeBeginEffect = Fx.none;
|
||||||
|
|
||||||
public ChargeTurret(String name){
|
public ChargeTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import static io.anuke.mindustry.Vars.tilesize;
|
|||||||
|
|
||||||
public class CooledTurret extends Turret{
|
public class CooledTurret extends Turret{
|
||||||
/** How much reload is lowered by for each unit of liquid of heat capacity. */
|
/** How much reload is lowered by for each unit of liquid of heat capacity. */
|
||||||
protected float coolantMultiplier = 5f;
|
public float coolantMultiplier = 5f;
|
||||||
protected Effect coolEffect = Fx.fuelburn;
|
public Effect coolEffect = Fx.fuelburn;
|
||||||
|
|
||||||
public CooledTurret(String name){
|
public CooledTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import io.anuke.mindustry.world.meta.StatUnit;
|
|||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
public class DoubleTurret extends ItemTurret{
|
public class DoubleTurret extends ItemTurret{
|
||||||
protected float shotWidth = 2f;
|
public float shotWidth = 2f;
|
||||||
|
|
||||||
public DoubleTurret(String name){
|
public DoubleTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class ItemTurret extends CooledTurret{
|
public class ItemTurret extends CooledTurret{
|
||||||
protected int maxAmmo = 30;
|
public int maxAmmo = 30;
|
||||||
protected ObjectMap<Item, BulletType> ammo = new ObjectMap<>();
|
public ObjectMap<Item, BulletType> ammo = new ObjectMap<>();
|
||||||
|
|
||||||
public ItemTurret(String name){
|
public ItemTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import io.anuke.mindustry.world.meta.values.*;
|
|||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
public class LaserTurret extends PowerTurret{
|
public class LaserTurret extends PowerTurret{
|
||||||
protected float firingMoveFract = 0.25f;
|
public float firingMoveFract = 0.25f;
|
||||||
protected float shootDuration = 100f;
|
public float shootDuration = 100f;
|
||||||
|
|
||||||
public LaserTurret(String name){
|
public LaserTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import io.anuke.mindustry.world.meta.values.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class LiquidTurret extends Turret{
|
public class LiquidTurret extends Turret{
|
||||||
protected ObjectMap<Liquid, BulletType> ammo = new ObjectMap<>();
|
public ObjectMap<Liquid, BulletType> ammo = new ObjectMap<>();
|
||||||
|
|
||||||
public LiquidTurret(String name){
|
public LiquidTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import io.anuke.mindustry.world.meta.BlockStat;
|
|||||||
import io.anuke.mindustry.world.meta.StatUnit;
|
import io.anuke.mindustry.world.meta.StatUnit;
|
||||||
|
|
||||||
public class PowerTurret extends CooledTurret{
|
public class PowerTurret extends CooledTurret{
|
||||||
protected @NonNull BulletType shootType;
|
public @NonNull BulletType shootType;
|
||||||
protected float powerUse = 1f;
|
public float powerUse = 1f;
|
||||||
|
|
||||||
public PowerTurret(String name){
|
public PowerTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -28,40 +28,39 @@ import io.anuke.mindustry.world.meta.*;
|
|||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
public abstract class Turret extends Block{
|
public abstract class Turret extends Block{
|
||||||
protected static final int targetInterval = 20;
|
public final int timerTarget = timers++;
|
||||||
|
public int targetInterval = 20;
|
||||||
|
|
||||||
protected final int timerTarget = timers++;
|
public Color heatColor = Pal.turretHeat;
|
||||||
|
public Effect shootEffect = Fx.none;
|
||||||
|
public Effect smokeEffect = Fx.none;
|
||||||
|
public Effect ammoUseEffect = Fx.none;
|
||||||
|
public Sound shootSound = Sounds.shoot;
|
||||||
|
|
||||||
protected Color heatColor = Pal.turretHeat;
|
public int ammoPerShot = 1;
|
||||||
protected Effect shootEffect = Fx.none;
|
public float ammoEjectBack = 1f;
|
||||||
protected Effect smokeEffect = Fx.none;
|
public float range = 50f;
|
||||||
protected Effect ammoUseEffect = Fx.none;
|
public float reload = 10f;
|
||||||
protected Sound shootSound = Sounds.shoot;
|
public float inaccuracy = 0f;
|
||||||
|
public int shots = 1;
|
||||||
protected int ammoPerShot = 1;
|
public float spread = 4f;
|
||||||
protected float ammoEjectBack = 1f;
|
public float recoil = 1f;
|
||||||
protected float range = 50f;
|
public float restitution = 0.02f;
|
||||||
protected float reload = 10f;
|
public float cooldown = 0.02f;
|
||||||
protected float inaccuracy = 0f;
|
public float rotatespeed = 5f; //in degrees per tick
|
||||||
protected int shots = 1;
|
public float shootCone = 8f;
|
||||||
protected float spread = 4f;
|
public float shootShake = 0f;
|
||||||
protected float recoil = 1f;
|
public float xRand = 0f;
|
||||||
protected float restitution = 0.02f;
|
public boolean targetAir = true;
|
||||||
protected float cooldown = 0.02f;
|
public boolean targetGround = true;
|
||||||
protected float rotatespeed = 5f; //in degrees per tick
|
|
||||||
protected float shootCone = 8f;
|
|
||||||
protected float shootShake = 0f;
|
|
||||||
protected float xRand = 0f;
|
|
||||||
protected boolean targetAir = true;
|
|
||||||
protected boolean targetGround = true;
|
|
||||||
|
|
||||||
protected Vector2 tr = new Vector2();
|
protected Vector2 tr = new Vector2();
|
||||||
protected Vector2 tr2 = new Vector2();
|
protected Vector2 tr2 = new Vector2();
|
||||||
|
|
||||||
protected TextureRegion baseRegion, heatRegion;
|
public TextureRegion baseRegion, heatRegion;
|
||||||
|
|
||||||
protected Cons2<Tile, TurretEntity> drawer = (tile, entity) -> Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
public Cons2<Tile, TurretEntity> drawer = (tile, entity) -> Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||||
protected Cons2<Tile, TurretEntity> heatDrawer = (tile, entity) -> {
|
public Cons2<Tile, TurretEntity> heatDrawer = (tile, entity) -> {
|
||||||
if(entity.heat <= 0.00001f) return;
|
if(entity.heat <= 0.00001f) return;
|
||||||
Draw.color(heatColor, entity.heat);
|
Draw.color(heatColor, entity.heat);
|
||||||
Draw.blend(Blending.additive);
|
Draw.blend(Blending.additive);
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import io.anuke.mindustry.world.*;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class BufferedItemBridge extends ExtendingItemBridge{
|
public class BufferedItemBridge extends ExtendingItemBridge{
|
||||||
protected int timerAccept = timers++;
|
public final int timerAccept = timers++;
|
||||||
|
|
||||||
protected float speed = 40f;
|
public float speed = 40f;
|
||||||
protected int bufferCapacity = 50;
|
public int bufferCapacity = 50;
|
||||||
|
|
||||||
public BufferedItemBridge(String name){
|
public BufferedItemBridge(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class Conveyor extends Block implements Autotiler{
|
|||||||
private final Vector2 tr2 = new Vector2();
|
private final Vector2 tr2 = new Vector2();
|
||||||
private TextureRegion[][] regions = new TextureRegion[7][4];
|
private TextureRegion[][] regions = new TextureRegion[7][4];
|
||||||
|
|
||||||
protected float speed = 0f;
|
public float speed = 0f;
|
||||||
|
|
||||||
protected Conveyor(String name){
|
protected Conveyor(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class ItemBridge extends Block{
|
public class ItemBridge extends Block{
|
||||||
protected int timerTransport = timers++;
|
public final int timerTransport = timers++;
|
||||||
protected int range;
|
public int range;
|
||||||
protected float transportTime = 2f;
|
public float transportTime = 2f;
|
||||||
protected TextureRegion endRegion, bridgeRegion, arrowRegion;
|
public TextureRegion endRegion, bridgeRegion, arrowRegion;
|
||||||
protected BuildRequest otherReq;
|
|
||||||
|
|
||||||
|
private static BuildRequest otherReq;
|
||||||
private static int lastPlaced = Pos.invalid;
|
private static int lastPlaced = Pos.invalid;
|
||||||
|
|
||||||
public ItemBridge(String name){
|
public ItemBridge(String name){
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import java.io.IOException;
|
|||||||
import static io.anuke.mindustry.Vars.content;
|
import static io.anuke.mindustry.Vars.content;
|
||||||
|
|
||||||
public class Junction extends Block{
|
public class Junction extends Block{
|
||||||
protected float speed = 26; //frames taken to go through this junction
|
public float speed = 26; //frames taken to go through this junction
|
||||||
protected int capacity = 6;
|
public int capacity = 6;
|
||||||
|
|
||||||
public Junction(String name){
|
public Junction(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -20,17 +20,17 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class MassDriver extends Block{
|
public class MassDriver extends Block{
|
||||||
protected float range;
|
public float range;
|
||||||
protected float rotateSpeed = 0.04f;
|
public float rotateSpeed = 0.04f;
|
||||||
protected float translation = 7f;
|
public float translation = 7f;
|
||||||
protected int minDistribute = 10;
|
public int minDistribute = 10;
|
||||||
protected float knockback = 4f;
|
public float knockback = 4f;
|
||||||
protected float reloadTime = 100f;
|
public float reloadTime = 100f;
|
||||||
protected Effect shootEffect = Fx.shootBig2;
|
public Effect shootEffect = Fx.shootBig2;
|
||||||
protected Effect smokeEffect = Fx.shootBigSmoke2;
|
public Effect smokeEffect = Fx.shootBigSmoke2;
|
||||||
protected Effect recieveEffect = Fx.mineBig;
|
public Effect recieveEffect = Fx.mineBig;
|
||||||
protected float shake = 3f;
|
public float shake = 3f;
|
||||||
protected TextureRegion baseRegion;
|
public TextureRegion baseRegion;
|
||||||
|
|
||||||
public MassDriver(String name){
|
public MassDriver(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.anuke.mindustry.world.meta.BlockGroup;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class OverflowGate extends Block{
|
public class OverflowGate extends Block{
|
||||||
protected float speed = 1f;
|
public float speed = 1f;
|
||||||
|
|
||||||
public OverflowGate(String name){
|
public OverflowGate(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import io.anuke.mindustry.world.*;
|
|||||||
import io.anuke.mindustry.world.meta.BlockGroup;
|
import io.anuke.mindustry.world.meta.BlockGroup;
|
||||||
|
|
||||||
public class Router extends Block{
|
public class Router extends Block{
|
||||||
protected float speed = 8f;
|
public float speed = 8f;
|
||||||
|
|
||||||
public Router(String name){
|
public Router(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import static io.anuke.mindustry.Vars.content;
|
|||||||
|
|
||||||
public class Sorter extends Block{
|
public class Sorter extends Block{
|
||||||
private static Item lastItem;
|
private static Item lastItem;
|
||||||
protected boolean invert;
|
public boolean invert;
|
||||||
|
|
||||||
public Sorter(String name){
|
public Sorter(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import io.anuke.mindustry.world.Edges;
|
|||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
public class ArmoredConduit extends Conduit{
|
public class ArmoredConduit extends Conduit{
|
||||||
protected TextureRegion capRegion;
|
public TextureRegion capRegion;
|
||||||
|
|
||||||
public ArmoredConduit(String name){
|
public ArmoredConduit(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ import io.anuke.mindustry.world.blocks.*;
|
|||||||
import io.anuke.mindustry.world.modules.*;
|
import io.anuke.mindustry.world.modules.*;
|
||||||
|
|
||||||
public class Conduit extends LiquidBlock implements Autotiler{
|
public class Conduit extends LiquidBlock implements Autotiler{
|
||||||
protected final int timerFlow = timers++;
|
public final int timerFlow = timers++;
|
||||||
|
|
||||||
protected TextureRegion[] topRegions = new TextureRegion[7];
|
public TextureRegion[] topRegions = new TextureRegion[7];
|
||||||
protected TextureRegion[] botRegions = new TextureRegion[7];
|
public TextureRegion[] botRegions = new TextureRegion[7];
|
||||||
|
|
||||||
protected float leakResistance = 1.5f;
|
public float leakResistance = 1.5f;
|
||||||
|
|
||||||
public Conduit(String name){
|
public Conduit(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import io.anuke.mindustry.world.meta.*;
|
|||||||
|
|
||||||
//TODO implement later
|
//TODO implement later
|
||||||
public class LiquidOverflowGate extends LiquidBlock{
|
public class LiquidOverflowGate extends LiquidBlock{
|
||||||
int topRegion;
|
public int topRegion;
|
||||||
|
|
||||||
public LiquidOverflowGate(String name){
|
public LiquidOverflowGate(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -19,17 +19,17 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class ImpactReactor extends PowerGenerator{
|
public class ImpactReactor extends PowerGenerator{
|
||||||
protected int timerUse = timers++;
|
public final int timerUse = timers++;
|
||||||
|
|
||||||
protected int plasmas = 4;
|
public int plasmas = 4;
|
||||||
protected float warmupSpeed = 0.001f;
|
public float warmupSpeed = 0.001f;
|
||||||
protected float itemDuration = 60f;
|
public float itemDuration = 60f;
|
||||||
protected int explosionRadius = 50;
|
public int explosionRadius = 50;
|
||||||
protected int explosionDamage = 2000;
|
public int explosionDamage = 2000;
|
||||||
|
|
||||||
protected Color plasma1 = Color.valueOf("ffd06b"), plasma2 = Color.valueOf("ff361b");
|
public Color plasma1 = Color.valueOf("ffd06b"), plasma2 = Color.valueOf("ff361b");
|
||||||
protected int bottomRegion;
|
public int bottomRegion;
|
||||||
protected int[] plasmaRegions;
|
public int[] plasmaRegions;
|
||||||
|
|
||||||
public ImpactReactor(String name){
|
public ImpactReactor(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -20,20 +20,20 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
* Liquids will take priority over items.
|
* Liquids will take priority over items.
|
||||||
*/
|
*/
|
||||||
public class ItemLiquidGenerator extends PowerGenerator{
|
public class ItemLiquidGenerator extends PowerGenerator{
|
||||||
protected float minItemEfficiency = 0.2f;
|
public float minItemEfficiency = 0.2f;
|
||||||
/** The time in number of ticks during which a single item will produce power. */
|
/** The time in number of ticks during which a single item will produce power. */
|
||||||
protected float itemDuration = 70f;
|
public float itemDuration = 70f;
|
||||||
|
|
||||||
protected float minLiquidEfficiency = 0.2f;
|
public float minLiquidEfficiency = 0.2f;
|
||||||
/** Maximum liquid used per frame. */
|
/** Maximum liquid used per frame. */
|
||||||
protected float maxLiquidGenerate = 0.4f;
|
public float maxLiquidGenerate = 0.4f;
|
||||||
|
|
||||||
protected Effect generateEffect = Fx.generatespark;
|
public Effect generateEffect = Fx.generatespark;
|
||||||
protected Effect explodeEffect = Fx.generatespark;
|
public Effect explodeEffect = Fx.generatespark;
|
||||||
protected Color heatColor = Color.valueOf("ff9b59");
|
public Color heatColor = Color.valueOf("ff9b59");
|
||||||
protected TextureRegion topRegion, liquidRegion;
|
public TextureRegion topRegion, liquidRegion;
|
||||||
protected boolean randomlyExplode = true;
|
public boolean randomlyExplode = true;
|
||||||
protected boolean defaults = false;
|
public boolean defaults = false;
|
||||||
|
|
||||||
public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){
|
public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){
|
||||||
this(name);
|
this(name);
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
public class LightBlock extends Block{
|
public class LightBlock extends Block{
|
||||||
private static int lastColor = 0;
|
private static int lastColor = 0;
|
||||||
|
|
||||||
protected float brightness = 0.9f;
|
public float brightness = 0.9f;
|
||||||
protected float radius = 200f;
|
public float radius = 200f;
|
||||||
protected int topRegion;
|
public int topRegion;
|
||||||
|
|
||||||
public LightBlock(String name){
|
public LightBlock(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -22,22 +22,22 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class NuclearReactor extends PowerGenerator{
|
public class NuclearReactor extends PowerGenerator{
|
||||||
protected final int timerFuel = timers++;
|
public final int timerFuel = timers++;
|
||||||
|
|
||||||
protected final Vector2 tr = new Vector2();
|
public final Vector2 tr = new Vector2();
|
||||||
|
|
||||||
protected Color lightColor = Color.valueOf("7f19ea");
|
public Color lightColor = Color.valueOf("7f19ea");
|
||||||
protected Color coolColor = new Color(1, 1, 1, 0f);
|
public Color coolColor = new Color(1, 1, 1, 0f);
|
||||||
protected Color hotColor = Color.valueOf("ff9575a3");
|
public Color hotColor = Color.valueOf("ff9575a3");
|
||||||
protected float itemDuration = 120; //time to consume 1 fuel
|
public float itemDuration = 120; //time to consume 1 fuel
|
||||||
protected float heating = 0.01f; //heating per frame * fullness
|
public float heating = 0.01f; //heating per frame * fullness
|
||||||
protected float smokeThreshold = 0.3f; //threshold at which block starts smoking
|
public float smokeThreshold = 0.3f; //threshold at which block starts smoking
|
||||||
protected int explosionRadius = 40;
|
public int explosionRadius = 40;
|
||||||
protected int explosionDamage = 1350;
|
public int explosionDamage = 1350;
|
||||||
protected float flashThreshold = 0.46f; //heat threshold at which the lights start flashing
|
public float flashThreshold = 0.46f; //heat threshold at which the lights start flashing
|
||||||
protected float coolantPower = 0.5f;
|
public float coolantPower = 0.5f;
|
||||||
|
|
||||||
protected TextureRegion topRegion, lightsRegion;
|
public TextureRegion topRegion, lightsRegion;
|
||||||
|
|
||||||
public NuclearReactor(String name){
|
public NuclearReactor(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import io.anuke.arc.graphics.g2d.TextureRegion;
|
|||||||
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
||||||
|
|
||||||
public class PowerDiode extends Block{
|
public class PowerDiode extends Block{
|
||||||
protected TextureRegion arrow;
|
public TextureRegion arrow;
|
||||||
|
|
||||||
public PowerDiode(String name){
|
public PowerDiode(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -50,7 +50,7 @@ public class PowerDiode extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// battery % of the graph on either side, defaults to zero
|
// battery % of the graph on either side, defaults to zero
|
||||||
protected float bar(Tile tile){
|
public float bar(Tile tile){
|
||||||
return (tile != null && tile.block().hasPower) ? tile.entity.power.graph.getBatteryStored() / tile.entity.power.graph.getTotalBatteryCapacity() : 0f;
|
return (tile != null && tile.block().hasPower) ? tile.entity.power.graph.getBatteryStored() / tile.entity.power.graph.getTotalBatteryCapacity() : 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.io.*;
|
|||||||
|
|
||||||
public class PowerGenerator extends PowerDistributor{
|
public class PowerGenerator extends PowerDistributor{
|
||||||
/** The amount of power produced per tick in case of an efficiency of 1.0, which represents 100%. */
|
/** The amount of power produced per tick in case of an efficiency of 1.0, which represents 100%. */
|
||||||
protected float powerProduction;
|
public float powerProduction;
|
||||||
public BlockStat generationType = BlockStat.basePowerGeneration;
|
public BlockStat generationType = BlockStat.basePowerGeneration;
|
||||||
|
|
||||||
public PowerGenerator(String name){
|
public PowerGenerator(String name){
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
public class PowerNode extends PowerBlock{
|
public class PowerNode extends PowerBlock{
|
||||||
protected static boolean returnValue = false;
|
protected static boolean returnValue = false;
|
||||||
|
|
||||||
protected ObjectSet<PowerGraph> graphs = new ObjectSet<>();
|
protected final ObjectSet<PowerGraph> graphs = new ObjectSet<>();
|
||||||
protected Vector2 t1 = new Vector2(), t2 = new Vector2();
|
protected final Vector2 t1 = new Vector2(), t2 = new Vector2();
|
||||||
protected TextureRegion laser, laserEnd;
|
|
||||||
|
|
||||||
protected float laserRange = 6;
|
public TextureRegion laser, laserEnd;
|
||||||
protected int maxNodes = 3;
|
public float laserRange = 6;
|
||||||
|
public int maxNodes = 3;
|
||||||
|
|
||||||
public PowerNode(String name){
|
public PowerNode(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import io.anuke.mindustry.world.meta.*;
|
|||||||
import static io.anuke.mindustry.Vars.renderer;
|
import static io.anuke.mindustry.Vars.renderer;
|
||||||
|
|
||||||
public class ThermalGenerator extends PowerGenerator{
|
public class ThermalGenerator extends PowerGenerator{
|
||||||
protected Effect generateEffect = Fx.none;
|
public Effect generateEffect = Fx.none;
|
||||||
|
|
||||||
public ThermalGenerator(String name){
|
public ThermalGenerator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ import io.anuke.mindustry.world.meta.Attribute;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class Cultivator extends GenericCrafter{
|
public class Cultivator extends GenericCrafter{
|
||||||
protected static final Color plantColor = Color.valueOf("5541b1");
|
public Color plantColor = Color.valueOf("5541b1");
|
||||||
protected static final Color plantColorLight = Color.valueOf("7457ce");
|
public Color plantColorLight = Color.valueOf("7457ce");
|
||||||
protected static final Color bottomColor = Color.valueOf("474747");
|
public Color bottomColor = Color.valueOf("474747");
|
||||||
|
|
||||||
protected TextureRegion middleRegion, topRegion;
|
public TextureRegion middleRegion, topRegion;
|
||||||
protected RandomXS128 random = new RandomXS128(0);
|
public RandomXS128 random = new RandomXS128(0);
|
||||||
protected float recurrence = 6f;
|
public float recurrence = 6f;
|
||||||
protected Attribute attribute = Attribute.spores;
|
public Attribute attribute = Attribute.spores;
|
||||||
|
|
||||||
public Cultivator(String name){
|
public Cultivator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -21,41 +21,40 @@ import io.anuke.mindustry.world.meta.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class Drill extends Block{
|
public class Drill extends Block{
|
||||||
protected final static float hardnessDrillMultiplier = 50f;
|
public float hardnessDrillMultiplier = 50f;
|
||||||
|
|
||||||
protected final ObjectIntMap<Item> oreCount = new ObjectIntMap<>();
|
protected final ObjectIntMap<Item> oreCount = new ObjectIntMap<>();
|
||||||
protected final Array<Item> itemArray = new Array<>();
|
protected final Array<Item> itemArray = new Array<>();
|
||||||
|
|
||||||
/** Maximum tier of blocks this drill can mine. */
|
/** Maximum tier of blocks this drill can mine. */
|
||||||
protected int tier;
|
public int tier;
|
||||||
/** Base time to drill one ore, in frames. */
|
/** Base time to drill one ore, in frames. */
|
||||||
protected float drillTime = 300;
|
public float drillTime = 300;
|
||||||
/** How many times faster the drill will progress when boosted by liquid. */
|
/** How many times faster the drill will progress when boosted by liquid. */
|
||||||
protected float liquidBoostIntensity = 1.6f;
|
public float liquidBoostIntensity = 1.6f;
|
||||||
/** Speed at which the drill speeds up. */
|
/** Speed at which the drill speeds up. */
|
||||||
protected float warmupSpeed = 0.02f;
|
public float warmupSpeed = 0.02f;
|
||||||
|
|
||||||
//return variables for countOre
|
//return variables for countOre
|
||||||
protected Item returnItem;
|
protected Item returnItem;
|
||||||
protected int returnCount;
|
protected int returnCount;
|
||||||
|
|
||||||
/** Whether to draw the item this drill is mining. */
|
/** Whether to draw the item this drill is mining. */
|
||||||
protected boolean drawMineItem = false;
|
public boolean drawMineItem = false;
|
||||||
/** Effect played when an item is produced. This is colored. */
|
/** Effect played when an item is produced. This is colored. */
|
||||||
protected Effect drillEffect = Fx.mine;
|
public Effect drillEffect = Fx.mine;
|
||||||
/** Speed the drill bit rotates at. */
|
/** Speed the drill bit rotates at. */
|
||||||
protected float rotateSpeed = 2f;
|
public float rotateSpeed = 2f;
|
||||||
/** Effect randomly played while drilling. */
|
/** Effect randomly played while drilling. */
|
||||||
protected Effect updateEffect = Fx.pulverizeSmall;
|
public Effect updateEffect = Fx.pulverizeSmall;
|
||||||
/** Chance the update effect will appear. */
|
/** Chance the update effect will appear. */
|
||||||
protected float updateEffectChance = 0.02f;
|
public float updateEffectChance = 0.02f;
|
||||||
|
|
||||||
protected boolean drawRim = false;
|
public boolean drawRim = false;
|
||||||
|
public Color heatColor = Color.valueOf("ff5512");
|
||||||
protected Color heatColor = Color.valueOf("ff5512");
|
public TextureRegion rimRegion;
|
||||||
protected TextureRegion rimRegion;
|
public TextureRegion rotatorRegion;
|
||||||
protected TextureRegion rotatorRegion;
|
public TextureRegion topRegion;
|
||||||
protected TextureRegion topRegion;
|
|
||||||
|
|
||||||
public Drill(String name){
|
public Drill(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import io.anuke.mindustry.world.*;
|
|||||||
import io.anuke.mindustry.world.meta.*;
|
import io.anuke.mindustry.world.meta.*;
|
||||||
|
|
||||||
public class Fracker extends SolidPump{
|
public class Fracker extends SolidPump{
|
||||||
protected final float itemUseTime = 100f;
|
public float itemUseTime = 100f;
|
||||||
|
|
||||||
protected TextureRegion liquidRegion;
|
public TextureRegion liquidRegion;
|
||||||
protected TextureRegion rotatorRegion;
|
public TextureRegion rotatorRegion;
|
||||||
protected TextureRegion topRegion;
|
public TextureRegion topRegion;
|
||||||
|
|
||||||
public Fracker(String name){
|
public Fracker(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -17,16 +17,16 @@ import io.anuke.mindustry.world.meta.*;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class GenericCrafter extends Block{
|
public class GenericCrafter extends Block{
|
||||||
protected ItemStack outputItem;
|
public ItemStack outputItem;
|
||||||
protected LiquidStack outputLiquid;
|
public LiquidStack outputLiquid;
|
||||||
|
|
||||||
protected float craftTime = 80;
|
public float craftTime = 80;
|
||||||
protected Effect craftEffect = Fx.none;
|
public Effect craftEffect = Fx.none;
|
||||||
protected Effect updateEffect = Fx.none;
|
public Effect updateEffect = Fx.none;
|
||||||
protected float updateEffectChance = 0.04f;
|
public float updateEffectChance = 0.04f;
|
||||||
|
|
||||||
protected Cons<Tile> drawer = null;
|
public Cons<Tile> drawer = null;
|
||||||
protected Prov<TextureRegion[]> drawIcons = null;
|
public Prov<TextureRegion[]> drawIcons = null;
|
||||||
|
|
||||||
public GenericCrafter(String name){
|
public GenericCrafter(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import static io.anuke.mindustry.Vars.renderer;
|
|||||||
|
|
||||||
/** A GenericCrafter with a new glowing region drawn on top. */
|
/** A GenericCrafter with a new glowing region drawn on top. */
|
||||||
public class GenericSmelter extends GenericCrafter{
|
public class GenericSmelter extends GenericCrafter{
|
||||||
protected Color flameColor = Color.valueOf("ffc999");
|
public Color flameColor = Color.valueOf("ffc999");
|
||||||
protected TextureRegion topRegion;
|
public TextureRegion topRegion;
|
||||||
|
|
||||||
public GenericSmelter(String name){
|
public GenericSmelter(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import io.anuke.mindustry.world.Block;
|
|||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
public class Incinerator extends Block{
|
public class Incinerator extends Block{
|
||||||
protected Effect effect = Fx.fuelburn;
|
public Effect effect = Fx.fuelburn;
|
||||||
protected Color flameColor = Color.valueOf("ffad9d");
|
public Color flameColor = Color.valueOf("ffad9d");
|
||||||
|
|
||||||
public Incinerator(String name){
|
public Incinerator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class Pump extends LiquidBlock{
|
|||||||
protected final Array<Tile> drawTiles = new Array<>();
|
protected final Array<Tile> drawTiles = new Array<>();
|
||||||
protected final Array<Tile> updateTiles = new Array<>();
|
protected final Array<Tile> updateTiles = new Array<>();
|
||||||
|
|
||||||
protected final int timerContentCheck = timers++;
|
public final int timerContentCheck = timers++;
|
||||||
|
|
||||||
/** Pump amount, total. */
|
/** Pump amount, total. */
|
||||||
protected float pumpAmount = 1f;
|
protected float pumpAmount = 1f;
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ import io.anuke.mindustry.world.meta.BlockStat;
|
|||||||
* Pump that makes liquid from solids and takes in power. Only works on solid floor blocks.
|
* Pump that makes liquid from solids and takes in power. Only works on solid floor blocks.
|
||||||
*/
|
*/
|
||||||
public class SolidPump extends Pump{
|
public class SolidPump extends Pump{
|
||||||
protected Liquid result = Liquids.water;
|
public Liquid result = Liquids.water;
|
||||||
protected Effect updateEffect = Fx.none;
|
public Effect updateEffect = Fx.none;
|
||||||
protected float updateEffectChance = 0.02f;
|
public float updateEffectChance = 0.02f;
|
||||||
protected float rotateSpeed = 1f;
|
public float rotateSpeed = 1f;
|
||||||
/** Attribute that is checked when calculating output. */
|
/** Attribute that is checked when calculating output. */
|
||||||
protected Attribute attribute;
|
public Attribute attribute;
|
||||||
|
|
||||||
public SolidPump(String name){
|
public SolidPump(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class LiquidSource extends Block{
|
public class LiquidSource extends Block{
|
||||||
private static Liquid lastLiquid;
|
public static Liquid lastLiquid;
|
||||||
|
|
||||||
public LiquidSource(String name){
|
public LiquidSource(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import io.anuke.mindustry.world.modules.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class CoreBlock extends StorageBlock{
|
public class CoreBlock extends StorageBlock{
|
||||||
protected Mech mech = Mechs.starter;
|
public Mech mech = Mechs.starter;
|
||||||
|
|
||||||
public CoreBlock(String name){
|
public CoreBlock(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ import static io.anuke.mindustry.Vars.data;
|
|||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
public class LaunchPad extends StorageBlock{
|
public class LaunchPad extends StorageBlock{
|
||||||
protected final int timerLaunch = timers++;
|
public final int timerLaunch = timers++;
|
||||||
/** Time inbetween launches. */
|
/** Time inbetween launches. */
|
||||||
protected float launchTime;
|
public float launchTime;
|
||||||
|
|
||||||
public LaunchPad(String name){
|
public LaunchPad(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.content;
|
import static io.anuke.mindustry.Vars.content;
|
||||||
|
|
||||||
public class Unloader extends Block{
|
public class Unloader extends Block{
|
||||||
protected float speed = 1f;
|
public float speed = 1f;
|
||||||
protected final int timerUnload = timers++;
|
public final int timerUnload = timers++;
|
||||||
|
|
||||||
private static Item lastItem;
|
private static Item lastItem;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
public class MechPad extends Block{
|
public class MechPad extends Block{
|
||||||
public @NonNull Mech mech;
|
public @NonNull Mech mech;
|
||||||
protected float buildTime = 60 * 5;
|
public float buildTime = 60 * 5;
|
||||||
|
|
||||||
public MechPad(String name){
|
public MechPad(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ import io.anuke.mindustry.world.meta.BlockFlag;
|
|||||||
public class RepairPoint extends Block{
|
public class RepairPoint extends Block{
|
||||||
private static Rectangle rect = new Rectangle();
|
private static Rectangle rect = new Rectangle();
|
||||||
|
|
||||||
protected int timerTarget = timers++;
|
public int timerTarget = timers++;
|
||||||
|
|
||||||
protected float repairRadius = 50f;
|
public float repairRadius = 50f;
|
||||||
protected float repairSpeed = 0.3f;
|
public float repairSpeed = 0.3f;
|
||||||
protected float powerUse;
|
public float powerUse;
|
||||||
protected TextureRegion baseRegion;
|
public TextureRegion baseRegion;
|
||||||
protected TextureRegion laser, laserEnd;
|
public TextureRegion laser, laserEnd;
|
||||||
|
|
||||||
public RepairPoint(String name){
|
public RepairPoint(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class UnitFactory extends Block{
|
public class UnitFactory extends Block{
|
||||||
protected UnitType unitType;
|
public UnitType unitType;
|
||||||
protected float produceTime = 1000f;
|
public float produceTime = 1000f;
|
||||||
protected float launchVelocity = 0f;
|
public float launchVelocity = 0f;
|
||||||
protected TextureRegion topRegion;
|
public TextureRegion topRegion;
|
||||||
protected int maxSpawn = 4;
|
public int maxSpawn = 4;
|
||||||
protected int[] capacities;
|
public int[] capacities;
|
||||||
|
|
||||||
public UnitFactory(String name){
|
public UnitFactory(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ task pack(dependsOn: classes){
|
|||||||
//run generation task; generate all needed sprites
|
//run generation task; generate all needed sprites
|
||||||
file(genFolder).mkdirs()
|
file(genFolder).mkdirs()
|
||||||
javaexec{
|
javaexec{
|
||||||
main = "io.anuke.mindustry.ImagePacker"
|
main = "io.anuke.mindustry.tools.ImagePacker"
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
standardInput = System.in
|
standardInput = System.in
|
||||||
workingDir = genFolder
|
workingDir = genFolder
|
||||||
@@ -310,7 +310,7 @@ task pack(dependsOn: classes){
|
|||||||
}
|
}
|
||||||
|
|
||||||
jvmArgs("-Djava.awt.headless=true")
|
jvmArgs("-Djava.awt.headless=true")
|
||||||
main = "io.anuke.mindustry.Upscaler"
|
main = "io.anuke.mindustry.tools.Upscaler"
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
standardInput = System.in
|
standardInput = System.in
|
||||||
workingDir = "../core/assets-raw/sprites_out/ui/icons"
|
workingDir = "../core/assets-raw/sprites_out/ui/icons"
|
||||||
@@ -351,7 +351,7 @@ task pack(dependsOn: classes){
|
|||||||
task genSprites(dependsOn: classes, type: JavaExec){
|
task genSprites(dependsOn: classes, type: JavaExec){
|
||||||
finalizedBy 'antialiasGen'
|
finalizedBy 'antialiasGen'
|
||||||
|
|
||||||
main = "io.anuke.mindustry.ImagePacker"
|
main = "io.anuke.mindustry.tools.ImagePacker"
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
jvmArgs("-Djava.awt.headless=true")
|
jvmArgs("-Djava.awt.headless=true")
|
||||||
standardInput = System.in
|
standardInput = System.in
|
||||||
@@ -361,7 +361,7 @@ task genSprites(dependsOn: classes, type: JavaExec){
|
|||||||
task updateBundles(dependsOn: classes, type: JavaExec){
|
task updateBundles(dependsOn: classes, type: JavaExec){
|
||||||
file(genFolder).mkdirs()
|
file(genFolder).mkdirs()
|
||||||
|
|
||||||
main = "io.anuke.mindustry.BundleLauncher"
|
main = "io.anuke.mindustry.tools.BundleLauncher"
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
standardInput = System.in
|
standardInput = System.in
|
||||||
workingDir = "../core/assets/bundles/"
|
workingDir = "../core/assets/bundles/"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package io.anuke.mindustry;
|
package io.anuke.mindustry.tools;
|
||||||
|
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.Array;
|
||||||
import io.anuke.arc.collection.OrderedMap;
|
import io.anuke.arc.collection.OrderedMap;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package io.anuke.mindustry;
|
package io.anuke.mindustry.tools;
|
||||||
|
|
||||||
import io.anuke.arc.collection.*;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.graphics.*;
|
import io.anuke.arc.graphics.*;
|
||||||
@@ -6,7 +6,7 @@ import io.anuke.arc.graphics.g2d.*;
|
|||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.noise.*;
|
import io.anuke.arc.util.noise.*;
|
||||||
import io.anuke.mindustry.ImagePacker.*;
|
import io.anuke.mindustry.tools.ImagePacker.*;
|
||||||
import io.anuke.mindustry.ctype.*;
|
import io.anuke.mindustry.ctype.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.ui.*;
|
import io.anuke.mindustry.ui.*;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package io.anuke.mindustry;
|
package io.anuke.mindustry.tools;
|
||||||
|
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.arc.util.Structs;
|
import io.anuke.arc.util.Structs;
|
||||||
import io.anuke.mindustry.ImagePacker.GenRegion;
|
import io.anuke.mindustry.tools.ImagePacker.GenRegion;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package io.anuke.mindustry;
|
package io.anuke.mindustry.tools;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
import io.anuke.arc.collection.ObjectMap;
|
import io.anuke.arc.collection.ObjectMap;
|
||||||
@@ -7,6 +7,7 @@ import io.anuke.arc.graphics.g2d.TextureAtlas.AtlasRegion;
|
|||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.Log.LogHandler;
|
import io.anuke.arc.util.Log.LogHandler;
|
||||||
import io.anuke.arc.util.Log.NoopLogHandler;
|
import io.anuke.arc.util.Log.NoopLogHandler;
|
||||||
|
import io.anuke.mindustry.*;
|
||||||
import io.anuke.mindustry.core.ContentLoader;
|
import io.anuke.mindustry.core.ContentLoader;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
60
tools/src/io/anuke/mindustry/tools/ScriptStubGenerator.java
Normal file
60
tools/src/io/anuke/mindustry/tools/ScriptStubGenerator.java
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
package io.anuke.mindustry.tools;
|
||||||
|
|
||||||
|
import io.anuke.arc.*;
|
||||||
|
import io.anuke.arc.collection.*;
|
||||||
|
import io.anuke.arc.files.*;
|
||||||
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
|
import io.anuke.arc.util.*;
|
||||||
|
import org.reflections.*;
|
||||||
|
import org.reflections.scanners.*;
|
||||||
|
import org.reflections.util.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class ScriptStubGenerator{
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
String base = "io.anuke.mindustry";
|
||||||
|
Array<String> blacklist = Array.with("plugin", "mod", "net", "io", "tools", "gen");
|
||||||
|
Array<String> nameBlacklist = Array.with("ClientLauncher", "NetClient", "NetServer");
|
||||||
|
Array<Class<?>> whitelist = Array.with(Draw.class, Core.class, TextureAtlas.class, TextureRegion.class);
|
||||||
|
|
||||||
|
String fileTemplate = "package io.anuke.mindustry.mod;\n" +
|
||||||
|
"\n" +
|
||||||
|
"import io.anuke.arc.collection.*;\n" +
|
||||||
|
"//obviously autogenerated, do not touch\n" +
|
||||||
|
"class ClassAccess{\n" +
|
||||||
|
"\tstatic final Array<Class<?>> allowedClasses = Array.with($ALLOWED_CLASSES$);\n" +
|
||||||
|
"\tstatic final ObjectSet<String> allowedClassNames = ObjectSet.with($ALLOWED_CLASS_NAMES$);\n" +
|
||||||
|
"}";
|
||||||
|
|
||||||
|
List<ClassLoader> classLoadersList = new LinkedList<>();
|
||||||
|
classLoadersList.add(ClasspathHelper.contextClassLoader());
|
||||||
|
classLoadersList.add(ClasspathHelper.staticClassLoader());
|
||||||
|
|
||||||
|
Reflections reflections = new Reflections(new ConfigurationBuilder()
|
||||||
|
.setScanners(new SubTypesScanner(false), new ResourcesScanner())
|
||||||
|
.setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[0])))
|
||||||
|
.filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix("io.anuke.mindustry"))));
|
||||||
|
|
||||||
|
Array<Class<?>> classes = Array.with(reflections.getSubTypesOf(Object.class));
|
||||||
|
classes.addAll(reflections.getSubTypesOf(Enum.class));
|
||||||
|
classes.addAll(whitelist);
|
||||||
|
classes.sort(Structs.comparing(Class::getName));
|
||||||
|
|
||||||
|
classes.removeAll(type -> type.isSynthetic() || type.isAnonymousClass() || type.isMemberClass() || type.getCanonicalName() == null
|
||||||
|
|| blacklist.contains(s -> type.getName().startsWith(base + "." + s + ".")) || nameBlacklist.contains(type.getSimpleName()));
|
||||||
|
|
||||||
|
StringBuilder result = new StringBuilder("//Generated class. Do not modify.\n");
|
||||||
|
for(Class type : classes){
|
||||||
|
result.append("const ").append(type.getSimpleName()).append(" = ").append("Java.type('").append(type.getCanonicalName()).append("')\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Log.info(result);
|
||||||
|
|
||||||
|
new FileHandle("core/assets/scripts/global.js").writeString(result.toString());
|
||||||
|
new FileHandle("core/src/io/anuke/mindustry/mod/ClassAccess.java").writeString(fileTemplate
|
||||||
|
.replace("$ALLOWED_CLASSES$", classes.toString(", ", type -> type.getName() + ".class"))
|
||||||
|
.replace("$ALLOWED_CLASS_NAMES$", classes.toString(", ", type -> "\"" + type.getName() + "\"")));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package io.anuke.mindustry;
|
package io.anuke.mindustry.tools;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.FileHandle;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package io.anuke.mindustry;
|
package io.anuke.mindustry.tools;
|
||||||
|
|
||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.backends.sdl.*;
|
import io.anuke.arc.backends.sdl.*;
|
||||||
Reference in New Issue
Block a user