Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
167 additions
and 11 deletions.
- +1 −1 game/gui/ingame/gameView.cs
- +39 −0 game/gui/ingame/hud.cs
- +1 −0 game/gui/main.cs
- +3 −3 game/gui/menus/selectLevel.cs
- +3 −3 game/gui/menus/selectServer.cs
- +3 −2 game/gui/profiles.cs
- +7 −2 game/lib/twillex/main.cs
- +59 −0 game/scripts/server/characters/players.cs
- +49 −0 game/scripts/server/connection.cs
- +2 −0 game/scripts/server/weapons/machinegun.cs
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -4,7 +4,7 @@ | ||
| horizSizing = "right"; | ||
| vertSizing = "bottom"; | ||
| position = "0 0"; | ||
| extent = "800 600"; | ||
| minExtent = "8 8"; | ||
| canSave = true; | ||
| visible = true; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,39 @@ | ||
| GameViewGui.add(new GuiControl(HUD) { | ||
| profile = InvisibleProfile; | ||
| horizSizing = Right; | ||
| vertSizing = Bottom; | ||
| position = "0 0"; | ||
| extent = "800 600"; | ||
| visible = false; | ||
|
|
||
| new GuiControl([Interaction]) { | ||
| profile = BackgroundProfile; | ||
| position = "-350 50"; | ||
| extent = "350 50"; | ||
|
|
||
| new GuiBitmapCtrl([InteractionIcon]) { | ||
| visible = false; | ||
| }; | ||
|
|
||
| new GuiTextCtrl([InteractionString]) { | ||
| profile = SmallTitleProfile; | ||
| position = "50 10"; | ||
| extent = "300 30"; | ||
| }; | ||
| }; | ||
| }); | ||
|
|
||
| HUD.Tweens = Twillex::create(); | ||
| HUD.Tweens.startUpdates(); | ||
|
|
||
| function clientCmdInteraction(%text) { | ||
| HUD-->InteractionString.setText(%text); | ||
| %textW = getWord(HUD-->InteractionString.extent, 0); | ||
| HUD-->Interaction.extent = 100 + %textW SPC 50; | ||
| HUD.Tweens.toOnce(200, HUD-->Interaction, "position: 0 50", "ease:sine_out"); | ||
| } | ||
|
|
||
| function clientCmdNoInteraction() { | ||
| %pos = -1 * getWord(Hud-->Interaction.extent, 0) SPC 50; | ||
| HUD.Tweens.toOnce(200, HUD-->Interaction, "position:" SPC %pos, "ease:sine_in"); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -20,3 +20,4 @@ | ||
| exec("./menus/loading.cs"); | ||
| exec("./ingame/gameView.cs"); | ||
| exec("./ingame/inGameMenu.cs"); | ||
| exec("./ingame/hud.cs"); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,3 +1,62 @@ | ||
| datablock PlayerData(PlayerSoldier) { | ||
| class = SoldierShape; | ||
| shapeFile = "art/characters/soldier.dae"; | ||
|
|
||
| cameraMaxDist = 2; | ||
| }; | ||
|
|
||
| function PlayerSoldier::onAdd(%this, %obj) { | ||
| // Start looking for items to interact with. | ||
| %this.itemSearch(%obj); | ||
| } | ||
|
|
||
| function PlayerSoldier::onRemove(%this, %obj) { | ||
| cancel(%obj.itemSearch); | ||
| } | ||
|
|
||
| // Search for items in front of the character. If we see one, we'll notify the | ||
| // GameConnection in control of this player. This function runs every 100ms (i.e. | ||
| // 10 times/second). The search takes the form of a big sphere in front of the | ||
| // player's eye (imagine holding an exercise ball in front of your face). | ||
| function PlayerSoldier::itemSearch(%this, %obj) { | ||
| %obj.itemSearch = %this.schedule(100, itemSearch, %obj); | ||
| %radius = 1.2; | ||
| %eye = %obj.getEyePoint(); | ||
| %dir = %obj.getEyeVector(); | ||
| %pos = VectorAdd(%eye, VectorScale(%dir, %radius)); | ||
|
|
||
| InitContainerRadiusSearch(%pos, %radius, $TypeMasks::ItemObjectType); | ||
| %best = 0; | ||
| %bestDot = -1; | ||
| while((%item = ContainerSearchNext()) != 0) { | ||
| %diff = VectorSub(%item.getPosition(), %eye); | ||
| %diffn = VectorNormalize(%diff); | ||
| %dot = VectorDot(%dir, %diffn); | ||
| if (%dot > %bestDot) { | ||
| %bestDot = %dot; | ||
| %best = %item; | ||
| } | ||
| } | ||
|
|
||
| if (isObject(%obj.client)) { | ||
| %obj.client.lookingAtItem(%best); | ||
| } | ||
| } | ||
|
|
||
| function PlayerSoldier::getInteraction(%this, %obj, %item) { | ||
| %db = %item.getDataBlock(); | ||
| switch$ (%db.type) { | ||
| case "pickup": | ||
| %empty = "pick up"; | ||
| %full = "swap for"; | ||
|
|
||
| case "device": | ||
| %empty = "use"; | ||
| %full = "use"; | ||
| } | ||
|
|
||
| %msg = (%obj.getMountedImage(0) == 0 ? %empty : %full) | ||
| SPC %db.itemName; | ||
|
|
||
| return %msg; | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -30,6 +30,8 @@ class = Weapon; | ||
| image = MachineGunImage; | ||
| elasticity = 0.05; | ||
| mass = 15; | ||
| type = "pickup"; | ||
| itemName = "machine gun"; | ||
| }; | ||
|
|
||
| datablock ProjectileData(MachineGunProjectile) { | ||