diff --git a/CoreScripts/Character/BlobCharacter.as b/CoreScripts/Character/BlobCharacter.as index 30cce7d..14972d9 100644 --- a/CoreScripts/Character/BlobCharacter.as +++ b/CoreScripts/Character/BlobCharacter.as @@ -168,6 +168,7 @@ class BlobCharacter : Character Team = OwnerBlob.get_s32("head team"); HeadTextureFile = OwnerBlob.get_string("head texture"); + // Disabled for now, looks cursed as fuck /*if (!FinishedWriting && CurrentRenderText.substr(CurrentRenderText.length -2, 1) != " ") testFrame = 1; else @@ -188,6 +189,15 @@ class BlobCharacter : Character GUI::DrawIcon(CharacterTextureFile, 0, Vec2f(12, 12), Vec2f(topLeft.x + 6, topLeft.y + 6), 4.0f, Team); GUI::DrawIcon(HeadTextureFile, HeadIndex + testFrame, Vec2f(16, 16), headpos , 4.0f, Team); } + + // Todo -> Find a better way to do this maybe? It works for now i guess (unsure why i dislike this) + void PushToGlobalHandler() + { + CBitStream@ cbs = CBitStream(); + cbs.write_u16(blob.getNetworkID()); + + getRules().SendCommand(getRules().getCommandID("character_bound"), cbs); + } } diff --git a/CoreScripts/Character/CharacterCore.as b/CoreScripts/Character/CharacterCore.as index 7362476..e240a6e 100644 --- a/CoreScripts/Character/CharacterCore.as +++ b/CoreScripts/Character/CharacterCore.as @@ -100,21 +100,20 @@ mixin class Character } } - // TODO -> Sort this junk out, clear our sHeight and sWidth n stuff - void RenderBox() + void RenderBox(Vec2f &in topLeft)) { GUI::SetFont(PreferedFont); int sHeight = getDriver().getScreenHeight(); - int sWidth = getDriver().getScreenWidth(); + int sWidth = getDriver().getScreenWidth(); - int leftX = sWidth / 6; - int topY = sHeight - (sHeight / 2.5); - int hardValue = 100; - GUI::DrawFramedPane(Vec2f(leftX, topY), Vec2f(leftX + hardValue, topY + hardValue)); + int leftX = sWidth / 6; + int topY = sHeight - (sHeight / 2.5); + int hardValue = 120; + GUI::DrawFramedPane(Vec2f(leftX, topY), Vec2f(leftX + hardValue, topY + hardValue)); - leftX += hardValue; - GUI::DrawRectangle(Vec2f(leftX, topY), Vec2f(leftX + hardValue + 500, topY + hardValue), SColor(150,0,0,0)); - GUI::DrawText(CurrentRenderText, Vec2f(leftX + 25, topY + 10), Vec2f(leftX + hardValue + 475, topY + hardValue), SColor(255, 255, 255, 255), false, false, false); + leftX += hardValue; + GUI::DrawRectangle(Vec2f(leftX, topY), Vec2f(leftX + hardValue + 500, topY + hardValue), SColor(150,0,0,0)); + GUI::DrawText(CurrentRenderText, Vec2f(leftX + 25, topY + 10), Vec2f(leftX + hardValue + 475, topY + hardValue), SColor(255, 255, 255, 255), false, false, false); } } diff --git a/Maps/CommonScripts/MapsCore.as b/Maps/CommonScripts/MapsCore.as index 574dd8b..aeeed87 100644 --- a/Maps/CommonScripts/MapsCore.as +++ b/Maps/CommonScripts/MapsCore.as @@ -48,7 +48,7 @@ bool AddSpawnsCosmeticOnly(CMap@ map, string markerName, string blobToSpawn, int -CBlob@ SpawnInCharacter(string blobName, int team, Vec2f pos, string characterName, bool onInit = true, string custom_body = "") +CBlob@ SpawnInCharacter(string blobName, int team, Vec2f pos, string characterName, bool onInit = true, string customBody = "") { CBlob@ blob = null; @@ -70,8 +70,8 @@ CBlob@ SpawnInCharacter(string blobName, int team, Vec2f pos, string characterNa return null; } - if (custom_body != "") - blob.set_string("custom_body", custom_body); + if (customBody != "") + blob.set_string("custom_body", customBody); blob.AddScript("InteractableCharacter"); @@ -80,12 +80,22 @@ CBlob@ SpawnInCharacter(string blobName, int team, Vec2f pos, string characterNa character.AddResponse("test", "You look stupid and stupid, and you will always be stupid"); blob.set("character", character); - //Call CRules and tell it to add Character into a global handler - CBitStream@ cbs = CBitStream(); - CRules@ rules = getRules(); - - cbs.write_u16(blob.getNetworkID()); - rules.SendCommand(rules.getCommandID("character_bound"), cbs); + character.setCharacter return blob; +} + +void addCharacterToBlob(CBlob@ blob, string &in characterName, string &in textFile) +{ + if (blob.hasScript("InteractableCharacter")) + { + error("Trying to add a script to a blob that already has InteractableCharacter.as"); + return; + } + + blob.AddScript("InteractableCharacter"); + + // Todo -> Load file + //BlobCharacter@ character = BlobCharacter(blob, characterName); + } \ No newline at end of file