I've made a custom WoodStorage that canhold a few logs and planks. I've appointed it to Contianer_Base and also tried DeployableContainer_Base to verify that I'm not doing anytrhing wrong.
I get a NULL pointer in the CanReveiveAttachment bool as I insert a WoodenLog into the slots.
override bool CanReceiveAttachment(EntityAI attachment, int slotId) { PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() ); EntityAI item_in_hands = player.GetHumanInventory().GetEntityInHands(); if (item_in_hands != NULL) { if (!super.CanReceiveAttachment(attachment, slotId)) { return false; } if (item_in_hands && item_in_hands.IsKindOf("WoodStorage")) { return false; } } return true; }
Also made it that if you carry the WoodStorage , that you cannot fill it up with logs using this line:
if (item_in_hands && item_in_hands.IsKindOf("WoodStorage")) { return false;
Error in the crashlog say:
NULL pointer to instance Class: 'WoodStorage' Entity id:2970718 Function: 'CanReceiveAttachment' Stack trace: DO_WoodStorage\Scripts\4_World/woodstorage\woodstorage.c:24 <-Line 24 is the Entity_AI item_in_hands line