52 *delete_block = not pile_inv->
Get(
this);
62 case IRON:
return tr(
"Locker");
63 case WATER:
return tr(
"Fridge");
64 default:
return tr(
"Chest (%1)").arg(
SubName(
Sub()));
91 Box::Box(QDataStream & str,
const int kind,
const int sub) :
125 *delete_block =
true;
142 default:
return tr(
"Box (%1)").arg(
SubName(
Sub()));
160 for (
int i=0; i<
Start(); ++i) {
167 int materials_number = 0;
181 for (
int i=0; i<list.
size(); ++i) {
182 for (
int n=0; n<list.
at(i)->
num; ++n) {
193 if ( inv_to ==
nullptr
195 || dest >= inv_to->
Size()
200 for (
int i=0; i<num; ++i) {
201 if ( not inv_to->
Get(
ShowBlock(src), dest) )
return false;
203 if ( src <
Start() ) {
221 case WOOD:
return tr(
"Workbench");
222 default:
return tr(
"Anvil (%1)").arg(
SubName(
Sub()));
227 return (
Number(slot_number) > 0 ) ?
229 tr(
"-product-") : tr(
"-material-");
294 return (
Number(slot_number) == 0 ) ?
304 for (
int i=
Size()-1; i>=0; --i) {
306 if ( block !=
nullptr ) {
336 case STONE: name = tr(
"Furnace");
break;
344 qDebug(
"%s: sub ?: %d.", Q_FUNC_INFO,
Sub());
376 case STONE:
switch ( sub ) {
378 case WOOD:
return 50;
Inventory * HasInventory() overridefinal
usage_types Use(Block *who) override
const int MAX_DURABILITY
10 bits to store durability in file, signed.
QString FullName() const override
virtual void SaveAttributes(QDataStream &) const
void DeleteBlock(Block *) const
Does not actually delete normal blocks.
Container is multi-purpose container for blocks.
BlockManager block_manager
static QString SubName(int sub)
Returns translated substance name.
inner_actions ActInner() override
World provides global physics and shred connection.
virtual void Damage(int dmg, int dmg_kind)
void Damage(int dmg, int dmg_kind) override
Block * Normal(int sub) const
Use this to receive a pointer to normal block.
virtual int Weight() const
bool GetAll(Inventory *from) override
Returns true on success.
void ReceiveSignal(QString) override
void DoRareAction() override
virtual bool Get(Block *block, int start=0)
Returns true on success.
int ShouldAct() const override
QString InvFullName(int slot_number) const override
static sub_groups GetSubGroup(int sub)
virtual Inventory * HasInventory()
Block * DropAfterDamage(bool *delete_block) override
Should return dropped block.
int DamageKind() const override
Block * ShowBlock(int slot) const
void ReceiveSignal(QString) override
Receive text signal.
void RemShining(Active *)
QString FullName() const override
virtual bool GetAll(Inventory *from)
Returns true on success.
int Start() const override
int Weight() const override
Container(int kind, int sub, int size=INV_SIZE)
void Shine(int x, int y, int z, int level)
If init is false, light will not spread from non-invisible blocks.
inner_actions
See Shred::PhysEventsRare() for details.
void ReceiveSignal(QString) override
Receive text signal.
int ShouldAct() const override
push_reaction PushResult(dirs) const override
Block * GetBlock(int x, int y, int z) const
virtual int DamageLevel() const
int LightRadius() const override
damage_kinds damageKindOn
CraftItem * at(int item_position) const
void Damage(int dmg, int dmg_kind) override
virtual bool GetExact(Block *block, int num)
Returns true if block found its place.
bool Drop(int src, int dest, int num, Inventory *inv) override
Returns true on success.
static Block * NewBlock(int kind, int sub)
Use this to receive a pointer to new not-normal block.
void SaveAttributes(QDataStream &out) const override
void DoRareAction() override
damage_kinds damageKindOff
virtual int Weight() const
QString FullName() const override
void Damage(int dmg, int dmg_kind) override
void DestroyAndReplace(int x, int y, int z)
Does not check target block durability.
Workbench(int kind, int sub)
bool Craft(CraftList *items, int sub) const
void Push(int x, int y, int z, int push_direction)
void Pull(int num)
Removes block from inventory. Does not delete block.
void SaveAttributes(QDataStream &out) const override
bool Get(Block *block, int start) override
Returns true on success.
Provides block ability to contain other blocks inside.
int ConvertRatio(int sub) const
Shred * GetShred(int i, int j) const
usage_types Use(Block *who) override
int Damage(int x, int y, int z, int level, int dmg_kind)
Returns damaged block result durability.
const int CONVERTER_LIGHT_RADIUS
Inventory * HasInventory() overridefinal
int GetDurability() const
void Break()
Set durability to null.
This class represents craft recipe.
QString FullName() const override
QString InvFullName(int slot_number) const override
Converter(int kind, int sub)
void AddShining(Active *)
const CraftManager * craft_manager
inner_actions ActInner() override
Block without special physics and attributes.
virtual QString InvFullName(int num) const
virtual void SaveAttributes(QDataStream &out) const
void SaveAttributes(QDataStream &) const override
Block * DropAfterDamage(bool *delete_block) override
Should return dropped block.
int ShouldAct() const override
void SaveAttributes(QDataStream &out) const override