Merge branch 'master' into crapblox
This commit is contained in:
commit
9542096bc6
|
|
@ -32,6 +32,7 @@ class RCCService extends EventEmitter {
|
|||
return resolve(false)
|
||||
}
|
||||
|
||||
this.started = true
|
||||
return resolve(true)
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,23 @@
|
|||
const { readFile } = require("fs/promises");
|
||||
const { readFile } = require("fs/promises")
|
||||
|
||||
const Job = require("./Job.js");
|
||||
const logger = require("../logger.js");
|
||||
const Job = require("./Job.js")
|
||||
const logger = require("../logger.js")
|
||||
|
||||
class RenderJob extends Job {
|
||||
constructor() {
|
||||
super();
|
||||
super()
|
||||
}
|
||||
|
||||
async RenderHeadshot(id) {
|
||||
const started = await this.Start();
|
||||
if (!started) throw new Error("RCCService failed to start");
|
||||
if (!this.client) await this.CreateClient();
|
||||
const running = this.started
|
||||
if (!running) {
|
||||
const started = await this.Start()
|
||||
if (!started) throw new Error("RCCService failed to start")
|
||||
}
|
||||
|
||||
logger.info(`[${this.id}] Headshot RenderJob started for ${id}`);
|
||||
if (!this.client) await this.CreateClient()
|
||||
|
||||
logger.info(`[${this.id}] Headshot RenderJob started for ${id}`)
|
||||
|
||||
const result = await this.OpenJobEx({
|
||||
name: this.id,
|
||||
|
|
@ -32,21 +36,25 @@ class RenderJob extends Job {
|
|||
{ type: "LUA_TNUMBER", value: id },
|
||||
],
|
||||
},
|
||||
}).catch((e) => false);
|
||||
}).catch((e) => false)
|
||||
|
||||
logger.info(`[${this.id}] Headshot RenderJob finished for ${id}`);
|
||||
logger.info(`[${this.id}] Headshot RenderJob finished for ${id}`)
|
||||
|
||||
if (!result) return false;
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value;
|
||||
if (!result) return false
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value
|
||||
}
|
||||
|
||||
async RenderBodyshot(id, three_d = false) {
|
||||
const started = await this.Start();
|
||||
if (!started) throw new Error("RCCService failed to start");
|
||||
if (!this.client) await this.CreateClient();
|
||||
const running = this.started
|
||||
if (!running) {
|
||||
const started = await this.Start()
|
||||
if (!started) throw new Error("RCCService failed to start")
|
||||
}
|
||||
|
||||
if (three_d) logger.info(`[${this.id}] 3D Bodyshot RenderJob started for ${id}`);
|
||||
else logger.info(`[${this.id}] Bodyshot RenderJob started for ${id}`);
|
||||
if (!this.client) await this.CreateClient()
|
||||
|
||||
if (three_d) logger.info(`[${this.id}] 3D Bodyshot RenderJob started for ${id}`)
|
||||
else logger.info(`[${this.id}] Bodyshot RenderJob started for ${id}`)
|
||||
|
||||
const result = await this.OpenJobEx({
|
||||
name: this.id,
|
||||
|
|
@ -65,22 +73,26 @@ class RenderJob extends Job {
|
|||
{ type: "LUA_TNUMBER", value: id },
|
||||
],
|
||||
},
|
||||
}).catch((e) => false);
|
||||
}).catch((e) => false)
|
||||
|
||||
if (three_d) logger.info(`[${this.id}] 3D Bodyshot RenderJob finished for ${id}`);
|
||||
else logger.info(`[${this.id}] Bodyshot RenderJob finished for ${id}`);
|
||||
if (three_d) logger.info(`[${this.id}] 3D Bodyshot RenderJob finished for ${id}`)
|
||||
else logger.info(`[${this.id}] Bodyshot RenderJob finished for ${id}`)
|
||||
|
||||
if (!result) return false;
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value;
|
||||
if (!result) return false
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value
|
||||
}
|
||||
|
||||
async RenderAsset(id, three_d = false) {
|
||||
const started = await this.Start();
|
||||
if (!started) throw new Error("RCCService failed to start");
|
||||
if (!this.client) await this.CreateClient();
|
||||
const running = this.started
|
||||
if (!running) {
|
||||
const started = await this.Start()
|
||||
if (!started) throw new Error("RCCService failed to start")
|
||||
}
|
||||
|
||||
if (three_d) logger.info(`[${this.id}] 3D Asset RenderJob started for ${id}`);
|
||||
else logger.info(`[${this.id}] Asset RenderJob started for ${id}`);
|
||||
if (!this.client) await this.CreateClient()
|
||||
|
||||
if (three_d) logger.info(`[${this.id}] 3D Asset RenderJob started for ${id}`)
|
||||
else logger.info(`[${this.id}] Asset RenderJob started for ${id}`)
|
||||
|
||||
const result = await this.OpenJobEx({
|
||||
name: this.id,
|
||||
|
|
@ -100,26 +112,30 @@ class RenderJob extends Job {
|
|||
{ type: "LUA_TBOOLEAN", value: "true" },
|
||||
],
|
||||
},
|
||||
}).catch((e) => false);
|
||||
}).catch((e) => false)
|
||||
|
||||
if (three_d) logger.info(`[${this.id}] 3D Asset RenderJob finished for ${id}`);
|
||||
else logger.info(`[${this.id}] Asset RenderJob finished for ${id}`);
|
||||
if (three_d) logger.info(`[${this.id}] 3D Asset RenderJob finished for ${id}`)
|
||||
else logger.info(`[${this.id}] Asset RenderJob finished for ${id}`)
|
||||
|
||||
if (!result) return false;
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value;
|
||||
if (!result) return false
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value
|
||||
}
|
||||
|
||||
async RenderPlace(id) {
|
||||
const response = await axios(`${process.env.BASE_URL}/API/Game/${id}?t=${process.env.ARBITER_TOKEN}`).catch((_) => reject(_));
|
||||
const { server_token, server_port, server_owner_id } = response.data;
|
||||
const response = await axios(`${process.env.BASE_URL}/API/Game/${id}?t=${process.env.ARBITER_TOKEN}`).catch((_) => reject(_))
|
||||
const { server_token, server_port, server_owner_id } = response.data
|
||||
|
||||
this.id = server_token;
|
||||
this.id = server_token
|
||||
|
||||
const started = await this.Start();
|
||||
if (!started) throw new Error("RCCService failed to start");
|
||||
if (!this.client) await this.CreateClient();
|
||||
const running = this.started
|
||||
if (!running) {
|
||||
const started = await this.Start()
|
||||
if (!started) throw new Error("RCCService failed to start")
|
||||
}
|
||||
|
||||
logger.info(`[${this.id}] Place RenderJob started for ${id}`);
|
||||
if (!this.client) await this.CreateClient()
|
||||
|
||||
logger.info(`[${this.id}] Place RenderJob started for ${id}`)
|
||||
|
||||
const result = await this.OpenJobEx({
|
||||
name: this.id,
|
||||
|
|
@ -138,13 +154,13 @@ class RenderJob extends Job {
|
|||
{ type: "LUA_TNUMBER", value: id },
|
||||
],
|
||||
},
|
||||
}).catch((e) => false);
|
||||
}).catch((e) => false)
|
||||
|
||||
logger.info(`[${this.id}] Place RenderJob finished for ${id}`);
|
||||
logger.info(`[${this.id}] Place RenderJob finished for ${id}`)
|
||||
|
||||
if (!result) return false;
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value;
|
||||
if (!result) return false
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RenderJob;
|
||||
module.exports = RenderJob
|
||||
|
|
|
|||
Loading…
Reference in New Issue