Screeps:有没有办法为容器设置属性?
Screeps: Is there a way to set properties to a container?
我正在尝试为我的容器结构设置库存过滤器。我不确定如何写入结构内存。
只存在一个内存对象"Memory"
如果您有房间,例如,room.memory 只是
的 shorthand
Memory.rooms[roomName]
以同样的方式,您可以像这样为容器创建自己的内存:
let container = myContainer
if (!Memory.objects) Memory.objects = { } // init memory
if !(container.id in Memory.objects) Memory.objects[container.id] = { }
let containerMemory = Memory.objects[container.id]
我正在尝试为我的容器结构设置库存过滤器。我不确定如何写入结构内存。
只存在一个内存对象"Memory"
如果您有房间,例如,room.memory 只是
的 shorthandMemory.rooms[roomName]
以同样的方式,您可以像这样为容器创建自己的内存:
let container = myContainer
if (!Memory.objects) Memory.objects = { } // init memory
if !(container.id in Memory.objects) Memory.objects[container.id] = { }
let containerMemory = Memory.objects[container.id]