From f0225e43129dd2c7959aac7165d4c682ed256046 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sun, 3 Dec 2017 01:10:26 +0200 Subject: [PATCH 1/3] Chemicals and explosives can be thrown. Nitroglycerin & flash powder explode on impact, no effect on other items yet (implement applying status effects when the item hits someone?) --- .../Content/Items/Medical/medical.xml | 146 ++++++++---------- .../Content/Items/Weapons/explosives.xml | 23 ++- .../Content/Items/Weapons/weapons.xml | 6 +- 3 files changed, 77 insertions(+), 98 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Content/Items/Medical/medical.xml b/Barotrauma/BarotraumaShared/Content/Items/Medical/medical.xml index 6da2cc456..229e9bce8 100644 --- a/Barotrauma/BarotraumaShared/Content/Items/Medical/medical.xml +++ b/Barotrauma/BarotraumaShared/Content/Items/Medical/medical.xml @@ -3,8 +3,7 @@ @@ -31,8 +30,7 @@ @@ -53,23 +51,21 @@ - + @@ -82,19 +78,18 @@ - + - + @@ -103,19 +98,18 @@ - + - + @@ -128,12 +122,12 @@ - - + + - + - + - + - + - + - + - + @@ -218,50 +210,48 @@ - - + + - + - - + + - + - - + + - + - + + - + @@ -290,84 +281,79 @@ name="Chloral Hydrate" category="Material" spritecolor="1.0,1.0,1.0,0.8" - Tags="smallitem,chem,medical" - + Tags="smallitem,chem,medical" price="20"> - + - + - + - + - + - + - + - + @@ -375,19 +361,18 @@ - + - + @@ -395,19 +380,18 @@ - + - + @@ -415,19 +399,18 @@ - + - + @@ -435,19 +418,18 @@ - + - + @@ -455,11 +437,11 @@ - + - + diff --git a/Barotrauma/BarotraumaShared/Content/Items/Weapons/explosives.xml b/Barotrauma/BarotraumaShared/Content/Items/Weapons/explosives.xml index 26f91f0a5..24444fb0d 100644 --- a/Barotrauma/BarotraumaShared/Content/Items/Weapons/explosives.xml +++ b/Barotrauma/BarotraumaShared/Content/Items/Weapons/explosives.xml @@ -10,12 +10,12 @@ - + - + - + - + - + - + - + - + - + @@ -130,6 +129,6 @@ - + \ No newline at end of file diff --git a/Barotrauma/BarotraumaShared/Content/Items/Weapons/weapons.xml b/Barotrauma/BarotraumaShared/Content/Items/Weapons/weapons.xml index 2f6b71c45..7f0ac541a 100644 --- a/Barotrauma/BarotraumaShared/Content/Items/Weapons/weapons.xml +++ b/Barotrauma/BarotraumaShared/Content/Items/Weapons/weapons.xml @@ -107,8 +107,7 @@ @@ -126,8 +125,7 @@ From b36d3fc70ee80f9ece36e9310d6c6441d3678ac0 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sun, 3 Dec 2017 15:32:51 +0200 Subject: [PATCH 2/3] Fixed clients not getting notified when a character is spawned midround by a repeating MonsterEvent (eventually causing them to be kicked out because of desync). Closes #59 --- Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs b/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs index c63780770..9c2ed6ec2 100644 --- a/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs @@ -73,14 +73,14 @@ namespace Barotrauma { base.Init(); - monsters = SpawnMonsters(Rand.Range(minAmount, maxAmount, Rand.RandSync.Server)); + monsters = SpawnMonsters(Rand.Range(minAmount, maxAmount, Rand.RandSync.Server), false); if (GameSettings.VerboseLogging) { DebugConsole.NewMessage("Initialized MonsterEvent (" + monsters[0]?.SpeciesName + " x" + monsters.Length + ")", Color.White); } } - private Character[] SpawnMonsters(int amount) + private Character[] SpawnMonsters(int amount, bool createNetworkEvent) { if (disallowed) return null; @@ -101,7 +101,7 @@ namespace Barotrauma { spawnPos.X += Rand.Range(-0.5f, 0.5f, Rand.RandSync.Server); spawnPos.Y += Rand.Range(-0.5f, 0.5f, Rand.RandSync.Server); - monsters[i] = Character.Create(characterFile, spawnPos, null, GameMain.Client != null, true, false); + monsters[i] = Character.Create(characterFile, spawnPos, null, GameMain.Client != null, true, createNetworkEvent); } return monsters; @@ -127,7 +127,7 @@ namespace Barotrauma { if (monsters[i] == null || monsters[i].Removed || monsters[i].IsDead) { - monsters[i] = SpawnMonsters(1)[0]; + monsters[i] = SpawnMonsters(1, true)[0]; } } } From 8735dffd045a0a87cdff89f7e8410de06efe7116 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sun, 3 Dec 2017 15:36:20 +0200 Subject: [PATCH 3/3] Added console command for killing characters --- .../BarotraumaShared/Source/DebugConsole.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaShared/Source/DebugConsole.cs b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs index 7c237cb9d..adebef33a 100644 --- a/Barotrauma/BarotraumaShared/Source/DebugConsole.cs +++ b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs @@ -722,12 +722,30 @@ namespace Barotrauma } })); + commands.Add(new Command("kill", "kill [character]: Immediately kills the specified character.", (string[] args) => + { + Character killedCharacter = null; + if (args.Length == 0) + { + killedCharacter = Character.Controlled; + } + else + { + killedCharacter = FindMatchingCharacter(args); + } + + if (killedCharacter != null) + { + killedCharacter.AddDamage(CauseOfDeath.Damage, killedCharacter.MaxHealth * 2, null); + } + })); + commands.Add(new Command("killmonsters", "killmonsters: Immediately kills all AI-controlled enemies in the level.", (string[] args) => { foreach (Character c in Character.CharacterList) { if (!(c.AIController is EnemyAIController)) continue; - c.AddDamage(CauseOfDeath.Damage, 10000.0f, null); + c.AddDamage(CauseOfDeath.Damage, c.MaxHealth * 2, null); } }));