diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3a8542d --- /dev/null +++ b/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a23ba87 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# Sandwich Simulator +### A duck game mod by bbb651 + +*Now with 78% more junk* + +## Features +### Knife + +Used to make sandwiches. Oh and also murder ducks + +![Bread](content/knife.png) + +*Try using it near bread and other ingredients* + +### Ingredients +| Bread | Cheese | Cucamber | Lettuce | Tomato | +| :------------- | :----------: | -----------: | -----------: | -----------: | +| ![Bread](content/bread.png)| ![Bread](content/cheese.png)| ![Bread](content/cucamber.png)| ![Bread](content/lettuce.png)| ![Bread](content/tomato.png) +## Adding ingredient support to your mod +*Note: Please don't do this, I thought it would be a cool feature but it's currently really useless* + +This mod can support registering custom ingredients from other mods. +* Register the mod as a depedency +```xml + + sandwich_simulator + +``` +* Add the `Ingredient` attribute along with the sprite that will appear in the sandwich to each class you want to be an ingredient +```c# +[(new Sprite(GetPath("sandwich/vinegar")))] +class Vinegar : Gun, Ingredient { + + public Sprite GetSandwichSprite() { + return new Sprite(GetPath("sandwich/vinegar")); + } + + [...] +} +``` +* You can also add sandwich effects if you want to for some reason +```c# +Sandwich.AddEffect(delegate(Sandwich dave) { + // Gives dave a 9 inch duck + dave.duck.scale = new Vec2(9f, 9f); +}); +``` +(yes, I have the `{` on the same line fight me) + +## Support +If you have any questions about duck game or modding duck game, join the [Duck Game Discord Server](https://discord.gg/24tWqDQ). + +If you have any bug reports/questions/suggestion, open an issue in the repo, and if you need to contact me directly my discord is `bbb651#3370`. \ No newline at end of file diff --git a/content/bread.png b/content/bread.png new file mode 100644 index 0000000..e0ef507 Binary files /dev/null and b/content/bread.png differ diff --git a/content/cheese.png b/content/cheese.png new file mode 100644 index 0000000..99b6804 Binary files /dev/null and b/content/cheese.png differ diff --git a/content/cucamber.png b/content/cucamber.png new file mode 100644 index 0000000..be03842 Binary files /dev/null and b/content/cucamber.png differ diff --git a/content/knife.png b/content/knife.png new file mode 100644 index 0000000..b5d44b4 Binary files /dev/null and b/content/knife.png differ diff --git a/content/lettuce.png b/content/lettuce.png new file mode 100644 index 0000000..fd1f296 Binary files /dev/null and b/content/lettuce.png differ diff --git a/content/pastrami.png b/content/pastrami.png new file mode 100644 index 0000000..4d1f8e0 Binary files /dev/null and b/content/pastrami.png differ diff --git a/content/sandwich/bottom.png b/content/sandwich/bottom.png new file mode 100644 index 0000000..f4d75e4 Binary files /dev/null and b/content/sandwich/bottom.png differ diff --git a/content/sandwich/cheese.png b/content/sandwich/cheese.png new file mode 100644 index 0000000..c0e4046 Binary files /dev/null and b/content/sandwich/cheese.png differ diff --git a/content/sandwich/cucamber.png b/content/sandwich/cucamber.png new file mode 100644 index 0000000..ca21e58 Binary files /dev/null and b/content/sandwich/cucamber.png differ diff --git a/content/sandwich/lettuce.png b/content/sandwich/lettuce.png new file mode 100644 index 0000000..d2e74aa Binary files /dev/null and b/content/sandwich/lettuce.png differ diff --git a/content/sandwich/pastrami.png b/content/sandwich/pastrami.png new file mode 100644 index 0000000..58b0bb5 Binary files /dev/null and b/content/sandwich/pastrami.png differ diff --git a/content/sandwich/tomato.png b/content/sandwich/tomato.png new file mode 100644 index 0000000..00500d3 Binary files /dev/null and b/content/sandwich/tomato.png differ diff --git a/content/sandwich/top.png b/content/sandwich/top.png new file mode 100644 index 0000000..d716d8a Binary files /dev/null and b/content/sandwich/top.png differ diff --git a/content/tomato.png b/content/tomato.png new file mode 100644 index 0000000..72288f8 Binary files /dev/null and b/content/tomato.png differ diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..c68935f --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Ingredient.cs b/src/Ingredient.cs new file mode 100644 index 0000000..48ed5f0 --- /dev/null +++ b/src/Ingredient.cs @@ -0,0 +1,12 @@ +using DuckGame; + +namespace SandwichSimulator.src { + + interface Ingredient { + /// + /// The sprite that'll be used inside of the sandwich, there's a 1px transparent margin at the bottom + /// that the other sprite will be drawn on top of + /// + Sprite GetSandwichSprite(); + } +} diff --git a/src/Knife.cs b/src/Knife.cs new file mode 100644 index 0000000..a3c94a6 --- /dev/null +++ b/src/Knife.cs @@ -0,0 +1,25 @@ +using DuckGame; +using System.Collections.Generic; +using System.Linq; + +namespace SandwichSimulator.src { + [EditorGroup("Guns|Melee")] + class Knife : Sword { + public Knife(float xval, float yval) : base(xval, yval) { + graphic = new Sprite(GetPath("knife")); + _editorName = "Knife"; + editorTooltip = "The ultimate sandwich maker. Oh and did I mention it kills ducks?"; + } + + public override void Fire() { + base.Fire(); + IEnumerable ingredients = Level.CheckCircleAll(position, 40f); + if (ingredients.Any(x => x is Bread) && ingredients.Count() > 1) { + Level.Add(new Sandwich(position.x, position.y, ingredients)); + foreach (Ingredient ingredient in ingredients) { + Level.Remove((Thing)ingredient); + } + } + } + } +} diff --git a/src/Mod.cs b/src/Mod.cs new file mode 100644 index 0000000..7f61ec5 --- /dev/null +++ b/src/Mod.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + +[assembly: AssemblyTitle("Sandwich Simulator")] + +[assembly: AssemblyCompany("bbb651")] + +[assembly: AssemblyDescription("The real sandwiches are the friends you made along the way.")] + +[assembly: AssemblyVersion("1.0.0.0")] + +namespace DuckGame.SandwichSimulator { + public class MyMod : Mod { + public override Priority priority { + get { return base.priority; } + } + + protected override void OnPreInitialize() { + base.OnPreInitialize(); + DevConsole.AddCommand(new CMD("makemeasandwich", new CMD.Argument[] { }, + delegate (CMD cmd) { + DevConsole.Log("No.", Color.Red); + }) { + cheat = false, + hidden = true, + description = "Makes you a sandwich.", + aliases = new List { "dontmakemeasandwich", "isthiscommandreallynecessary" } + }); + + } + + protected override void OnPostInitialize() { + base.OnPostInitialize(); + } + } +} diff --git a/src/Sandwich.cs b/src/Sandwich.cs new file mode 100644 index 0000000..c14ed53 --- /dev/null +++ b/src/Sandwich.cs @@ -0,0 +1,110 @@ +using DuckGame; +using System; +using System.Collections.Generic; + +namespace SandwichSimulator.src { + + [EditorGroup("Stuff")] + class Sandwich : Holdable { + + private List _sprites; + + private static List> effects = new List> { + delegate(Sandwich instance) { + instance.duck.scale *= 1.25f; + }, + delegate(Sandwich instance) { + instance.duck.GoRagdoll(); + }, + delegate(Sandwich instance) { + instance.duck.blendColor = new Color(145, 83, 204, 127); + }, + delegate(Sandwich instance) { + instance.duck.Burn(instance.position, instance); + }, + delegate(Sandwich instance) { + instance.duck.scale = new Vec2(instance.duck.scale.x, instance.duck.scale.y* 0.5f); + }, + delegate(Sandwich instance) { + instance.duck.accelerationMultiplier *= 2; + }, + delegate(Sandwich instance) { + VirtualShotgun shotgun = new VirtualShotgun(instance.position.x, instance.position.y); + shotgun.infinite = true; + Level.Add(shotgun); + instance.duck.GiveHoldable(shotgun); + }, + delegate(Sandwich instance) { + instance.duck.dead = true; + }, + delegate(Sandwich instance) { + instance.duck.quackPitch *= 2; + }, + delegate(Sandwich instance) { + instance.duck._double = true; + }, + delegate(Sandwich instance) { + instance.duck.y -= 1000; + }, + delegate(Sandwich instance) { + instance.flipVertical = true; + }, + delegate(Sandwich instance) { + // Musical sandwich + Music.Play("jazzroom"); + }, + delegate(Sandwich instance) { + instance.scale = new Vec2(0.01f); + }, + delegate(Sandwich instance) { + Present present = new Present(instance.position.x, instance.position.y); + Level.Add(present); + instance.duck.GiveHoldable(present); + }, + delegate(Sandwich instance) { + instance.scale = new Vec2(100f, 100f); + }, + }; + + /// + /// Adds a random effect to the pool of effects that can trigger when eating a sandwich + /// + /// Callback that will be called when the sandwich is consumed and the event is choosen + public static void AddEffect(Action effect) { + effects.Add(effect); + } + + public Sandwich(float xval, float yval, IEnumerable ingredients = null) : base(xval, yval) { + _sprites = new List(); + _sprites.Add(new Sprite(GetPath("sandwich/top"))); + // The editor will not provide ingredients so it'll be null, empty sandwich is exclusive to the editor + if (ingredients != null) { + foreach (Ingredient ingredient in ingredients) { + _sprites.Add(ingredient.GetSandwichSprite()); + } + } + _sprites.Add(new Sprite(GetPath("sandwich/bottom"))); + graphic = new Sprite(); + collisionOffset = new Vec2(4f, 4f); + collisionSize = new Vec2(16f, 8f); + _editorName = "Sandwich"; + editorTooltip = "Who eats an empty sandwich?"; + } + + public override void OnPressAction() { + base.OnPressAction(); + // Invokes a random event and consumes the sandwich + effects[Rando.Int(effects.Count - 1)].Invoke(this); + Level.Remove(this); + } + + public override void Draw() { + Vec2 offset = new Vec2(-10f, -20f); + foreach (Sprite s in _sprites) { + base.Draw(s, offset); + // Draws the next sprite on the bottom pixel of the last sprite, to give the abillity to have a transition + offset.y += s.height - 1; + } + } + } +} diff --git a/src/ingredients/Bread.cs b/src/ingredients/Bread.cs new file mode 100644 index 0000000..f5267fa --- /dev/null +++ b/src/ingredients/Bread.cs @@ -0,0 +1,20 @@ +using DuckGame; + +namespace SandwichSimulator.src { + [EditorGroup("Stuff|Ingredients")] + class Bread : Holdable, Ingredient { + public Bread(float xval, float yval) : base(xval, yval) { + graphic = new Sprite(GetPath("bread")); + _holdOffset = new Vec2(-8f, -8f); + editorOffset = new Vec2(-8f, -8f); + collisionOffset = new Vec2(4f, 4f); + collisionSize = new Vec2(8f, 8f); + _editorName = "Bread"; + editorTooltip = "Pita sucks right? Bread is way better."; + } + + public Sprite GetSandwichSprite() { + return new Sprite(GetPath("sandwich/bottom")); + } + } +} diff --git a/src/ingredients/Cheese.cs b/src/ingredients/Cheese.cs new file mode 100644 index 0000000..89bb557 --- /dev/null +++ b/src/ingredients/Cheese.cs @@ -0,0 +1,20 @@ +using DuckGame; + +namespace SandwichSimulator.src { + [EditorGroup("Stuff|Ingredients")] + class Cheese : Holdable, Ingredient { + public Cheese(float xval, float yval) : base(xval, yval) { + graphic = new Sprite(GetPath("cheese")); + _holdOffset = new Vec2(-8f, -8f); + editorOffset = new Vec2(-8f, -8f); + collisionOffset = new Vec2(4f, 4f); + collisionSize = new Vec2(8f, 8f); + _editorName = "Cheese"; + editorTooltip = "I feel a little cheesey today, that's not gouda."; + } + + public Sprite GetSandwichSprite() { + return new Sprite(GetPath("sandwich/cheese")); + } + } +} diff --git a/src/ingredients/Cucamber.cs b/src/ingredients/Cucamber.cs new file mode 100644 index 0000000..efb81d8 --- /dev/null +++ b/src/ingredients/Cucamber.cs @@ -0,0 +1,20 @@ +using DuckGame; + +namespace SandwichSimulator.src { + [EditorGroup("Stuff|Ingredients")] + class Cucamber : Holdable, Ingredient { + public Cucamber(float xval, float yval) : base(xval, yval) { + graphic = new Sprite(GetPath("cucamber")); + _holdOffset = new Vec2(-8f, -8f); + editorOffset = new Vec2(-8f, -8f); + collisionOffset = new Vec2(4f, 4f); + collisionSize = new Vec2(8f, 8f); + _editorName = "Cucamber"; + editorTooltip = "Why did the cucamber cross the road? No really, I miss you Johny."; + } + + public Sprite GetSandwichSprite() { + return new Sprite(GetPath("sandwich/cucamber")); + } + } +} diff --git a/src/ingredients/Lettuce.cs b/src/ingredients/Lettuce.cs new file mode 100644 index 0000000..370719c --- /dev/null +++ b/src/ingredients/Lettuce.cs @@ -0,0 +1,20 @@ +using DuckGame; + +namespace SandwichSimulator.src { + [EditorGroup("Stuff|Ingredients")] + class Lettuce : Holdable, Ingredient { + public Lettuce(float xval, float yval) : base(xval, yval) { + graphic = new Sprite(GetPath("lettuce")); + _holdOffset = new Vec2(-8f, -8f); + editorOffset = new Vec2(-8f, -8f); + collisionOffset = new Vec2(4f, 4f); + collisionSize = new Vec2(8f, 8f); + _editorName = "Lettuce"; + editorTooltip = "Pita sucks right? Bread is way better."; + } + + public Sprite GetSandwichSprite() { + return new Sprite(GetPath("sandwich/lettuce")); + } + } +} diff --git a/src/ingredients/Pastrami.cs b/src/ingredients/Pastrami.cs new file mode 100644 index 0000000..7af7a49 --- /dev/null +++ b/src/ingredients/Pastrami.cs @@ -0,0 +1,20 @@ +using DuckGame; + +namespace SandwichSimulator.src { + [EditorGroup("Stuff|Ingredients")] + class Pastrami : Holdable, Ingredient { + public Pastrami(float xval, float yval) : base(xval, yval) { + graphic = new Sprite(GetPath("pastrami")); + _holdOffset = new Vec2(-8f, -8f); + editorOffset = new Vec2(-8f, -8f); + collisionOffset = new Vec2(4f, 4f); + collisionSize = new Vec2(8f, 8f); + _editorName = "Pastrami"; + editorTooltip = "Pastrami, pastrayou, pastraus."; + } + + public Sprite GetSandwichSprite() { + return new Sprite(GetPath("sandwich/pastrami")); + } + } +} diff --git a/src/ingredients/Tomato.cs b/src/ingredients/Tomato.cs new file mode 100644 index 0000000..b37ba0c --- /dev/null +++ b/src/ingredients/Tomato.cs @@ -0,0 +1,20 @@ +using DuckGame; + +namespace SandwichSimulator.src { + [EditorGroup("Stuff|Ingredients")] + class Tomato : Holdable, Ingredient { + public Tomato(float xval, float yval) : base(xval, yval) { + graphic = new Sprite(GetPath("tomato")); + _holdOffset = new Vec2(-8f, -8f); + editorOffset = new Vec2(-8f, -8f); + collisionOffset = new Vec2(4f, 4f); + collisionSize = new Vec2(8f, 8f); + _editorName = "Tomato"; + editorTooltip = "Help! I'm being eaten alive by a sworm of ducks god no!!!".ToUpper(); + } + + public Sprite GetSandwichSprite() { + return new Sprite(GetPath("sandwich/tomato")); + } + } +}