diff options
| author | Markus Mittendrein <git@maxmitti.tk> | 2017-01-02 19:34:09 +0100 |
|---|---|---|
| committer | Markus Mittendrein <git@maxmitti.tk> | 2017-01-02 19:34:09 +0100 |
| commit | 1f280cb06cc579c2a98d215e202dc0642fb40a3d (patch) | |
| tree | 30a19973594d30792947aa624e7bf585eaa0cf40 /Items.c4d/Extractor.c4d | |
| download | DTTubeMail.c4d-1f280cb06cc579c2a98d215e202dc0642fb40a3d.tar.gz DTTubeMail.c4d-1f280cb06cc579c2a98d215e202dc0642fb40a3d.zip | |
Initial
Diffstat (limited to 'Items.c4d/Extractor.c4d')
| -rw-r--r-- | Items.c4d/Extractor.c4d/ActMap.txt | 5 | ||||
| -rw-r--r-- | Items.c4d/Extractor.c4d/DefCore.txt | 22 | ||||
| -rw-r--r-- | Items.c4d/Extractor.c4d/Graphics.png | bin | 0 -> 234 bytes | |||
| -rw-r--r-- | Items.c4d/Extractor.c4d/Names.txt | 2 | ||||
| -rw-r--r-- | Items.c4d/Extractor.c4d/Script.c | 323 | ||||
| -rw-r--r-- | Items.c4d/Extractor.c4d/StringTblDE.txt | 7 | ||||
| -rw-r--r-- | Items.c4d/Extractor.c4d/StringTblUS.txt | 7 |
7 files changed, 366 insertions, 0 deletions
diff --git a/Items.c4d/Extractor.c4d/ActMap.txt b/Items.c4d/Extractor.c4d/ActMap.txt new file mode 100644 index 0000000..48318ab --- /dev/null +++ b/Items.c4d/Extractor.c4d/ActMap.txt @@ -0,0 +1,5 @@ +[Action]
+Name=Attach
+Procedure=ATTACH
+FacetBase=1
+AbortCall=Detached
diff --git a/Items.c4d/Extractor.c4d/DefCore.txt b/Items.c4d/Extractor.c4d/DefCore.txt new file mode 100644 index 0000000..b2db749 --- /dev/null +++ b/Items.c4d/Extractor.c4d/DefCore.txt @@ -0,0 +1,22 @@ +[DefCore]
+id=EX7I
+Name=Extractor
+Version=4,9,5
+Category=C4D_Object|C4D_SelectMaterial|C4D_SelectKnowledge|C4D_SelectHomebase
+Width=11
+Height=11
+Offset=-5,-4
+Mass=10
+Value=5
+Components=METL=1;
+; Picture=10,0,64,64
+Vertices=4
+VertexX=0,-5,5
+VertexY=4,-4,-4
+VertexFriction=100,100,100
+Grab=2
+Collectible=1
+MaxUserSelect=10
+Rebuy=1
+NoPushEnter=1
+; GrabPutGet=C4D_GrabGet
diff --git a/Items.c4d/Extractor.c4d/Graphics.png b/Items.c4d/Extractor.c4d/Graphics.png Binary files differnew file mode 100644 index 0000000..22fc4fb --- /dev/null +++ b/Items.c4d/Extractor.c4d/Graphics.png diff --git a/Items.c4d/Extractor.c4d/Names.txt b/Items.c4d/Extractor.c4d/Names.txt new file mode 100644 index 0000000..8032740 --- /dev/null +++ b/Items.c4d/Extractor.c4d/Names.txt @@ -0,0 +1,2 @@ +DE:Extrahierer
+US:Extractor
diff --git a/Items.c4d/Extractor.c4d/Script.c b/Items.c4d/Extractor.c4d/Script.c new file mode 100644 index 0000000..05a1fc6 --- /dev/null +++ b/Items.c4d/Extractor.c4d/Script.c @@ -0,0 +1,323 @@ +#strict 2
+#include UT7I
+
+local worker;
+local produceQueue;
+
+func ControlThrow(object caller)
+{
+ if(DenyContainedDirectCom())
+ {
+ return false;
+ }
+ SendObjectThroughTube();
+ return ClearLastPlrCom(GetController(caller)) || true;
+}
+
+func ControlDigDouble(object caller)
+{
+ if(DenyContainedDirectCom())
+ {
+ return false;
+ }
+ return Detach();
+}
+
+func ControlUp(object caller, id selectID)
+{
+ if(DenyContainedDirectCom())
+ {
+ return false;
+ }
+ return SendMenu(caller);
+}
+
+func Activate(object caller)
+{
+ return AttachMenu(caller);
+}
+
+func ContextSetWorker(object caller)
+{
+ [$SetWorker$|Image=CXCN|Condition=Attached]
+ if(CheckWorker() && caller == worker)
+ {
+ worker = 0;
+ PlayerMessage(GetController(caller), "$WorkerUnset$", this);
+ }
+ else
+ {
+ worker = caller;
+ PlayerMessage(GetController(caller), "$WorkerSet$", this, GetName(caller));
+ }
+ return true;
+}
+
+func HasObject(id type, bool allowProduction)
+{
+ var ret = FindSendableObject(type);
+ if(!ret && allowProduction)
+ {
+ var attached = Attached();
+ if(attached && GetDefCollectible(type))
+ {
+ if(attached->GetBase() != NO_OWNER)
+ {
+ var plr = attached->GetBase();
+ return GetHomebaseMaterial(plr, type) && GetWealth(plr) >= GetValue(0, type, attached, plr);
+ }
+ else if(CheckWorker() && attached->~IsProducerOf(worker, type))
+ {
+ return true;
+ }
+ }
+ }
+ return ret;
+}
+
+func RetrieveSendObject(object line, id type)
+{
+ return SendObjectThroughTube(type, line, ...);
+}
+
+func RetrieveProduceObject(object line, id type)
+{
+ BuyOrProduceSendObject(type, line, ...);
+ return true;
+}
+
+func BuyOrProduceSendObject(id type, object line, arriveCallback, object excludeOrigin, failCallback, object realTarget) // TODO: Sort factories by "load", use very high "load" for buy-only
+{
+ if(GetDefCollectible(type))
+ {
+ var attached = Attached();
+ if(attached)
+ {
+ if(attached->GetBase() != NO_OWNER)
+ {
+ var plr = attached->GetBase();
+ var obj = Buy(type, plr, plr, attached, true);
+ if(obj)
+ {
+ line = line || FindObject2(Find_Tube(), Find_Func("CanSendObject", this, obj));
+ return line && line->SendObject(this, obj, arriveCallback, false, realTarget, ...);
+ }
+ }
+ else if(CheckWorker() && attached->~IsProducerOf(worker, type))
+ {
+ AddQueue([type, line, arriveCallback, failCallback, realTarget]);
+ //SetWorkerCommands(worker, [type, line, arriveCallback, failCallback], true);
+ }
+ }
+ }
+}
+
+func AddQueue(array args)
+{
+ if(!produceQueue)
+ {
+ produceQueue = [args];
+ }
+ else
+ {
+ produceQueue[GetLength(produceQueue)] = args;
+ }
+
+ if(GetLength(produceQueue) == 1 || !GetCommand(worker))
+ {
+ ContinueQueue();
+ }
+ ShowQueue();
+}
+
+func ContinueQueue()
+{
+ if(GetLength(produceQueue) > 0)
+ {
+ SetWorkerCommands(worker, produceQueue[0], true);
+ }
+}
+
+func RemoveQueued()
+{
+ ArrayErase(produceQueue, 0);
+ ContinueQueue();
+ ShowQueue();
+}
+
+func ShowQueue()
+{
+ if(GetLength(produceQueue) > 0)
+ {
+ var msgStr = "", showCount = 0, cnt = 1, lastID = produceQueue[i][0];
+ for(var i = 1; i <= GetLength(produceQueue); ++i)
+ {
+ var id = produceQueue[i] && produceQueue[i][0];
+
+ if(lastID == id)
+ {
+ ++cnt;
+ }
+ else
+ {
+ if(cnt > 1)
+ {
+ msgStr = Format("|{{%i}} x%d%s", lastID, cnt, msgStr);
+ }
+ else
+ {
+ msgStr = Format("|{{%i}}%s", lastID, msgStr);
+ }
+ if(++showCount >= 10)
+ {
+ break;
+ }
+ cnt = 0;
+ }
+
+ lastID = id;
+ }
+ if(i < GetLength(produceQueue))
+ {
+ msgStr = Format("...%s", msgStr);
+ }
+ Message("@%s", this, msgStr);
+ }
+ else
+ {
+ Message("", this);
+ }
+}
+
+func FactoryLoad() // TODO: TEST and FIXME
+{
+ var attached = Attached();
+ if(attached && attached->GetBase() != NO_OWNER)
+ {
+ return 10; // maybe adjust this
+ }
+ else
+ {
+ return produceQueue && GetLength(produceQueue);
+ }
+}
+
+func SetWorkerCommands(object worker, array args, bool checkIdle)
+{
+ if(!checkIdle || !GetCommand(worker))
+ {
+ var attached = Attached();
+ if(attached)
+ {
+ AddCommand(worker, "Call", this, args, 0, 0, 0, "ProductionFinished");
+ AddCommand(worker, "Put", attached, 0, 0, 0, 0, args[0]);
+ AddCommand(worker, "Acquire", this, 0, 0, 0, 0, args[0]); // don't Acquire through tubes this time
+ attached->~HowToProduce(worker, args[0]);
+ }
+ }
+ else
+ {
+ AppendCommand(worker, "Call", this, args, 0, 0, 0, "SetWorkerCommands");
+ }
+}
+
+func ProductionFinishedFailed(object worker, array args)
+{
+ RemoveQueued();
+ Call(args[3], worker);
+}
+
+func ProductionFinished(object worker, array args)
+{
+ RemoveQueued();
+ return args[0] && SendObjectThroughTube(args[0], args[1], args[2], false, args[4]);
+}
+
+func GetRetrievableObjects(object line, bool production)
+{
+ return GetSendableIDs(production);
+}
+
+func ProductionTitle()
+{
+ var attached = Attached();
+ if(attached)
+ {
+ if(attached->GetBase() != NO_OWNER)
+ {
+ return "$Buy$";
+ }
+ }
+ return _inherited(...);
+}
+
+func GetProducableIDs()
+{
+ var ret = [];
+ var attached = Attached();
+ if(attached)
+ {
+ if(attached->GetBase() != NO_OWNER)
+ {
+ var plr = attached->GetBase();
+ for(var i = 0, type; type = GetHomebaseMaterial(plr, 0, i, C4D_StaticBack | C4D_Structure | C4D_Vehicle | C4D_Living | C4D_Object); ++i)
+ {
+ if(GetDefCollectible(type) && GetHomebaseMaterial(plr, type) && GetWealth(plr) >= GetValue(0, type, attached, plr))
+ {
+ ret[GetLength(ret)] = type;
+ }
+ }
+ }
+ else if(CheckWorker())
+ {
+ for(var i = 0, type; type = GetDefinition(i); ++i)
+ {
+ if(GetDefCollectible(type))
+ {
+ if(attached->~IsProducerOf(worker, type))
+ {
+ ret[GetLength(ret)] = type;
+ }
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+func AttachObjectCondition(object caller)
+{
+ return _inherited(caller, Find_GrabPutGet(C4D_GrabGet), ...);
+}
+
+func AttachContextSend(object caller)
+{
+ [$SendObject$|Image=EX7I]
+ return SendMenu(caller);
+}
+
+func SensorCallbacks()
+{
+ var ret = [["$SendObject$", BindCallback("SendObjectThroughTube", [1, 2])]];
+ var attached = Attached();
+ if(attached)
+ {
+ for(var part in [GetSendableIDs(), GetSendableIDs(true)])
+ {
+ for(var id in part)
+ {
+ ret[GetLength(ret)] = [Format("$SendObjectType$", GetName(0, id)), BindCallback("SendObjectThroughTube", [Bind(id), 2]), id];
+ }
+ }
+ }
+ return ret;
+}
+
+func CheckWorker()
+{
+ if(worker && !worker->GetAlive())
+ {
+ worker = 0;
+ }
+ return worker;
+}
diff --git a/Items.c4d/Extractor.c4d/StringTblDE.txt b/Items.c4d/Extractor.c4d/StringTblDE.txt new file mode 100644 index 0000000..8d03da9 --- /dev/null +++ b/Items.c4d/Extractor.c4d/StringTblDE.txt @@ -0,0 +1,7 @@ +SelectTarget=Behälter wählen +SendObject=Objekt senden +SendObjectType=%s senden +Buy=Kaufen +SetWorker=Als Arbeiterclonk setzen +WorkerSet=%s als Arbeiter gesetzt. +WorkerUnset=Arbeiter entfernt. diff --git a/Items.c4d/Extractor.c4d/StringTblUS.txt b/Items.c4d/Extractor.c4d/StringTblUS.txt new file mode 100644 index 0000000..6f14e9d --- /dev/null +++ b/Items.c4d/Extractor.c4d/StringTblUS.txt @@ -0,0 +1,7 @@ +SelectTarget=Select container +SendObject=Send object +SendObject=Send %s +Buy=Buy +SetWorker=Set als worker clonk +WorkerSet=%s was set as worker clonk. +WorkerUnset=Worker clonk was unset. |
