245 {
246 if( w == null )
247 {
248 return false;
249 }
250
252 if( !player.CanManipulateInventory() )
253 {
254 return false;
255 }
256
258
259 if( !item )
260 {
261 return false;
262 }
263
264 if( !item.GetInventory().CanRemoveEntity() )
265 {
266 return false;
267 }
268
269 int color, c_x, c_y;
270
271 #ifdef PLATFORM_CONSOLE
272 int idx = -1;
273 #else
274 int idx = 0;
275 #endif
276
278 if( cargo )
279 {
282 }
283
284 InventoryLocation dst = new InventoryLocation;
285 #ifdef PLATFORM_CONSOLE
289 #else
290 dst.
SetCargoAuto(cargo, item,
x,
y, item.GetInventory().GetFlipCargo());
291 #endif
292
293 #ifdef PLATFORM_CONSOLE
294 if( dst.
IsValid() &&
m_Entity.GetInventory().LocationCanAddEntityEx(dst))
295 #else
296 if(
m_Entity && c_x >
x && c_y >
y &&
m_Entity.GetInventory().LocationCanAddEntityEx(dst))
297 #endif
298 {
299 ItemManager.GetInstance().HideDropzones();
301 {
302 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
303 }
304 else
305 {
306 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
307 }
308 color = ColorManager.GREEN_COLOR;
309 }
310 else
311 {
312 color = ColorManager.RED_COLOR;
313 ItemManager.GetInstance().ShowSourceDropzone( item );
314 }
315
316 if( w.FindAnyWidget("Cursor") )
317 {
318 w.FindAnyWidget("Cursor").SetColor( color );
319 }
320 else
321 {
322 string name = w.GetName();
323 name.Replace(
"PanelWidget",
"Cursor" );
324 if( w.FindAnyWidget(
name ) )
325 {
326 w.FindAnyWidget(
name ).SetColor( color );
327 }
328 }
329
330 return true;
331 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
FindInventoryLocationType
flags for searching locations in inventory
proto native int GetItemCount()
proto native int GetWidth()
proto native int GetHeight()
EntityAI GetItemPreviewItem(Widget w)
proto native bool IsValid()
verify current set inventory location
proto native void SetCargoAuto(notnull CargoBase cargo, EntityAI e, int row, int col, bool flip)
based on Cargo.IsProxyCargo uses SetProxyCargo or SetCargo respectively
proto native CGame GetGame()