Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Printer collect
- @outputs Fire
- @persist [Bitminers]:array [Bitclass]:table UserFound Gray:vector CollectNum Collecting User:entity
- @autoupdate
- #[How to use this piece of shit:
- Put it down somewhere.
- Put a user real close to it.
- Pull out your grav gun.
- Aim at a bit miner.
- Click.
- Carry on about your day.]#
- if(first()){
- timer("collect",300000)
- timer("userfind",250)
- findIncludePlayerProps(owner())
- Bitclass["sent_elegant_printer",number] = 1
- Gray = vec(150,150,150)
- function number entExists(Ent:entity,Ar:array){
- foreach(I,E:entity = Ar){
- if(E == Ent){
- return I
- }
- }
- return 0
- }
- }
- #Finding the user
- if(clk("userfind")){
- findByClass("gmod_wire_user")
- foreach(I,E:entity = findToArray()){
- if(E:pos():distance(entity():pos()) < 20){
- User = E
- User:createWire(entity(),"Fire","Fire")
- User:setPos(entity():pos() + vec(0,0,10))
- User:setAng(ang(0,0,180))
- UserFound = 1
- printColor(Gray,"User found.")
- break
- }
- }
- if(!UserFound){
- timer("userfind",250)
- }
- }
- #Adding Printers
- if(owner():weapon():type() != "weapon_physcannon"){
- interval(100)
- runOnTick(0)
- }
- else{
- runOnTick(1)
- if(owner():keyAttack1()){
- local Ent = owner():aimEntity()
- if(Bitclass[Ent:type(),number]){
- if(!entExists(Ent,Bitminers)){
- Bitminers:pushEntity(Ent)
- printColor(Gray,"Printer added.")
- }
- }
- }
- }
- #Collecting money
- if(clk("collect")){
- if(Bitminers:count()){
- Collecting = 1
- CollectNum = 1
- timer("col1",100)
- printColor(Gray,"Collecting from "+Bitminers:count()+" Printers...")
- }
- else{
- timer("collect",300000)
- printColor(vec(255,0,0),"No Printers to collect from.")
- }
- }
- if(Collecting){
- if(clk("col1")){
- User:setPos(Bitminers[CollectNum,entity]:pos() + vec(0,0,5))
- timer("col2",250)
- }
- if(clk("col2")){
- Fire = 1
- timer("col3",250)
- }
- if(clk("col3")){
- Fire = 0
- CollectNum++
- if(CollectNum > Bitminers:count()){
- timer("collect",300000)
- printColor(Gray,"Collection completed!")
- User:setPos(entity():pos() + vec(0,0,10))
- User:setAng(ang(0,0,180))
- Collecting = 0
- CollectNum = 0
- }
- else{
- timer("col1",250)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement