- Change
game::inter_shard_memory
functions to avoid panicking on private servers where the interface doesn't exist - Change
game::inter_shard_memory::get_local
andget_remote
to returnOption<String>
, accounting for cases where they have not been set (breaking) - Add
AccountPowerCreep::cancel_delete
, which allows cancelling pending deletion of a power creep - Add
StructureType::controller_structures
, which translates theCONTROLLER_STRUCTURES
constant, the number of each structure allowed at a given RCL - Update
constants::stronghold_rampart_hits
function with updated values from rebalancing - Add missing
constants::MARKET_MAX_ORDERS
,constants::MARKET_ORDER_LIFE_TIME
, andconstants::HARVEST_DEPOSIT_POWER
- Remove
constants::INVADER_CORE_EXPAND_TIME
, replaced by per-levelconstants::invader_core_expand_time
- Corrected value of
constants::RAMPART_HITS_MAX_RCL5
andconstants::POWER_SPAWN_HITS
- Add the
parse_display::Display
trait to type constant enums which currently implementparse_display::FromStr
, allowing reversal of the conversion from native to constant string - Fixed
Position::get_direction_to
which always returned the opposite of what it should - Fixed deserialization of
EVENT_POWER
andEVENT_TRANSFER
events - Add new
IntershardResourceType::CPUUnlock
,IntershardResourceType::Pixel
, andIntershardResourceType::AccessKey
resources - Add
game::cpu::generate_pixel
andconstants::PIXEL_CPU_COST
- Add the ability to mark a room as impassable when using the pathfinder. Converts callback
functions for room cost to use
SingleRoomCostResult
andMultiRoomCostResult
as appropriate. - Update
PIXEL_CPU_COST
to match game balance change.
- Remove deprecated
game::map::is_room_available
, use newget_room_status
instead - Move creep functions which are implemented identically on power creeps to
SharedCreepProperties
trait - Update integer representation of
IntershardResource::SubscriptionToken
to move out of conflict with normal resources to allow parsing market orders which might have either - Update
game::market
functions to be able to work with intershard orders and transactions for them, makingRoomName
optional in many cases as it's not used for intershard transactions - Update field visibility on
game::market
structs used as return values to public, update to native types forResourceType
andRoomName
values, and make a number of fields optional for compatibility with intershard orders - Update
game::market::create_order
to use the currently documented object syntax and newMarketResourceType
to specify resource - Update
game::market::calc_transaction_cost
to work withRoomName
instead of&Room
to avoid requiring visibility of both rooms - Change
game::map::describe_exits
to useRoomName
instead ofString
for values - Remove
StructurePowerSpawn::power
andpower_capacity
(replaced withHasStore
functions) - Remove explicitly implemented
Creep::energy
function which used deprecated.carry
, now using theenergy
implementation fromHasStore
- Change
RoomObjectProperties::room
to returnOption<Room>
to handle the cases that the base game API leaves it undefined: for construction sites and flags in non-visible rooms - Add
MarketResourceType
enum, which can wrap either aResourceType
orIntershardResourceType
and switch to using it forgame::market
endpoints which accept either type - Change
StructureTerminal::send
to take the destination room name asRoomName
instead of&str
- Change
game::market::get_all_orders
to accept anOption<MarketResourceType>
as a filter since this is optimized in the server code - Change
HasStore::store_free_capacity
to returni32
, handling potential negative values due to expiration ofOPERATE_STORAGE
- Change
constants::GCL_POW
to f64 from f32 due to slightly incorrect calculations when using this from f32 to calculate GCL levels - Remove explicit
ticks_to_decay
implementations onStructureContainer
andTombstone
, use the implementation onCanDecay
instead - Change
game::cpu::limit
,tick_limit
,bucket
,shard_limits
, andset_shard_limits
to useu32
fromf64
- Add
RoomVisual
, rendering primitives (Circle
,Line
,Rect
,Poly
,Text
). - Add Visual rendering primitive enum for storage and batching.
- Add
MoveToOptions::visualize_path_style
to allow for path visualization of movement system. - Add
ResourceType::reaction_components
function translating theREACTIONS
constant - Add
ResourceType::commodity_recipe
function andFactoryRecipe
struct translating theCOMMODITIES
constant - Add
ResourceType::boost
function translating theBOOSTS
constant - Add
game::map::get_room_status
as interface to newGame.map.getRoomStatus
function - Add
StructureLab::reverse_reaction
as interface to newreverseReaction
- Add
effects
to room objects, allowing access to the effects applied on room objects which are used by both strongholds and power creeps. NewEffectType
enum returned by this call represents theNaturalEffectType
(for stronghold effects) orPowerType
(for power creeps) - Add
game::gpl::level
,game::gpl::progress
andgame::gpl::progress_total
- Add
StructureController::is_power_enabled
- Add
game::power_creeps
access, which returns a specialAccountPowerCreep
reference due to the fact that these power creeps may not be spawned on the current shard and allow spawning. UseAccountPowerCreep::get_power_creep
which returnsOption<PowerCreep>
to get the living power creep, if spawned on the current shard. - Add
PowerCreepClass
enum to represent power creep classes, currently onlyOperator
- Add
game::market::get_history
andgame::market::OrderHistoryRecord
exposing newgetHistory
API function - Add
Creep::move_pulled_by
which allows a creep to accept another creep's attempt topull
- Add
SearchOptions::max_cost
to limit the maximum path cost for pathfinder searches - Add
RoomTerrain::get_raw_buffer_to_array
to load a room's terrain into an existing[u8; 2500]
- Add
game::gcl::total_for_level
andgame::gpl::total_for_level
which calculate the total lifetime points required for a given level of GCL or GPL - Add
CostMatrixSet
trait to allow applying costs to a cost matrix generically.
- Fix
Room::find_path
function call to underlying javascript - Fix typo in
Position::create_named_construction_site
and work around screeps bug inRoom::create_named_construction_site
by passing x and y instead of position object - Fix javascript associated object name for
StructureSpawn::spawning
- Correct swapped return types for
Mineral::density
andMineral::mineral_amount
and add a workaround for some private servers returning floating pointmineralAmount
values - Fix typo in
StructureController::reservation
ticks_to_end return value - Fix reversed conversion of
TOUGH
andHEAL
parts - Fix
OwnedStructureProperties::has_owner
to correctly return false for unowned structures - Work around a case where
map::describe_exits
would panic when a private server returns null for an unavailable room - Change
Source
andMineral
ticks_to_regeneration
functions to return 0, preventing panics in cases where the game API returns negative or undefined values - Fix visibility of struct fields on
MapRoomStatus
andRoomRouteStep
- Add
total_available_size
field togame::cpu::HeapStatistics
- Add missed
StructureFactory::level
function to determine a factory's level (orNone
if a power creep has not yet usedOPERATE_FACTORY
) - Change
pathfinder::search_many
to return an incomplete result when called with no goals to prevent a panic due to unexpected return data from javascript. - Change
MemoryReference::get
to return a generic error type - Change
StructureLab::mineral_type
to returnOption<ResourceType>
, avoiding panic when labs are empty
- Update
StructureTower::attack
andheal
to allow targeting power creeps, and updaterepair
to acceptStructureProperties
matchingCreep::repair
- Update
Creep::heal
andranged_heal
to target anything with theSharedCreepProperties
trait to allow use on power creeps
- Remove
CanStoreEnergy
trait, moving all structures and creeps toHasStore
, migrating from deprecated Screeps API endpoints to new.store
API (breaking)- Remove
Creep::carry_total
,Creep::carry_types
,Creep::carry_of
- Remove
StructureLab::mineral_amount
,StructureLab::mineral_capacity
- Remove
StructureNuker::ghodium
,StructureNuker::ghodium_capacity
- Change
HasStore::store_capacity
to use new API and now takesOption<ResourceType>
- Add
HasStore::store_free_capacity
andHasStore::store_used_capacity
, which both takeOption<ResourceType>
- Remove
- Change return type of
game::rooms::keys
fromVec<String>
toVec<RoomName>
- Change
HasCooldown
trait to apply to objects withRoomObjectProperties
instead ofStructureProperties
due to addition ofDeposit
objects - Fix
Position::in_range_to
to be inclusive, to match documentation and JS behavior
- Add new
StructureFactory
andStructureInvaderCore
structure types - Add a number of new constants related to factory operation and strongholds
- Add new resource types for factory commodities
- Add
Deposit
objects and related find/look constants - Add
Ruin
objects and related find/look constants - Change
Creep.harvest
to work with any harvestable object type;Deposit
,Mineral
, andSource
- Add
ObjectId<T>
, a typed binary object ID, andRawObjectId
, an untyped binary object ID- untyped ids can be converted to typed freely - the type is purely for type inference
RoomObject::id
now returnsObjectId<Self>
, and anuntyped_id
function is added for retrieving an untyped idgame::get_object_typed
now takesObjectId<T>
, andgame::get_object_erased
is now generic, taking either id type- both types are 12 bytes large, and can represent all hex-formatted object IDs from the official server, the default private servers backend and the private server with ags131's mongodb mod
- Add support for accessing intershard resource amounts, which currently only includes subscription
tokens, under
game::resources
. - Implement
PartialOrd
andOrd
forPosition
,RoomName
,RawObjectId
andObjectId
. See documentation for ordering specifications.
- Fix typos in JavaScript code for
game::market::get_order
andNuke::launch_room_name
- Fix
Creep::body
crashing if body contained non-boosted parts - Fix JS syntax error in
Creep::move_to_with_options
- Remove usage of internal
stdweb
macros, which break with stdweb version changes - Rename incorrectly spelled
Density::probabilitiy
toprobability
. - Rename incorrectly spelled
Nuke::lauch_room_name
tolaunch_room_name
. - Rename constants with typo
SPAWN_RENEW_RATION
andLINK_LOSS_RATION
toSPAWN_RENEW_RATIO
andLINK_LOSS_RATIO
respectively
- Add a number of modules grouping constants together, such as
constants::creep
for creep related constants orconstants::minerals
for mineral related constants. - Remove remaining usages of internal
get_from_js!
macro, as it was minimally useful - Improve syntax and consistency of some internal macros
- Change
LocalRoomName
's orientation so that north is negative and south is positive. This is a breaking change forLocalRoomName::from_coords
, fields and add/sub implementations (#200) - Rework
LocalRoomPosition
to use a singleu32
as its representation, matching the Screeps' server's optimizations, and implement math utilities for it. (#203)LocalRoomPosition
, nowPosition
, implementsAdd<(i32, i32)>
for altering world coordinates, and has methods likefrom_world_coords
andworld_coords
. SeePosition
documentation.
- Merge
LocalRoomPosition
andRoomPosition
into one efficient, local,Position
type. (#206)- Game methods dealing with coordinates now take something which can produce a local
Position
, and will only have to upload a singleu32
to JavaScript to call it. Position
methods dealing with math between positions are now implemented in pure-Rust code- An alias
type RoomPosition = Position;
has been added to reflect the JS API
- Game methods dealing with coordinates now take something which can produce a local
- Rename
LocalRoomName
toRoomName
, use in APIs, and optimize representation:- It is now a 16-bit sized structure, one very efficient to get from a
Position
(#209) - It's now used in all API bindings referencing room names (#217)
- It is now a 16-bit sized structure, one very efficient to get from a
- Make
StructureSpawn::spawning
anOption<Spawning>
to reflect reality - Fix prices returned from
game::market
APIs being integers rather than floats (breaking) (#179) - Use
OrderType
rather thanString
fororder_type
fields ofTransactionOrder
,Order
andMyOrder
. (breaking) (#213) - Work around bug where IntelliJ-Rust didn't understand
screeps::game::*
modules created by a macro, even with experimental engine enabled (#197) OwnedStructureProperties
'smy
method now correctly handles the value being undefined. This fixes a panic on checkingmy
for unowned controllers (#189)StructurePortal
no longer implementsOwnedStructure
andAttackable
. (#190)- Collections provided by
Game
now implement thehashmap
function to retrieve both keys and values at once. (#194) - Allow accessing fields of the
Bodypart
struct. (#215) - Implement
Clone
forStructure
- Update
screeps::game::market::OrderType
derives to match other constants changed in the constants overhaul last update (#213) - Split cargo-screeps out into a separate repository
- Mark most constant functions as inlinable (#221)
- Misc. documentation improvements.
- Add
game::cpu::halt
binding forGame.cpu.halt
(#210) - Add
Creep::pull
binding forCreep.pull
(#210)
Serialize
andDeserialize
format changed for most constants and forLocalRoomPosition
(breaking)- constants now always serialize as integers (see the module doc) (#164)
LocalRoomPosition
will now serialize differently depending on whether the format is readable (see theLocalRoomPosition
doc) (#171)
constants-serde
feature removed in favor of always implementing Serialize and Deserialize for constants. (#164)- Add methods for retrieving coords from
RoomPosition
(#145) - Implement
Hash
for most constants (#148) - Add equality checking between strings and
LocalRoomName
(#149) - Add
raw_memory::drop_segment
(#160) - Add
inter_shard_memory
(#163) - Change
MemoryReference::get
andget_path
to returnOption<T>
(breaking) (#169) - Add
Display
implementations forDirection
andLocalRoomPosition
- Fix visibility of
LocalRoomNameParseError
,Bodypart
,MoveToOptions
andPortalDestination
(#134) - Fix
Creep::get_active_bodyparts
(#147) - Fix
CostMatrix
upload method (#150) - Fix typos in
StructureController
getters (#151) - Fix
RoomPosition::try_from
conversion (#152) - Fix errors on successful flag creation (#157)
- Fix
ConstructionSite::structure_type
,Mineral::mineral_type
andStructureLab::mineral_type
(#173) - Change many
StructureController
properties toOption
s to reflect reality (breaking) (#162) - Migrate to Rust 2018 (#161)
- Improve code reuse and reduce total amount of code (#164, #166, #175)
Thanks to @ASalvail, @Dessix and @mettke for contributing to this release.
- Allow simulation room when using local room names (#106)
- Add
Room::look_for_at_xy
(#104) - Take
&T
inRoom::create_construction_site
andlook_for_at
rather thanT
forT: HasPosition
(breaking) (#105) - Remove unnecessary allocation from PathFinder and Room.find calls (#112)
- Add
Neg
implementation forDirection
allowing unary minus to reverse direction (#113) - Add
JsVec
structure for transparently wrapping typed JavaScript arrays without immediately unwrapping them. (#114) - Switch to
num-derive
for deriving number->enum transitions (previouslyenum-primitive
) (#116) - Fix inability to decode
Structure
at all (#119) - Remove
Sized
bound onRoomObjectProperties
and addSizedRoomObject
trait - Add utility methods for turning
Structure
intoOption<&SomeTrait>
for a variety of traits - for instance, seeas_attackable()
(#122) - Fix constant name
DROPPED_RESOURCES
(previously:DROPPED_RESOUCES
) (#126) - Remove
Attackable
implementation forStructure
(StructureController
andStructurePortal
are not attackable). Useas_attackable()
instead. (#129)
- Implement Serialize and Deserialize for constants under
constants-serde
feature flag (#69) - Fix Tombstone::get_position_at (#70)
- Remove duplicate Tombstone::id property (#70)
- Implement September 2018 update (#71)
- Replace old terrain APIs with game::map::get_room_terrain
- Add event API
- Add support for named construction sites on RoomPosition
- Add support for
findRoute
andfindExit
(#76) - Add full support for Creep::body (#78)
- Add support for
moveTo
options (#80) - Replace all usages of u8 for in-room positions with u32 (#80)
- Remove duplicate properties on StructureSpawn (#82)
- Use u32 for everything non-negative (#83)
- Add StructureSpawn::spawning property (#86)
- Replace use-once builder with more standard options struct in
StructureSpawn::spawn
(#86) - Add look, lookAt, lookAtArea support (#87)
- Add MemoryReference::get, get_path for retrieving arbitrary types from memory (#96)
- Fix unconditional error in
find_in_range
,find_closest_by_range
bindings (#99) - Unbreak
mem_get!
macro broken in last release (#102) - Rename
Density
enum variants to removeDensity
prefix (#101) - Make various API functions take
Copy
types by value rather than by reference (#101)
- Remove
Reservation
andSign
structures from prelude (breaking) - Add
Eq
,PartialEq
implementations to everything which has an ID, as well asRoom
- Implement
RawMemory
get
andset
support - Create CONTRIBUTING document
- Change all
TryFrom
implementations to perform type checks rather than making assumptions. - Implement
ReferenceType
for all reference wrapping structures - Add traits
ExpectedTypeInto
andExpectedTypeFrom
for convertingstdweb::Value
s to typed structures with or without type checks depending onscreeps-game-api
's feature flags- Add feature
check-all-casts
which is off by default and when enabled adds type checks toExpectedTypeFrom
conversions
- Add feature
- Create enum
Density
rather than havingDENSITY_LOW
,_MODERATE
,_HIGH
and_ULTRA
constants (breaking) - Implement support for APIs:
RawMemory.get
,set
Game.map.findExit
Game.market.*
Game.notify
Creep.drop
,owner.username
,moveByPath
,notifyWhenAttacked
,saying
Flag.remove
,setColor
,setPosition
Mineral.density
,mineralAmount
,mineralType
,ticksToRegeneration
Nuke.launchRoomName
,timeToLand
Room.serializePath
,deserializePath
,findExitTo
,getPositionAt
,findPath
,memory
,findPathTo
RoomPosition.isEqualTo
acceptingx
/y
parametersStructureController.activateSafeMode
,unclaim
StructureKeeperLair.ticksToSpawn
StructureLab.mineralAmount
,mineralCapacity
,mineralType
,boostCreep
,runReaction
StructureLink.transferEnergy
StructureNuker.ghodium
,ghodiumCapacity
,launchNuke
StructureObserver.observeRoom
StructurePortal.destination
StructurePowerBank.power
StructurePowerSpawn.processPower
StructureRampart.setPublic
StructureSpawn.memory
,recycleCreep
,renewCreep
StructureTerminal.send
StructureTower.attack
,heal
,repair
- Rename
get_object
toget_object_erased
and add support forget_object_typed
directly fetching a room object knowing its type (breaking) - Add support for fetching and setting memory keys by path using lodash
- Rename memory
num
method tof64
andint
toi32
- Add
mem_get!
andmem_set!
macros for compile-time memory path interpretation. - Rename
owner
methods toowner_name
- Fix
Creep.signController
type signature - Fix
Room.findClosestByRange
type signature - Add trait
HasId
representing things which have ids (allRoomObject
s exceptFlag
s)- Move
id
methods from individual structures to this structure (breaking)
- Move
- Add traits
CanStoreEnergy
,HasCooldown
,CanDecay
,Withdrawable
,Attackable
- Move
hits
andhitsMax
bindings fromStructureProperties
trait toAttackable
trait (breaking) - Re-export
stdweb::unstable::{TryFrom, TryInto}
intraits
module
Thanks to @ASalvail for planning and implementing the vast majority of this release!
- Add support for StructureController (thanks @ASalvail!)
- Work around Rust bug appearing in latest nightly (rust-lang/rust#53140)
- Bump to 0.1.0 so we can create bugfix releases such as this one which do not contain breaking changes.
- Add ReturnCode::as_result
- Add
MemoryReference::from_reference_unchecked
- Support ConstructionSite properties
- Support
Room::look_for_at_area
- Make 'Structure' type an enum rather than opaque reference
- Add
LocalRoomPosition::remote
shorthand
- Add string access API to Memory
- Implement PathFinder interface
- Implement Serialize/Deserialize for LocalRoomPosition
- Add LocalRoomName structure
- Change time to unsigned integers
- Add
StructureSpawn::is_spawning
- Add
RoomPosition::local
utility - Fix HeapStatistics field names
- Fix console.error hack (see cargo-screeps changes)
- Hotfix for code so it compiles
- Add tombstone support
- Add reaction_time constant calculation method
- Support
v8_getheapstatistics
- Replace some
get_from_js!()
calls with manual functions - Switch from using .0 to .as_ref() to refer to inner Reference of wrapping objects
- Add support for creating construction sites and flags
- Add Source support
- Add support for spawning creeps
- Make methods of traits have default impls, instead of using macros to implement them
- Fix crates.io distribution to include javascript files
- Fix crates.io distribution to include Web.toml
- No notable changes
- No notable changes
- Initial release