public override int onThrow(ShapeBase player, int amount) { if (amount == 0) amount = 1; if (this["maxInventory"] != string.Empty) { if (amount > this["maxInventory"].AsInt()) amount = this["maxInventory"].AsInt(); } if (amount == 0) return 0; player.decInventory(this, amount); TransformF rot = new TransformF(player.getEulerRotation()); ObjectCreator tc_obj = new ObjectCreator("AITurretShape", string.Empty); tc_obj["datablock"] = this.getName(); tc_obj["rotation"] = "0 0 1 " + rot.mPositionZ; tc_obj["count"] = "1"; tc_obj["sourceObject"] = player; tc_obj["client"] = player["client"]; tc_obj["isAiControlled"] = true; AITurretShape obj = tc_obj.Create(); ((SimSet) "MissionGroup").pushToBack(obj); //todo change to csharp obj.addToIgnoreList(player); GameConnection client = player["client"]; if (client.isObject()) { if (client["ownedTurrets"] == string.Empty) client["ownedTurrets"] = new ObjectCreator("SimSet", string.Empty).Create().AsString(); SimSet SimSet_id = client["ownedTurrets"]; int countofitems = SimSet_id.getCount(); for (uint i = 0; i < countofitems; i++) { AITurretShape turret = SimSet_id.getObject(i); turret.addToIgnoreList(obj); obj.addToIgnoreList(turret); } SimSet_id.pushToBack(obj); } return obj; }
public override int onThrow(ShapeBase player, int amount) { if (amount == 0) { amount = 1; } if (this["maxInventory"] != string.Empty) { if (amount > this["maxInventory"].AsInt()) { amount = this["maxInventory"].AsInt(); } } if (amount == 0) { return(0); } player.decInventory(this, amount); TransformF rot = new TransformF(player.getEulerRotation()); ObjectCreator tc_obj = new ObjectCreator("AITurretShape", string.Empty); tc_obj["datablock"] = this.getName(); tc_obj["rotation"] = "0 0 1 " + rot.mPositionZ; tc_obj["count"] = "1"; tc_obj["sourceObject"] = player; tc_obj["client"] = player["client"]; tc_obj["isAiControlled"] = true; AITurretShape obj = tc_obj.Create(); ((SimSet)"MissionGroup").pushToBack(obj); //todo change to csharp obj.addToIgnoreList(player); GameConnection client = player["client"]; if (client.isObject()) { if (client["ownedTurrets"] == string.Empty) { client["ownedTurrets"] = new ObjectCreator("SimSet", string.Empty).Create().AsString(); } SimSet SimSet_id = client["ownedTurrets"]; int countofitems = SimSet_id.getCount(); for (uint i = 0; i < countofitems; i++) { AITurretShape turret = SimSet_id.getObject(i); turret.addToIgnoreList(obj); obj.addToIgnoreList(turret); } SimSet_id.pushToBack(obj); } return(obj); }