3 static string SEL_WIRE_ROLLED =
"rolled";
4 static string SEL_WIRE_PREFIX =
"Att_";
5 static string SEL_WIRE_SUFIX =
"_plugged";
6 static string SEL_PLUG_SUFIX =
"_plug";
15 if (!super.CanPutAsAttachment(parent))
23 if ( battery_owner && !battery_owner.IsInherited(
PlayerBase) )
32 void UpdateAllSelections()
35 EntityAI energy_source = GetCompEM().GetEnergySource();
39 string ES_model = energy_source.GetModelName();
40 EntityAI powered_device = GetCompEM().GetPluggedDevice();
45 string selection_wire = SEL_WIRE_PREFIX + ES_model + SEL_WIRE_SUFIX;
46 ShowSelection(selection_wire);
49 string selection_plug = SEL_WIRE_PREFIX + ES_model + SEL_PLUG_SUFIX;
50 selection_plug.ToLower();
51 ShowSelection(selection_plug);
54 int selection_index = GetHiddenSelectionIndex(selection_plug);
55 string texture_path = powered_device.GetCompEM().GetCordTextureFile();
56 SetObjectTexture( selection_index, texture_path );
61 string selection_wire2 = SEL_WIRE_PREFIX + ES_model;
62 ShowSelection(selection_wire2);
67 ShowSelection(SEL_WIRE_ROLLED);
74 super.OnInventoryEnter( player );
77 Class.CastTo( player_PB, player );
78 if ( player_PB.GetItemInHands() ==
this && GetCompEM().IsPlugged() )
87 GetCompEM().UnplugAllDevices();
89 if ( !player_PB.IsPlacingLocal() )
91 GetCompEM().UnplugThis();
97 override void OnIsPlugged(
EntityAI source_device)
99 UpdateAllSelections();
103 override void OnIsUnplugged(
EntityAI last_energy_source)
105 UpdateAllSelections();
106 GetCompEM().UnplugAllDevices();
110 override void OnOwnSocketTaken(
EntityAI device )
112 UpdateAllSelections();
116 override void OnOwnSocketReleased(
EntityAI device )
118 UpdateAllSelections();