public override void BlockInteraction(Vector3i pos, Quaternion rot, VehicleComponent vehicle, Inventory inv = null)
 {
     if (this.enabled)
     {
         AtomicActions.HarvestPlantNow(  // Create a pack, fill it with harvest actions and try to perform.
             harvestTo:    inv,
             reapableOnly: false,        // Harvest every plant.
             context:      new MultiblockActionContext()
         {
             Player            = vehicle.Driver,
             ToolUsed          = this,
             ActionDescription = Localizer.DoStr("harvest plant"),
             Area = area.MoveAndRotate(pos, rot)                  // Rotate area of effect and shift it to current position (and exclude repetitions from the result).
         });
     }
 }
Пример #2
0
        public override InteractResult OnActLeft(InteractionContext context)
        {
            // Try harvest.
            if (context.HasBlock && context.Block.Is <Reapable>())
            {
                return((InteractResult)AtomicActions.HarvestPlantNow(this.CreateMultiblockContext(context), context.Player?.User.Inventory));
            }

            // Try interact with a world object.
            if (context.Target is WorldObject)
            {
                return(this.BasicToolOnWorldObjectCheck(context));
            }

            // Fallback.
            return(base.OnActLeft(context));
        }