-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from RimNauts/main
Minor update
- Loading branch information
Showing
11 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# Changelog | ||
- Add flickable comp to delivery cannon to turn the power on/off | ||
- Add a 'manual' mode to the delivery cannon allowing the user to send delivery when pressing a button |
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
80 changes: 80 additions & 0 deletions
80
Source/RimNauts2/RimNauts2/Things/Comps/DeliveryCannonMode.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using Verse; | ||
|
||
namespace RimNauts2.Things.Comps { | ||
public class DeliveryCannonMode_Properties : CompProperties { | ||
public DeliveryCannonMode_Properties() => compClass = typeof(Mode); | ||
} | ||
|
||
public class Mode : ThingComp { | ||
public DeliveryCannonMode_Properties Props => (DeliveryCannonMode_Properties) props; | ||
public bool automatic = true; | ||
public bool fire_once = false; | ||
|
||
public override void PostExposeData() { | ||
base.PostExposeData(); | ||
Scribe_Values.Look(ref automatic, "automatic", true); | ||
Scribe_Values.Look(ref fire_once, "fire_once", false); | ||
} | ||
|
||
public override IEnumerable<Gizmo> CompGetGizmosExtra() { | ||
if (automatic) { | ||
Command_Action cmd = new Command_Action { | ||
defaultLabel = "RimNauts.Label.delivery_cannon_mode_auto".Translate(), | ||
defaultDesc = "RimNauts.Description.delivery_cannon_mode_auto".Translate(), | ||
icon = ContentFinder<Texture2D>.Get("Icons/RimNauts2_DeliveryCannon_ManualMode", true), | ||
action = new Action(change_mode) | ||
}; | ||
yield return cmd; | ||
} else { | ||
Command_Action cmd = new Command_Action { | ||
defaultLabel = "RimNauts.Label.delivery_cannon_mode_manual".Translate(), | ||
defaultDesc = "RimNauts.Description.delivery_cannon_mode_manual".Translate(), | ||
icon = ContentFinder<Texture2D>.Get("Icons/RimNauts2_DeliveryCannon_AutomaticMode", true), | ||
action = new Action(change_mode) | ||
}; | ||
yield return cmd; | ||
if (fire_once) { | ||
Command_Action cmd_fire = new Command_Action { | ||
defaultLabel = "RimNauts.Label.delivery_cannon_stop_delivery".Translate(), | ||
defaultDesc = "RimNauts.Description.delivery_cannon_stop_delivery".Translate(), | ||
icon = ContentFinder<Texture2D>.Get("Icons/RimNauts2_DeliveryCannon_Cancel", true), | ||
action = new Action(order_fire) | ||
}; | ||
yield return cmd_fire; | ||
} else { | ||
Command_Action cmd_fire = new Command_Action { | ||
defaultLabel = "RimNauts.Label.delivery_cannon_send_delivery".Translate(), | ||
defaultDesc = "RimNauts.Description.delivery_cannon_send_delivery".Translate(), | ||
icon = ContentFinder<Texture2D>.Get("UI/Commands/LaunchShip", true), | ||
action = new Action(order_fire) | ||
}; | ||
yield return cmd_fire; | ||
} | ||
|
||
} | ||
} | ||
|
||
public override string CompInspectStringExtra() { | ||
return "Automatic firing mode: " + automatic; | ||
} | ||
|
||
public void change_mode() { | ||
automatic = !automatic; | ||
fire_once = false; | ||
} | ||
|
||
public void order_fire() { | ||
fire_once = !fire_once; | ||
} | ||
|
||
public bool can_fire() { | ||
if (automatic) return true; | ||
if (!fire_once) return false; | ||
fire_once = false; | ||
return true; | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.