Skip to content

Commit

Permalink
Adding dll, updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
Vici37 committed May 30, 2016
1 parent 52581bf commit c28f3fb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
6 changes: 1 addition & 5 deletions ItemInterops/ItemInteropInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace FortressCraft.Community.ItemInterops
{
/// <summary>
/// This interface needs to mimc <see cref="CommunityItemInterface">CommunityItemInterface</see>'s methods,
/// This interface needs to mimic <see cref="CommunityItemInterface">CommunityItemInterface</see>'s methods,
/// but take a <see cref="SegmentEntity">SegmentEntity</see> as the first param.
/// </summary>
internal interface ItemInteropInterface
Expand All @@ -15,10 +15,6 @@ internal interface ItemInteropInterface
Int32 GetFreeSpace(SegmentEntity entity);
Boolean GiveItem(SegmentEntity entity, ItemBase item);
ItemBase TakeItem(SegmentEntity entity, ItemBase item);

// Undecided if this will be in the CommunityItemInterface, just seems useful for Single Item Entities.
// Maybe throw NotImplementedException if multi item entity?
// Maybe a no-param overload of TakeItem(ItemBase item) ?
ItemBase TakeAnyItem(SegmentEntity entity);
}
}
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,43 @@
# Community Made Functions For Mod Development

Currently this repo contains functions for manipulating Items (ItemBase class)
and for grabbing all blocks of a certain type around the provided SegentEntity.
This project aim to make modding [Fortress Craft Evolved](store.steampowered.com/app/254200/?snr=1_7_15__13), mainly by providing standardized methods for interacting with Items and GameObjects. Among other things, this library provides a CommunityItemInterface as well as some helper functions to help interact with other CommunityItemInterface implementors, as well as a standardized way to interact with some vanilla machines as well.

Contributors:
* [Vici37](https://github.com/Vici37)
* [Steveman0](https://github.com/steveman0)
* [Nikey646](https://github.com/Nikey646)

# How Do I Use This For My Mod?
Clone this repo (or just download it), and copy the FCECommunityTools.dll into the same place you'd put your plugin\_YourMod.dll . Then, in your development environment of choice, add FCECommunityTools.dll as a reference to your project.

# CommunityItemInterface
Provides the following functions:
Boolean HasItems();
Boolean HasItems();
Boolean HasItem(ItemBase item);
Boolean HasItems(ItemBase item, out Int32 amount);
Boolean HasFreeSpace(UInt32 amount);
Int32 GetFreeSpace();
Boolean GiveItem(ItemBase item);
ItemBase TakeItem(ItemBase item);
ItemBase TakeAnyItem();

# Helper Methods
CommunityUtil provides some extension methods for MachineEntities. Namely:

// Get a list of all CommunityItemInterface implementors that touch the machineEntity block (can be applied to most classes instead)
bool encounteredNullSegment;
List<CommunityItemInterface> itemInterfaces = machineEntity.CheckSurrounding<CommunityItemInterface>(out encounterdNullSegment);

// Give an ItemBase to a machine touching this one that will take it
// Will handle CommunityItemInterface, StorageHopper, and ConveyorEntity
machineEntity.GiveToSurrounding(someItemBase);

// Take an item from the surroundings that match the provided ItemBase
ItemBase item = machineEntity.TakeFromSurrounding(someItemBase);

// Take any ItemBase from the surroundings that's being offered
ItemBase item = machineEntity.TakeFromSurrounding();

# Want to Help?
Make a pull request with what changes you want to see!
Binary file added bin/Release/FCECommunityTools.dll
Binary file not shown.

0 comments on commit c28f3fb

Please sign in to comment.