Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon this card as an Effect Monster (Machine/EARTH/Level 4/ATK 0/DEF 2000), then, you can equip 1 Level 4 Machine "Gadget" monster from your hand or Deck to this card. (This card is also still a Trap.) If Summoned this way, this card gains ATK equal to double the ATK of the monster equipped to it by this effect.
--機動砲塁 パワー・ホールド
--Powerhold the Moving Battery
--Scripted by AlphaKretin
local s,id=GetID()
function s.initial_effect(c)
	--Special summon this card as a monster, then equip 1 "Gadget" monster from hand or deck to it
	local e1=Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_EQUIP)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	e1:SetHintTiming(0,TIMING_BATTLE_START|TIMING_END_PHASE)
	c:RegisterEffect(e1)
end
s.listed_series={SET_GADGET}
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 
		and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,0,2000,4,RACE_MACHINE,ATTRIBUTE_EARTH) end
	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function s.eqfilter(c)
	return c:IsLevel(4) and c:IsRace(RACE_MACHINE) and c:IsSetCard(SET_GADGET)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
	local c=e:GetHandler()
	if not c:IsRelateToEffect(e) then return end
	if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
		or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,0,2000,4,RACE_MACHINE,ATTRIBUTE_EARTH) then return end
	c:AddMonsterAttribute(TYPE_EFFECT+TYPE_TRAP)
	Duel.SpecialSummonStep(c,1,tp,tp,true,false,POS_FACEUP)
	--atk
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetCode(EFFECT_UPDATE_ATTACK)
	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e1:SetRange(LOCATION_MZONE)
	e1:SetReset(RESET_EVENT|RESETS_STANDARD)
	e1:SetValue(s.atkval)
	c:RegisterEffect(e1)
	c:AddMonsterAttributeComplete()
	local g=Duel.GetMatchingGroup(s.eqfilter,tp,LOCATION_DECK|LOCATION_HAND,0,nil)
	if Duel.SpecialSummonComplete()==1 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
		Duel.BreakEffect()
		Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
		local tc=g:Select(tp,1,1,nil):GetFirst()
		aux.AddEREquipLimit(c,nil,s.eqval,s.equipop,e,nil,RESET_EVENT|RESETS_STANDARD_DISABLE)
		s.equipop(c,e,tp,tc,true)
	end
end
function s.eqval(ec,c,tp)
	return ec:IsControler(tp) and ec:IsRace(RACE_MACHINE) and ec:GetLevel()==4
end
function s.equipop(c,e,tp,tc,chk)
	local eff=false or chk
	Duel.Equip(tp,tc,c,true,eff)
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
	e1:SetCode(EFFECT_EQUIP_LIMIT)
	e1:SetReset(RESET_EVENT|RESETS_STANDARD)
	e1:SetValue(Card.EquipByEffectLimit)
	e1:SetLabelObject(e:GetLabelObject())
	tc:RegisterEffect(e1)
	tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,0)
end
function s.idfilter(c)
	return c:GetFlagEffect(id)~=0
end
function s.atkval(e,c)
	local tc=c:GetEquipGroup():Filter(s.idfilter,nil):GetFirst()
	if tc then return tc:GetAttack()*2 else return 0 end
end