ManufacturingModel.sleela
lib/citizen/character/ManufacturingModel.sleela · 88 line(s) · sleela
<< lib/citizen/character/ManufacturingModel.sleela
SLeeLa Standard Library Definition.
Definition: ManufacturingModel — make the physical thing at scale. Revenue is
units shipped x wholesale price; cost is variable material/labor per unit
plus a large, stubborn fixed cost for the factory that does not care whether
the line ran today.
A concrete BusinessModel: the fixed cost is the drama; volume is the cure.
Family: character. >>
#sleela 2.5
material;
class ManufacturingModel extends BusinessModel {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 10333;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-07";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
< units shipped this month >
int unitsProduced;
< price per unit to the buyer >
int wholesalePriceCents;
< material + labor per unit >
int variableCostCents;
< monthly fixed factory cost (regardless of volume) >
int fixedPlantCents;
void setUp(int produced, int wholesalePrice, int variableCost, int fixedPlant) {
load();
configure("Manufacturing", KIND_MANUFACTURING);
if (produced < 0) { produced = 0; }
if (wholesalePrice < 0) { wholesalePrice = 0; }
if (variableCost < 0) { variableCost = 0; }
if (fixedPlant < 0) { fixedPlant = 0; }
unitsProduced = produced;
wholesalePriceCents = wholesalePrice;
variableCostCents = variableCost;
fixedPlantCents = fixedPlant;
setUnits(produced);
}
< Break-even volume: units needed to cover the fixed plant cost alone. >
int breakEvenUnits() {
int contribution = wholesalePriceCents - variableCostCents;
if (contribution <= 0) { return 0; }
return fixedPlantCents / contribution;
}
int monthlyRevenue() { return unitsProduced * wholesalePriceCents; }
int monthlyCost() { return unitsProduced * variableCostCents + fixedPlantCents; }
}