diff --git a/CoreScripts/EventSector.as b/CoreScripts/EventSector.as index 9e34e0b..e5c7489 100644 --- a/CoreScripts/EventSector.as +++ b/CoreScripts/EventSector.as @@ -1,70 +1,5 @@ #include "EventCore" -void onInit(CRules@ this) -{ - onReload(this); -} - -SectorHandler@ handler; - -void onReload(CRules@ this) -{ - getMap().RemoveAllSectors(); - - @handler = SectorHandler(); - - handler.AddNewEvent( - SectorEvent(HelloWorld, Vec2f(95, 419), Vec2f(184, 471)) - ); - - handler.AddNewEvent( - SectorEvent(HelloWorld, Vec2f(260, 410), Vec2f(411, 469), false) - ); - - handler.AddNewEvent( - SectorEvent(HelloWorld, Vec2f(474, 410), Vec2f(617, 466), BombCheck, false) - ); - -} - -void HelloWorld(CBlob@ caller) -{ - server_CreateBlob("chicken", -1, caller.getPosition()); -} - -bool BombCheck(CBlob@ caller) -{ - CBlob@ blob = caller.getAttachments().getAttachmentPointByName("PICKUP").getOccupied(); - - if (blob !is null && blob.getName() == "mat_bombs") - { - return true; - } - - return false; -} - -void onTick(CRules@ this) -{ - - CBlob@ blob = getLocalPlayerBlob(); - - if (handler is null || blob is null) - return; - - handler.OnTick(blob); -} - -void onRender(CRules@ this) -{ - GUI::DrawText("One time use event", getDriver().getScreenPosFromWorldPos(Vec2f(115, 400)), SColor(255,255,255,255)); - - GUI::DrawText("Infinite use event", getDriver().getScreenPosFromWorldPos(Vec2f(300, 400)), SColor(255,255,255,255)); - - GUI::DrawText("Event with condition check", getDriver().getScreenPosFromWorldPos(Vec2f(520, 400)), SColor(255,255,255,255)); -} - - class SectorEvent : Event { // Map sector, we don't want external sources messing with this diff --git a/Maps/Test.as b/Maps/Test.as index 4bb04aa..c1f31c6 100644 --- a/Maps/Test.as +++ b/Maps/Test.as @@ -1,10 +1,63 @@ +#include "EventSector" + +SectorHandler@ handler; void onInit(CMap@ this) { - print("hi world from test.as"); + onRulesRestart(this, null); } void onRulesRestart( CMap@ this, CRules@ rules ) { - print("hi again"); + this.RemoveAllSectors(); + + @handler = SectorHandler(); + + handler.AddNewEvent( + SectorEvent(HelloWorld, Vec2f(95, 419), Vec2f(184, 471), true) + ); + + handler.AddNewEvent( + SectorEvent(HelloWorld, Vec2f(260, 410), Vec2f(411, 469), false) + ); + + handler.AddNewEvent( + SectorEvent(HelloWorld, Vec2f(474, 410), Vec2f(617, 466), BombCheck, false) + ); +} + +void HelloWorld(CBlob@ caller) +{ + server_CreateBlob("chicken", -1, caller.getPosition()); +} + +bool BombCheck(CBlob@ caller) +{ + CBlob@ blob = caller.getAttachments().getAttachmentPointByName("PICKUP").getOccupied(); + + if (blob !is null && blob.getName() == "mat_bombs") + { + return true; + } + + return false; +} + +void onTick(CMap@ this) +{ + CBlob@ blob = getLocalPlayerBlob(); + + if (handler is null || blob is null) + return; + + handler.OnTick(blob); +} + +void onRender(CMap@ this) +{ + GUI::DrawText("One time use event", getDriver().getScreenPosFromWorldPos(Vec2f(115, 400)), SColor(255,255,255,255)); + + GUI::DrawText("Infinite use event", getDriver().getScreenPosFromWorldPos(Vec2f(300, 400)), SColor(255,255,255,255)); + + GUI::DrawText("Event with condition check", getDriver().getScreenPosFromWorldPos(Vec2f(520, 400)), SColor(255,255,255,255)); } \ No newline at end of file diff --git a/gamemode.cfg b/gamemode.cfg index 2572c95..cdbf990 100644 --- a/gamemode.cfg +++ b/gamemode.cfg @@ -9,7 +9,6 @@ scripts = KAG.as; TutorialMain.as; - EventSector.as; RequestSpawnOnDeath.as; ChatCommands.as; TeamMenuJustSpectator.as;