Skip to content

Instantly share code, notes, and snippets.

View HexyWitch's full-sized avatar

Lilith HexyWitch

View GitHub Profile
@HexyWitch
HexyWitch / ecs.rs
Last active December 3, 2018 23:33
Small rust ECS
use std::any::{Any, TypeId};
use std::cell::{Ref, RefCell, RefMut};
use std::collections::HashMap;
type ComponentMap = HashMap<TypeId, RefCell<Box<Any>>>;
pub trait ComponentSetMutRefs<'a> {
type MutRefs;
}
pub trait ComponentSet {
@HexyWitch
HexyWitch / gist:b2214dc1ed9a2bd10670
Last active August 29, 2015 14:02
Reworking liquids
Liquids are confusing and bad, liquid containers are confusing and bad. Storing liquids is weird because it's just a variable not any actual liquid. When you destroy an object that uses liquids, what happens to internal liquid? Who even knows.
Items are not confusing and bad. Objects that use items have inventories. When you break an object with an inventory the items fall out. When you transfer items they go from one inventory to another.
Solution:
LIQUIDS ARE NOW ITEMS!
PUMP - Repurposed! It now pumps in liquid from the world and converts them to capsules. It's a mix between filler and pump. It can store a small amount of capsules, like 1 stack.
@HexyWitch
HexyWitch / gist:0d74343e0a41cdf56638
Last active August 29, 2015 14:01
All the doors
[DONE] objects\apex\apexcooldoor\apexcooldoor.object
[DONE] objects\apex\apexshipdoor\apexshipdoor.object
[DONE] objects\apex\apexslidingdoor1\apexslidingdoor1.object
[DONE] objects\apex\apexslidingdoor2\apexslidingdoor2.object
[NO NEED] objects\apex\classicbardoor\classicbardoor.object
[DONE] objects\apex\classicdoor\classicdoor.object
[DONE] objects\avian\bardoor\bardoor.object
[DONE] objects\avian\bardoor2\bardoor2.object
[DONE] objects\avian\birddoor\birddoor.object
[DONE] objects\avian\tribaldoor\tribaldoor.object
@HexyWitch
HexyWitch / Starfoundry plans
Last active August 29, 2015 14:01
Starfoundry 2.0 plans
Pipes API 2.0
[DONE]-Pipe endpoints, no more ejectors, pipe spouts or hoppers
[DONE]-Pipes will now walk to all adjacent pipes on the same layer. Separate different paths by type, color or layer.
*This means no more smooth layer switching. Switching layers can be done by placing an object like a valve or something.
[DONE]-The pipes api will replace tiles with the correct orientation based on the pipe walking
*This means no more placing the correct pipe tile manually - just place a general "Sewer pipe" or "Clean pipe" object and the API does the rest
@HexyWitch
HexyWitch / gist:8912039
Created February 10, 2014 08:03
Tile filters
http://pastebin.com/2bjLkXVQ
@HexyWitch
HexyWitch / gist:8695760
Last active August 29, 2015 13:55
Making objects with animation parts that flip correctly
This is a method I have devised through hours and hours of breaking the animation system.
The problem this solves is that offsets of animationParts or placement of objects get messed up
when you place the object facing left (flipped).
Some terms I will use that are important:
Object origin: The {0,0} position for your *object*. This is the position that will be returned by entity.position()
Animation origin: The {0,0} position for your *animation*, this is only used for offsets in the .animation file