void RegisterMultiblockBuilder(Multiblock.Materials materials, Multiblock.Builder builder) { foreach (var placement in materials.Placements) { this.MultiblockBuilders[placement] = builder; } }
/// this method build multiblock machine in place of placements blocks. /// fustrum - get that form ModCheckForCompletedMachineParameters /// blocks - all the positions machine should occupy /// contolPosition - position of the control block. It is important for reusing code of existing machines /// method does not check if given positions are filled with placement blocks, but they should at least be /// loaded into world /// use this method as foundation for implementing Builder interface (if BoxBuilder doesn't suit your needs) public static void Build( WorldFrustrum frustrum, IEnumerable <Position> blocks, Materials materials, Position controlPosition, Orientation orientation) { // Player builds with placement blocks, filler and control appear instead of them. WorldScript.mLocalPlayer.mResearch.GiveResearch(materials.Control.Type, materials.Control.Value); WorldScript.mLocalPlayer.mResearch.GiveResearch(materials.Filler.Type, materials.Filler.Value); foreach (var block in blocks) { if (block == controlPosition) { continue; } BuildPart(frustrum, block, materials.Filler, orientation.Flags()); } BuildPart(frustrum, controlPosition, materials.Control, orientation.Flags()); AudioSpeechManager.PlayStructureCompleteDelayed = true; }
public BoxBuilder(Position size, Materials materials, Orientation orientation) { this.Size = size; this.Materials = materials; this.Orientation = orientation; }